summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx14
-rw-r--r--svtools/source/brwbox/editbrowsebox.src2
-rw-r--r--svtools/source/config/accelcfg.cxx292
-rw-r--r--svtools/source/config/accessibilityoptions.cxx11
-rw-r--r--svtools/source/config/addxmltostorageoptions.cxx291
-rw-r--r--svtools/source/config/apearcfg.cxx10
-rw-r--r--svtools/source/config/cacheoptions.cxx510
-rw-r--r--svtools/source/config/cjkoptions.cxx510
-rw-r--r--svtools/source/config/cmdoptions.cxx631
-rw-r--r--svtools/source/config/colorcfg.cxx104
-rw-r--r--svtools/source/config/compatibility.cxx807
-rw-r--r--svtools/source/config/ctloptions.cxx503
-rw-r--r--svtools/source/config/defaultoptions.cxx354
-rw-r--r--svtools/source/config/dynamicmenuoptions.cxx923
-rw-r--r--svtools/source/config/eventcfg.cxx458
-rw-r--r--svtools/source/config/extcolorcfg.cxx11
-rw-r--r--svtools/source/config/extendedsecurityoptions.cxx541
-rw-r--r--svtools/source/config/fltrcfg.cxx611
-rw-r--r--svtools/source/config/fontoptions.cxx514
-rw-r--r--svtools/source/config/fontsubstconfig.cxx11
-rw-r--r--svtools/source/config/helpopt.cxx5
-rw-r--r--svtools/source/config/historyoptions.cxx748
-rw-r--r--svtools/source/config/inetoptions.cxx557
-rw-r--r--svtools/source/config/internaloptions.cxx631
-rw-r--r--svtools/source/config/itemholder1.cxx325
-rw-r--r--svtools/source/config/itemholder1.hxx92
-rw-r--r--svtools/source/config/itemholder2.cxx42
-rw-r--r--svtools/source/config/itemholder2.hxx2
-rw-r--r--svtools/source/config/itemholderbase.hxx131
-rw-r--r--svtools/source/config/javaoptions.cxx367
-rw-r--r--svtools/source/config/languageoptions.cxx283
-rw-r--r--svtools/source/config/lingucfg.cxx1452
-rw-r--r--svtools/source/config/localisationoptions.cxx459
-rw-r--r--svtools/source/config/loghelper.hxx59
-rw-r--r--svtools/source/config/makefile.mk80
-rw-r--r--svtools/source/config/menuoptions.cxx20
-rw-r--r--svtools/source/config/misccfg.cxx195
-rw-r--r--svtools/source/config/miscopt.cxx62
-rw-r--r--svtools/source/config/moduleoptions.cxx1600
-rw-r--r--svtools/source/config/optionsdlg.cxx293
-rw-r--r--svtools/source/config/optionsdrawinglayer.cxx8
-rw-r--r--svtools/source/config/pathoptions.cxx1094
-rw-r--r--svtools/source/config/printoptions.cxx7
-rw-r--r--svtools/source/config/printwarningoptions.cxx419
-rw-r--r--svtools/source/config/regoptions.cxx554
-rw-r--r--svtools/source/config/saveopt.cxx1047
-rw-r--r--svtools/source/config/searchopt.cxx634
-rw-r--r--svtools/source/config/securityoptions.cxx1312
-rw-r--r--svtools/source/config/sourceviewconfig.cxx281
-rw-r--r--svtools/source/config/startoptions.cxx461
-rw-r--r--svtools/source/config/syslocaleoptions.cxx637
-rw-r--r--svtools/source/config/test/test.cxx2
-rw-r--r--svtools/source/config/undoopt.cxx220
-rw-r--r--svtools/source/config/useroptions.cxx1313
-rw-r--r--svtools/source/config/viewoptions.cxx1304
-rw-r--r--svtools/source/config/workingsetoptions.cxx396
-rw-r--r--svtools/source/config/xmlaccelcfg.cxx424
-rw-r--r--svtools/source/contnr/contentenumeration.cxx2
-rw-r--r--svtools/source/contnr/fileview.cxx8
-rw-r--r--svtools/source/contnr/fileview.src2
-rw-r--r--svtools/source/contnr/imivctl.hxx2
-rw-r--r--svtools/source/contnr/ivctrl.cxx7
-rw-r--r--svtools/source/contnr/svcontnr.src2
-rw-r--r--svtools/source/contnr/svimpbox.cxx2
-rw-r--r--svtools/source/contnr/svimpicn.cxx2
-rw-r--r--svtools/source/contnr/svlbitm.cxx3
-rw-r--r--svtools/source/contnr/svlbox.cxx2
-rw-r--r--svtools/source/contnr/svtabbx.cxx2
-rw-r--r--svtools/source/contnr/svtreebx.cxx2
-rw-r--r--svtools/source/contnr/templwin.cxx20
-rw-r--r--svtools/source/contnr/templwin.hxx2
-rw-r--r--svtools/source/contnr/templwin.src2
-rw-r--r--svtools/source/contnr/treelist.cxx2
-rw-r--r--svtools/source/control/calendar.cxx2
-rw-r--r--svtools/source/control/calendar.src2
-rw-r--r--svtools/source/control/collatorres.cxx2
-rw-r--r--svtools/source/control/ctrlbox.cxx5
-rw-r--r--svtools/source/control/ctrlbox.src2
-rw-r--r--svtools/source/control/ctrltool.cxx2
-rw-r--r--svtools/source/control/ctrltool.src2
-rw-r--r--svtools/source/control/fileurlbox.cxx2
-rw-r--r--svtools/source/control/fmtfield.cxx4
-rw-r--r--svtools/source/control/hyperlabel.cxx43
-rw-r--r--svtools/source/control/indexentryres.cxx2
-rw-r--r--svtools/source/control/inettbc.cxx18
-rw-r--r--svtools/source/control/makefile.mk1
-rw-r--r--svtools/source/control/reginfo.cxx375
-rw-r--r--svtools/source/control/roadmap.cxx687
-rw-r--r--svtools/source/control/taskstat.cxx2
-rw-r--r--svtools/source/control/urlcontrol.cxx6
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx16
-rw-r--r--svtools/source/dialogs/addresstemplate.src2
-rw-r--r--svtools/source/dialogs/filedlg2.hrc44
-rw-r--r--svtools/source/dialogs/logindlg.cxx2
-rw-r--r--svtools/source/dialogs/logindlg.src2
-rw-r--r--svtools/source/dialogs/printdlg.cxx4
-rw-r--r--svtools/source/dialogs/printdlg.hrc2
-rw-r--r--svtools/source/dialogs/prnsetup.hrc2
-rw-r--r--svtools/source/dialogs/propctrl.hxx118
-rw-r--r--svtools/source/dialogs/roadmapwizard.cxx2
-rw-r--r--svtools/source/dialogs/wizardmachine.cxx2
-rw-r--r--svtools/source/dialogs/wizardmachine.src2
-rw-r--r--svtools/source/edit/svmedit.cxx10
-rw-r--r--svtools/source/edit/syntaxhighlight.cxx2
-rw-r--r--svtools/source/edit/textdat2.hxx2
-rw-r--r--svtools/source/edit/textdoc.hxx2
-rw-r--r--svtools/source/edit/texteng.cxx2
-rw-r--r--svtools/source/edit/textundo.hxx2
-rw-r--r--svtools/source/edit/textview.cxx4
-rw-r--r--svtools/source/filepicker/makefile.mk51
-rw-r--r--svtools/source/filepicker/pickerhelper.cxx102
-rw-r--r--svtools/source/filepicker/pickerhistory.cxx141
-rw-r--r--svtools/source/filerec/filerec.cxx1019
-rw-r--r--svtools/source/filerec/makefile.mk50
-rw-r--r--svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx4
-rw-r--r--svtools/source/filter.vcl/filter/dlgejpg.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/dlgepng.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/dlgexpor.hrc2
-rw-r--r--svtools/source/filter.vcl/filter/filter.cxx2
-rw-r--r--svtools/source/filter.vcl/filter/makefile.mk2
-rw-r--r--svtools/source/filter.vcl/filter/strings.hrc2
-rw-r--r--svtools/source/filter.vcl/igif/decode.cxx3
-rw-r--r--svtools/source/filter.vcl/igif/makefile.mk1
-rw-r--r--svtools/source/filter.vcl/ixbm/makefile.mk1
-rw-r--r--svtools/source/filter.vcl/ixpm/makefile.mk1
-rw-r--r--svtools/source/filter.vcl/ixpm/xpmread.cxx21
-rw-r--r--svtools/source/filter.vcl/jpeg/makefile.mk2
-rw-r--r--svtools/source/filter.vcl/wmf/emfwr.cxx94
-rw-r--r--svtools/source/filter.vcl/wmf/emfwr.hxx4
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.cxx92
-rw-r--r--svtools/source/filter.vcl/wmf/wmfwr.hxx4
-rw-r--r--svtools/source/fsstor/exports.map8
-rw-r--r--svtools/source/fsstor/fsfactory.cxx295
-rw-r--r--svtools/source/fsstor/fsstorage.cxx1617
-rw-r--r--svtools/source/fsstor/fsstorage.hxx340
-rw-r--r--svtools/source/fsstor/makefile.mk70
-rw-r--r--svtools/source/fsstor/oinputstreamcontainer.cxx350
-rw-r--r--svtools/source/fsstor/oinputstreamcontainer.hxx99
-rw-r--r--svtools/source/fsstor/ostreamcontainer.cxx570
-rw-r--r--svtools/source/fsstor/ostreamcontainer.hxx128
-rw-r--r--svtools/source/hatchwindow/hatchwindowfactory.hxx (renamed from svtools/source/inc/hatchwindowfactory.hxx)0
-rw-r--r--svtools/source/inc/configitems/historyoptions_const.hxx63
-rw-r--r--svtools/source/inc/configitems/useroptions_const.hxx64
-rw-r--r--svtools/source/inc/filectrl.hrc (renamed from svtools/source/misc/config.src)41
-rw-r--r--svtools/source/inc/fsfactory.hxx75
-rw-r--r--svtools/source/inc/gifread.hxx147
-rw-r--r--svtools/source/inc/gradwrap.hxx80
-rw-r--r--svtools/source/inc/iodlg.hrc110
-rw-r--r--svtools/source/inc/jpeg.hxx127
-rw-r--r--svtools/source/inc/msgrd.hxx (renamed from svtools/source/misc/iniman.src)44
-rw-r--r--svtools/source/inc/msgwr.hxx (renamed from svtools/source/config/options.cxx)17
-rw-r--r--svtools/source/inc/passwordcontainer.hxx429
-rw-r--r--svtools/source/inc/poolio.hxx204
-rw-r--r--svtools/source/inc/property.hxx588
-rw-r--r--svtools/source/inc/sgfbram.hxx160
-rw-r--r--svtools/source/inc/sgffilt.hxx (renamed from svtools/source/items/eitem.cxx)35
-rw-r--r--svtools/source/inc/sgvmain.hxx356
-rw-r--r--svtools/source/inc/sgvspln.hxx76
-rw-r--r--svtools/source/inc/svimpbox.hxx477
-rw-r--r--svtools/source/inc/svimpicn.hxx324
-rw-r--r--svtools/source/inc/xbmread.hxx100
-rw-r--r--svtools/source/inc/xpmread.hxx134
-rw-r--r--svtools/source/items/aeitem.cxx317
-rw-r--r--svtools/source/items/flagitem.cxx166
-rw-r--r--svtools/source/items/globalnameitem.cxx117
-rw-r--r--svtools/source/items/imageitm.cxx148
-rw-r--r--svtools/source/items/intitem.cxx261
-rw-r--r--svtools/source/items/macitem.cxx298
-rw-r--r--svtools/source/items/makefile.mk65
-rw-r--r--svtools/source/items/poolcach.cxx159
-rw-r--r--svtools/source/items/ptitem.cxx208
-rw-r--r--svtools/source/items/rectitem.cxx204
-rw-r--r--svtools/source/items/rngitem.cxx57
-rwxr-xr-xsvtools/source/items/rngitem_inc.cxx243
-rw-r--r--svtools/source/items/stritem.cxx75
-rw-r--r--svtools/source/items/style.cxx1381
-rw-r--r--svtools/source/items/szitem.cxx214
-rw-r--r--svtools/source/items1/bintitem.cxx169
-rw-r--r--svtools/source/items1/cenumitm.cxx297
-rw-r--r--svtools/source/items1/cintitem.cxx565
-rw-r--r--svtools/source/items1/cntwall.cxx170
-rw-r--r--svtools/source/items1/cstitem.cxx252
-rw-r--r--svtools/source/items1/cstitem.src112
-rw-r--r--svtools/source/items1/ctypeitm.cxx254
-rw-r--r--svtools/source/items1/custritm.cxx141
-rw-r--r--svtools/source/items1/dateitem.cxx284
-rw-r--r--svtools/source/items1/dtritem.cxx244
-rw-r--r--svtools/source/items1/frqitem.cxx580
-rw-r--r--svtools/source/items1/ilstitem.cxx106
-rw-r--r--svtools/source/items1/itemiter.cxx122
-rw-r--r--svtools/source/items1/itempool.cxx1176
-rw-r--r--svtools/source/items1/itemprop.cxx506
-rw-r--r--svtools/source/items1/itemset.cxx2128
-rw-r--r--svtools/source/items1/lckbitem.cxx194
-rw-r--r--svtools/source/items1/makefile.mk79
-rw-r--r--svtools/source/items1/nranges.cxx853
-rw-r--r--svtools/source/items1/poolio.cxx1715
-rw-r--r--svtools/source/items1/poolitem.cxx527
-rw-r--r--svtools/source/items1/sfontitm.cxx142
-rw-r--r--svtools/source/items1/sitem.cxx116
-rw-r--r--svtools/source/items1/slstitm.cxx425
-rw-r--r--svtools/source/items1/stylepool.cxx542
-rw-r--r--svtools/source/items1/tfrmitem.cxx184
-rw-r--r--svtools/source/items1/tresitem.cxx78
-rw-r--r--svtools/source/items1/visitem.cxx148
-rw-r--r--svtools/source/items1/whassert.hxx57
-rw-r--r--svtools/source/items1/whiter.cxx127
-rw-r--r--svtools/source/java/javaerror.src2
-rw-r--r--svtools/source/java/javainteractionhandler.cxx2
-rw-r--r--svtools/source/java/patchjavaerror.src2
-rw-r--r--svtools/source/memtools/makefile.mk50
-rw-r--r--svtools/source/memtools/svarray.cxx385
-rw-r--r--svtools/source/misc/documentlockfile.cxx238
-rw-r--r--svtools/source/misc/ehdl.cxx2
-rw-r--r--svtools/source/misc/ehdl.src2
-rw-r--r--svtools/source/misc/embedhlp.cxx44
-rw-r--r--svtools/source/misc/errtxt.src2
-rw-r--r--svtools/source/misc/flbytes.cxx432
-rw-r--r--svtools/source/misc/helpagent.src2
-rw-r--r--svtools/source/misc/helpagentwindow.cxx2
-rw-r--r--svtools/source/misc/imagemgr.cxx3
-rw-r--r--svtools/source/misc/imagemgr.src2
-rw-r--r--svtools/source/misc/imap.cxx2
-rw-r--r--svtools/source/misc/imap2.cxx2
-rw-r--r--svtools/source/misc/inidef.cxx269
-rw-r--r--svtools/source/misc/iniprop.cxx47
-rw-r--r--svtools/source/misc/itemdel.cxx (renamed from svtools/source/items/itemdel.cxx)4
-rw-r--r--svtools/source/misc/langtab.cxx4
-rw-r--r--svtools/source/misc/langtab.src2
-rw-r--r--svtools/source/misc/lockfilecommon.cxx276
-rw-r--r--svtools/source/misc/makefile.mk37
-rw-r--r--svtools/source/misc/ownlist.cxx330
-rw-r--r--svtools/source/misc/restrictedpaths.cxx217
-rw-r--r--svtools/source/misc/sharecontrolfile.cxx376
-rw-r--r--svtools/source/misc/svtaccessiblefactory.cxx9
-rw-r--r--svtools/source/misc/svtdata.cxx (renamed from svtools/source/misc1/svtdata.cxx)44
-rw-r--r--svtools/source/misc/templatefoldercache.cxx2
-rw-r--r--svtools/source/misc/transfer.cxx2
-rw-r--r--svtools/source/misc/transfer2.cxx2
-rw-r--r--svtools/source/misc/urihelper.cxx952
-rw-r--r--svtools/source/misc/vcldata.cxx57
-rw-r--r--svtools/source/misc/wallitem.cxx (renamed from svtools/source/items/wallitem.cxx)2
-rw-r--r--svtools/source/misc1/PasswordHelper.cxx109
-rw-r--r--svtools/source/misc1/adrparse.cxx921
-rw-r--r--svtools/source/misc1/filenotation.cxx147
-rw-r--r--svtools/source/misc1/folderrestriction.cxx109
-rw-r--r--svtools/source/misc1/fstathelper.cxx103
-rw-r--r--svtools/source/misc1/inethist.cxx545
-rw-r--r--svtools/source/misc1/inettype.cxx1348
-rw-r--r--svtools/source/misc1/iniadrtk.cxx76
-rw-r--r--svtools/source/misc1/lngmisc.cxx141
-rw-r--r--svtools/source/misc1/makefile.mk69
-rw-r--r--svtools/source/misc1/mediatyp.src610
-rw-r--r--svtools/source/misc1/strmadpt.cxx1048
-rw-r--r--svtools/source/notify/brdcst.cxx212
-rw-r--r--svtools/source/notify/broadcast.cxx151
-rw-r--r--svtools/source/notify/cancel.cxx204
-rw-r--r--svtools/source/notify/hint.cxx50
-rw-r--r--svtools/source/notify/isethint.cxx78
-rw-r--r--svtools/source/notify/listener.cxx169
-rw-r--r--svtools/source/notify/listenerbase.cxx84
-rw-r--r--svtools/source/notify/listenerbase.hxx60
-rw-r--r--svtools/source/notify/listeneriter.cxx195
-rw-r--r--svtools/source/notify/lstner.cxx196
-rw-r--r--svtools/source/notify/makefile.mk67
-rw-r--r--svtools/source/notify/smplhint.cxx50
-rw-r--r--svtools/source/numbers/makefile.mk78
-rw-r--r--svtools/source/numbers/nbdll.cxx82
-rw-r--r--svtools/source/numbers/numfmuno.cxx1144
-rw-r--r--svtools/source/numbers/numfmuno.hxx324
-rw-r--r--svtools/source/numbers/numhead.cxx252
-rw-r--r--svtools/source/numbers/numhead.hxx109
-rw-r--r--svtools/source/numbers/numuno.cxx171
-rw-r--r--svtools/source/numbers/supservs.cxx233
-rw-r--r--svtools/source/numbers/supservs.hxx105
-rw-r--r--svtools/source/numbers/zforfind.cxx2819
-rw-r--r--svtools/source/numbers/zforlist.cxx4362
-rw-r--r--svtools/source/numbers/zformat.cxx4480
-rw-r--r--svtools/source/numbers/zforscan.cxx2812
-rw-r--r--svtools/source/numbers/zforscan.hxx278
-rw-r--r--svtools/source/passwordcontainer/exports.map8
-rw-r--r--svtools/source/passwordcontainer/makefile.mk66
-rw-r--r--svtools/source/passwordcontainer/passwordcontainer.cxx1595
-rw-r--r--svtools/source/passwordcontainer/syscreds.cxx298
-rw-r--r--svtools/source/passwordcontainer/syscreds.hxx95
-rw-r--r--svtools/source/plugapp/testtool.src2
-rw-r--r--svtools/source/productregistration/makefile.mk3
-rw-r--r--svtools/source/productregistration/productregistration.cxx20
-rw-r--r--svtools/source/productregistration/registrationdlg.cxx2
-rw-r--r--svtools/source/productregistration/registrationdlg.src2
-rw-r--r--svtools/source/svdde/ddecli.cxx474
-rw-r--r--svtools/source/svdde/ddedata.cxx233
-rw-r--r--svtools/source/svdde/ddedll.cxx67
-rw-r--r--svtools/source/svdde/ddeimp.hxx180
-rw-r--r--svtools/source/svdde/ddeinf.cxx193
-rw-r--r--svtools/source/svdde/ddeml1.cxx2661
-rw-r--r--svtools/source/svdde/ddeml2.cxx1014
-rw-r--r--svtools/source/svdde/ddemldeb.cxx283
-rw-r--r--svtools/source/svdde/ddemldeb.hxx69
-rw-r--r--svtools/source/svdde/ddemlimp.hxx436
-rw-r--r--svtools/source/svdde/ddemlos2.h377
-rw-r--r--svtools/source/svdde/ddestrg.cxx81
-rw-r--r--svtools/source/svdde/ddesvr.cxx1107
-rw-r--r--svtools/source/svdde/ddewrap.cxx103
-rw-r--r--svtools/source/svdde/ddewrap.hxx24
-rw-r--r--svtools/source/svdde/makefile.mk64
-rw-r--r--svtools/source/svhtml/htmlout.cxx8
-rw-r--r--svtools/source/svhtml/htmlsupp.cxx2
-rw-r--r--svtools/source/svhtml/parhtml.cxx4
-rw-r--r--svtools/source/svrtf/rtfkeywd.hxx1144
-rw-r--r--svtools/source/svrtf/rtfout.hxx70
-rw-r--r--svtools/source/svrtf/rtftoken.h1276
-rw-r--r--svtools/source/svrtf/svparser.cxx10
-rw-r--r--svtools/source/svsql/converter.cxx45
-rw-r--r--svtools/source/svsql/converter.hxx46
-rw-r--r--svtools/source/svsql/makefile.mk50
-rw-r--r--svtools/source/syslocale/makefile.mk48
-rw-r--r--svtools/source/syslocale/syslocale.cxx176
-rw-r--r--svtools/source/table/tablecontrol.cxx372
-rw-r--r--svtools/source/table/tablecontrol_impl.cxx25
-rw-r--r--svtools/source/table/tablecontrol_impl.hxx20
-rw-r--r--svtools/source/undo/makefile.mk51
-rw-r--r--svtools/source/undo/undo.cxx819
-rw-r--r--svtools/source/uno/addrtempuno.cxx248
-rw-r--r--svtools/source/uno/contextmenuhelper.cxx2
-rw-r--r--svtools/source/uno/makefile.mk18
-rw-r--r--svtools/source/uno/miscservices.cxx (renamed from svtools/source/uno/registerservices.cxx)80
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.cxx458
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.hxx106
-rw-r--r--svtools/source/uno/toolboxcontroller.cxx2
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx481
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx96
-rw-r--r--svtools/source/uno/unoevent.cxx2
-rw-r--r--svtools/source/uno/unoifac2.hrc2
-rw-r--r--svtools/source/uno/unoiface.cxx11
335 files changed, 5035 insertions, 88892 deletions
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index 086e00674a8e..09d1f5c869b9 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -50,7 +50,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#include <algorithm>
@@ -70,17 +70,7 @@ namespace svt
sal_Bool isHiContrast(Window* _pWindow)
{
OSL_ENSURE(_pWindow,"Window must be not null!");
- Window* pIter = _pWindow;
- // while( pIter && pIter->GetBackground().GetColor().GetColor() == COL_TRANSPARENT )
- while( pIter )
- {
- const Color& aColor = pIter->GetBackground().GetColor();
- if ( aColor.GetColor() == COL_TRANSPARENT )
- pIter = pIter->GetParent();
- else
- break;
- }
- return pIter && pIter->GetBackground().GetColor().IsDark();
+ return _pWindow && _pWindow->GetSettings().GetStyleSettings().GetHighContrastMode();
}
//..............................................................
diff --git a/svtools/source/brwbox/editbrowsebox.src b/svtools/source/brwbox/editbrowsebox.src
index 39991363c906..c04e1294c0af 100644
--- a/svtools/source/brwbox/editbrowsebox.src
+++ b/svtools/source/brwbox/editbrowsebox.src
@@ -33,7 +33,7 @@
#endif
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
ImageList RID_SVTOOLS_IMAGELIST_EDITBROWSEBOX
diff --git a/svtools/source/config/accelcfg.cxx b/svtools/source/config/accelcfg.cxx
deleted file mode 100644
index 6daa1a9491a2..000000000000
--- a/svtools/source/config/accelcfg.cxx
+++ /dev/null
@@ -1,292 +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: accelcfg.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-#include "rtl/instance.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-
-#include <osl/mutex.hxx>
-#include <tools/string.hxx>
-#include <tools/urlobj.hxx>
-#include <unotools/streamwrap.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <svtools/accelcfg.hxx>
-#include "xmlaccelcfg.hxx"
-#include <svtools/pathoptions.hxx>
-#include "itemholder1.hxx"
-
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::io;
-using namespace com::sun::star::xml::sax;
-
-
-static SvtAcceleratorConfig_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-class SvtAcceleratorConfig_Impl
-{
-public:
-
- SvtAcceleratorItemList aList;
- bool bModified;
-
- SvtAcceleratorConfig_Impl()
- : bModified( FALSE )
- {}
-
- SvtAcceleratorConfig_Impl( Reference< XInputStream >& xInputStream );
- bool Commit( Reference< XOutputStream >& xOutputStream );
-};
-
-// -----------------------------------------------------------------------
-
-SvtAcceleratorConfig_Impl::SvtAcceleratorConfig_Impl( Reference< XInputStream >& rInputStream )
- : bModified( false )
-{
- Reference< XParser > xParser( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Parser" )),
- UNO_QUERY);
-
- // connect stream to input stream to the parser
- InputSource aInputSource;
- aInputSource.aInputStream = rInputStream;
-
- // get filter
- Reference< XDocumentHandler > xFilter( new OReadAccelatorDocumentHandler( aList ));
-
- // connect parser and filter
- xParser->setDocumentHandler( xFilter );
- xParser->parseStream( aInputSource );
-}
-
-bool SvtAcceleratorConfig_Impl::Commit( Reference< XOutputStream >& rOutputStream )
-{
- Reference< XDocumentHandler > xWriter;
-
- xWriter = Reference< XDocumentHandler >( ::comphelper::getProcessServiceFactory()->createInstance(
- ::rtl::OUString::createFromAscii( "com.sun.star.xml.sax.Writer" )), UNO_QUERY) ;
-
- Reference< ::com::sun::star::io::XActiveDataSource> xDataSource( xWriter , UNO_QUERY );
- xDataSource->setOutputStream( rOutputStream );
- try
- {
- OWriteAccelatorDocumentHandler aWriteHandler( aList, xWriter );
- aWriteHandler.WriteAcceleratorDocument();
- rOutputStream->flush();
- return true;
- }
- catch ( RuntimeException& )
- {
- }
- catch ( SAXException& )
- {
- }
- catch ( ::com::sun::star::io::IOException& )
- {
- }
-
- return false;
-}
-
-namespace
-{
- class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
- {
- };
-}
-
-SvtAcceleratorConfiguration::SvtAcceleratorConfiguration()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( LocalSingleton::get() );
- if ( !pOptions )
- {
- SvStream* pStream = GetDefaultStream( STREAM_STD_READ );
- ::utl::OInputStreamWrapper aHelper( *pStream );
- com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper );
-
- try
- {
- pOptions = new SvtAcceleratorConfig_Impl( xOut );
- }
- catch ( RuntimeException& )
- {
- pOptions = new SvtAcceleratorConfig_Impl();
- }
- catch( SAXException& )
- {
- pOptions = new SvtAcceleratorConfig_Impl();
- }
- catch( ::com::sun::star::io::IOException& )
- {
- pOptions = new SvtAcceleratorConfig_Impl();
- }
-
- if (pOptions)
- ItemHolder1::holdConfigItem(E_ACCELCFG);
-
- delete pStream;
- }
-
- ++nRefCount;
- pImp = pOptions;
-}
-
-SvtAcceleratorConfiguration* SvtAcceleratorConfiguration::CreateFromStream( SvStream& rStream )
-{
- SvtAcceleratorConfiguration* pRet = new SvtAcceleratorConfiguration;
- ::utl::OInputStreamWrapper aHelper( rStream );
- com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > xOut( &aHelper );
- try
- {
- pRet->pImp = new SvtAcceleratorConfig_Impl( xOut );
- }
- catch ( RuntimeException& )
- {
- DELETEZ( pRet );
- }
- catch( SAXException& )
- {
- DELETEZ( pRet );
- }
- catch( ::com::sun::star::io::IOException& )
- {
- DELETEZ( pRet );
- }
-
- return pRet;
-}
-
-// -----------------------------------------------------------------------
-
-SvtAcceleratorConfiguration::~SvtAcceleratorConfiguration()
-{
- if ( pImp == pOptions )
- {
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( LocalSingleton::get() );
- if ( !--nRefCount )
- {
- if ( pImp->bModified )
- {
- String aUserConfig = SvtPathOptions().GetUserConfigPath();
- INetURLObject aObj( aUserConfig );
- aObj.insertName( String::CreateFromAscii("GlobalKeyBindings.xml") );
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), STREAM_STD_READWRITE|STREAM_TRUNC );
- ::utl::OOutputStreamWrapper aHelper( *pStream );
- com::sun::star::uno::Reference < ::com::sun::star::io::XOutputStream > xOut( &aHelper );
- pImp->Commit( xOut );
- delete pStream;
- }
-
- DELETEZ( pOptions );
- }
- }
- else
- {
- delete pImp;
- }
-}
-
-::rtl::OUString SvtAcceleratorConfiguration::GetCommand( const ::com::sun::star::awt::KeyEvent& rKeyEvent )
-{
- sal_Int16 nCode=rKeyEvent.KeyCode, nModifier=rKeyEvent.Modifiers;
- if ( !nCode )
- nCode = rKeyEvent.KeyFunc;
-
- std::list< SvtAcceleratorConfigItem>::const_iterator p;
- for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ )
- if ( p->nCode == nCode && p->nModifier == nModifier )
- return p->aCommand;
-
- return ::rtl::OUString();
-}
-
-const SvtAcceleratorItemList& SvtAcceleratorConfiguration::GetItems()
-{
- return pImp->aList;
-}
-
-void SvtAcceleratorConfiguration::SetCommand( const SvtAcceleratorConfigItem& rItem )
-{
- std::list< SvtAcceleratorConfigItem>::iterator p;
- for ( p = pImp->aList.begin(); p != pImp->aList.end(); p++ )
- if ( p->nCode == rItem.nCode && p->nModifier == rItem.nModifier )
- {
- p->aCommand = rItem.aCommand;
- return;
- }
-
- pImp->aList.push_back( rItem );
-
-}
-
-void SvtAcceleratorConfiguration::SetItems( const SvtAcceleratorItemList& rItems, bool bClear )
-{
- if ( bClear )
- {
- pImp->aList = rItems;
- }
- else
- {
- std::list< SvtAcceleratorConfigItem>::const_iterator p;
- for ( p = rItems.begin(); p != rItems.end(); p++ )
- SetCommand( *p );
- }
-}
-
-String SvtAcceleratorConfiguration::GetStreamName()
-{
- return String::CreateFromAscii("KeyBindings.xml");
-}
-
-SvStream* SvtAcceleratorConfiguration::GetDefaultStream( StreamMode nMode )
-{
- String aUserConfig = SvtPathOptions().GetUserConfigPath();
- INetURLObject aObj( aUserConfig );
- aObj.insertName( GetStreamName() );
- return ::utl::UcbStreamHelper::CreateStream( aObj.GetMainURL( INetURLObject::NO_DECODE ), nMode );
-}
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx
index 6f1e3882d705..4077231c5c84 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
#include <svtools/accessibilityoptions.hxx>
#include "configitems/accessibilityoptions_const.hxx"
@@ -57,10 +52,10 @@
#include <unotools/processfactory.hxx>
#endif
#ifndef _SVT_LOGHELPER_HXX_
-#include <loghelper.hxx>
+#include <unotools/loghelper.hxx>
#endif
-#include <svtools/smplhint.hxx>
+#include <svl/smplhint.hxx>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -544,7 +539,7 @@ SvtAccessibilityOptions::~SvtAccessibilityOptions()
void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
{
- Broadcast( rHint );
+ NotifyListeners(0);
if ( rHint.IsA(TYPE(SfxSimpleHint)) )
{
if ( ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED )
diff --git a/svtools/source/config/addxmltostorageoptions.cxx b/svtools/source/config/addxmltostorageoptions.cxx
deleted file mode 100644
index 92e2369a2a70..000000000000
--- a/svtools/source/config/addxmltostorageoptions.cxx
+++ /dev/null
@@ -1,291 +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: addxmltostorageoptions.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/addxmltostorageoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl;
-using namespace ::rtl;
-using namespace ::osl;
-using namespace ::com::sun::star::uno;
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtAddXMLToStorageOptions_Impl* SvtAddXMLToStorageOptions::m_pDataContainer = 0;
-sal_Int32 SvtAddXMLToStorageOptions::m_nRefCount = 0;
-
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-class SvtAddXMLToStorageOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtAddXMLToStorageOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These method give us a chance to regulate acces to ouer internal values.
- It's not used in the moment - but it's possible for the feature!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_Bool IsWriter_Add_XML_to_Storage() const { return bAddXmlToStg_Writer; }
- sal_Bool IsCalc_Add_XML_to_Storage() const { return bAddXmlToStg_Calc; }
- sal_Bool IsImpress_Add_XML_to_Storage() const { return bAddXmlToStg_Impress; }
- sal_Bool IsDraw_Add_XML_to_Storage() const { return bAddXmlToStg_Draw; }
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management.
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- static Sequence< OUString > GetPropertyNames();
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- sal_Bool bAddXmlToStg_Writer,
- bAddXmlToStg_Calc,
- bAddXmlToStg_Impress,
- bAddXmlToStg_Draw;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtAddXMLToStorageOptions_Impl::SvtAddXMLToStorageOptions_Impl()
- // Init baseclasses first
- : ConfigItem( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM(
- "Office.Common/AddXMLToStorage"))),
- // Init member then.
- bAddXmlToStg_Writer( FALSE ),
- bAddXmlToStg_Calc( FALSE ),
- bAddXmlToStg_Impress( FALSE ),
- bAddXmlToStg_Draw( FALSE )
-{
- // Use our static list of configuration keys to get his values.
- Sequence< OUString > seqNames = GetPropertyNames();
- Sequence< Any > seqValues = GetProperties( seqNames );
-
- // Copy values from list in right order to ouer internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- const Any* pValue = seqValues.getConstArray();
- for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty, ++pValue )
- if( pValue->hasValue() )
-
- switch( nProperty )
- {
- case 0:
- *pValue >>= bAddXmlToStg_Writer;
- break;
- case 1:
- *pValue >>= bAddXmlToStg_Calc;
- break;
- case 2:
- *pValue >>= bAddXmlToStg_Impress;
- break;
- case 3:
- *pValue >>= bAddXmlToStg_Draw;
- break;
- }
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtAddXMLToStorageOptions_Impl::GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const sal_Char* pProperties[] =
- {
- "Writer",
- "Calc",
- "Impress",
- "Draw"
- };
-
- const sal_uInt16 nCnt = sizeof(pProperties) / sizeof( pProperties[0] );
- Sequence<OUString> aNames( nCnt );
- OUString* pNames = aNames.getArray();
- for( sal_uInt16 n = 0; n < nCnt; ++n )
- pNames[ n ] = OUString::createFromAscii( pProperties[ n ] );
- return aNames;
-}
-
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtAddXMLToStorageOptions::SvtAddXMLToStorageOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( !m_pDataContainer )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtAddXMLToStorageOptions_Impl::ctor()");
- m_pDataContainer = new SvtAddXMLToStorageOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_ADDXMLTOSTORAGEOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtAddXMLToStorageOptions::~SvtAddXMLToStorageOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( !--m_nRefCount )
- delete m_pDataContainer, m_pDataContainer = 0;
-}
-
-sal_Bool SvtAddXMLToStorageOptions::IsWriter_Add_XML_to_Storage() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsWriter_Add_XML_to_Storage();
-}
-sal_Bool SvtAddXMLToStorageOptions::IsCalc_Add_XML_to_Storage() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsCalc_Add_XML_to_Storage();
-}
-sal_Bool SvtAddXMLToStorageOptions::IsImpress_Add_XML_to_Storage() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsImpress_Add_XML_to_Storage();
-}
-sal_Bool SvtAddXMLToStorageOptions::IsDraw_Add_XML_to_Storage() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsDraw_Add_XML_to_Storage();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtAddXMLToStorageOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/apearcfg.cxx b/svtools/source/config/apearcfg.cxx
index 35a07a715dd5..0d4865ee563e 100644
--- a/svtools/source/config/apearcfg.cxx
+++ b/svtools/source/config/apearcfg.cxx
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
#include "apearcfg.hxx"
#include "com/sun/star/uno/Any.hxx"
@@ -176,6 +171,11 @@ void SvtTabAppearanceCfg::Commit()
}
PutProperties(rNames, aValues);
}
+
+void SvtTabAppearanceCfg::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
/*--------------------------------------------------------------------
Beschreibung:
--------------------------------------------------------------------*/
diff --git a/svtools/source/config/cacheoptions.cxx b/svtools/source/config/cacheoptions.cxx
deleted file mode 100644
index 39b2b2c74085..000000000000
--- a/svtools/source/config/cacheoptions.cxx
+++ /dev/null
@@ -1,510 +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: cacheoptions.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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include "cacheoptions.hxx"
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl;
-using namespace ::rtl;
-using namespace ::osl;
-using namespace ::com::sun::star::uno;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Cache" ))
-#define DEFAULT_WRITEROLE 20
-#define DEFAULT_DRAWINGOLE 20
-#define DEFAULT_GRFMGR_TOTALSIZE 10000000
-#define DEFAULT_GRFMGR_OBJECTSIZE 2400000
-#define DEFAULT_GRFMGR_OBJECTRELEASE 600
-
-#define PROPERTYNAME_WRITEROLE OUString(RTL_CONSTASCII_USTRINGPARAM("Writer/OLE_Objects"))
-#define PROPERTYNAME_DRAWINGOLE OUString(RTL_CONSTASCII_USTRINGPARAM("DrawingEngine/OLE_Objects"))
-#define PROPERTYNAME_GRFMGR_TOTALSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/TotalCacheSize"))
-#define PROPERTYNAME_GRFMGR_OBJECTSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectCacheSize"))
-#define PROPERTYNAME_GRFMGR_OBJECTRELEASE OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicManager/ObjectReleaseTime"))
-
-#define PROPERTYHANDLE_WRITEROLE 0
-#define PROPERTYHANDLE_DRAWINGOLE 1
-#define PROPERTYHANDLE_GRFMGR_TOTALSIZE 2
-#define PROPERTYHANDLE_GRFMGR_OBJECTSIZE 3
-#define PROPERTYHANDLE_GRFMGR_OBJECTRELEASE 4
-
-#define PROPERTYCOUNT 5
-
-class SvtCacheOptions_Impl : public ConfigItem
-{
-public:
-
-//---------------------------------------------------------------------------------------------------------
-// constructor / destructor
-//---------------------------------------------------------------------------------------------------------
-
- SvtCacheOptions_Impl();
- ~SvtCacheOptions_Impl();
-
-//---------------------------------------------------------------------------------------------------------
-// overloaded methods of baseclass
-//---------------------------------------------------------------------------------------------------------
-
- virtual void Commit();
-
-//---------------------------------------------------------------------------------------------------------
-// public interface
-//---------------------------------------------------------------------------------------------------------
-
- sal_Int32 GetWriterOLE_Objects() const;
- sal_Int32 GetDrawingEngineOLE_Objects() const;
- sal_Int32 GetGraphicManagerTotalCacheSize() const;
- sal_Int32 GetGraphicManagerObjectCacheSize() const;
- sal_Int32 GetGraphicManagerObjectReleaseTime() const;
-
- void SetWriterOLE_Objects( sal_Int32 nObjects );
- void SetDrawingEngineOLE_Objects( sal_Int32 nObjects );
- void SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize );
- void SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize );
- void SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds );
-
-//-------------------------------------------------------------------------------------------------------------
-// private methods
-//-------------------------------------------------------------------------------------------------------------
-
-private:
-
- static Sequence< OUString > impl_GetPropertyNames();
-
-//-------------------------------------------------------------------------------------------------------------
-// private member
-//-------------------------------------------------------------------------------------------------------------
-
-private:
-
- sal_Int32 mnWriterOLE;
- sal_Int32 mnDrawingOLE;
- sal_Int32 mnGrfMgrTotalSize;
- sal_Int32 mnGrfMgrObjectSize;
- sal_Int32 mnGrfMgrObjectRelease;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtCacheOptions_Impl::SvtCacheOptions_Impl() :
- ConfigItem( ROOTNODE_START ),
- mnWriterOLE( DEFAULT_WRITEROLE ),
- mnDrawingOLE( DEFAULT_DRAWINGOLE ),
- mnGrfMgrTotalSize( DEFAULT_GRFMGR_TOTALSIZE ),
- mnGrfMgrObjectSize( DEFAULT_GRFMGR_OBJECTSIZE ),
- mnGrfMgrObjectRelease( DEFAULT_GRFMGR_OBJECTRELEASE )
-{
- Sequence< OUString > seqNames( impl_GetPropertyNames() );
- Sequence< Any > seqValues = GetProperties( seqNames ) ;
-
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtCacheOptions_Impl::SvtCacheOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- sal_Int32 nProperty = 0;
-
- for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- if( seqValues[ nProperty ].hasValue() )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_WRITEROLE:
- {
- if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
- seqValues[nProperty] >>= mnWriterOLE;
- }
- break;
-
- case PROPERTYHANDLE_DRAWINGOLE:
- {
- if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
- seqValues[nProperty] >>= mnDrawingOLE;
- }
- break;
-
- case PROPERTYHANDLE_GRFMGR_TOTALSIZE:
- {
- if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
- seqValues[nProperty] >>= mnGrfMgrTotalSize;
- }
- break;
-
- case PROPERTYHANDLE_GRFMGR_OBJECTSIZE:
- {
- if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
- seqValues[nProperty] >>= mnGrfMgrObjectSize;
- }
- break;
-
- case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE:
- {
- if( seqValues[ nProperty ].getValueTypeClass() == TypeClass_LONG )
- seqValues[nProperty] >>= mnGrfMgrObjectRelease;
- }
- break;
- }
- }
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtCacheOptions_Impl::~SvtCacheOptions_Impl()
-{
- if( IsModified() )
- Commit();
-}
-
-//*****************************************************************************************************************
-// Commit
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::Commit()
-{
- Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
- Sequence< Any > aSeqValues( aSeqNames.getLength() );
-
- for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_WRITEROLE:
- aSeqValues[nProperty] <<= mnWriterOLE;
- break;
-
- case PROPERTYHANDLE_DRAWINGOLE:
- aSeqValues[nProperty] <<= mnDrawingOLE;
- break;
-
- case PROPERTYHANDLE_GRFMGR_TOTALSIZE:
- aSeqValues[nProperty] <<= mnGrfMgrTotalSize;
- break;
-
- case PROPERTYHANDLE_GRFMGR_OBJECTSIZE:
- aSeqValues[nProperty] <<= mnGrfMgrObjectSize;
- break;
-
- case PROPERTYHANDLE_GRFMGR_OBJECTRELEASE:
- aSeqValues[nProperty] <<= mnGrfMgrObjectRelease;
- break;
- }
- }
-
- PutProperties( aSeqNames, aSeqValues );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetWriterOLE_Objects() const
-{
- return mnWriterOLE;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetDrawingEngineOLE_Objects() const
-{
- return mnDrawingOLE;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerTotalCacheSize() const
-{
- return mnGrfMgrTotalSize;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectCacheSize() const
-{
- return mnGrfMgrObjectSize;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions_Impl::GetGraphicManagerObjectReleaseTime() const
-{
- return mnGrfMgrObjectRelease;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetWriterOLE_Objects( sal_Int32 nWriterOLE )
-{
- mnWriterOLE = nWriterOLE;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE )
-{
- mnDrawingOLE = nDrawingOLE;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize )
-{
- mnGrfMgrTotalSize = nGrfMgrTotalSize;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize )
-{
- mnGrfMgrObjectSize = nGrfMgrObjectSize;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions_Impl::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime )
-{
- mnGrfMgrObjectRelease = nGrfMgrObjectReleaseTime;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtCacheOptions_Impl::impl_GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_WRITEROLE,
- PROPERTYNAME_DRAWINGOLE,
- PROPERTYNAME_GRFMGR_TOTALSIZE,
- PROPERTYNAME_GRFMGR_OBJECTSIZE,
- PROPERTYNAME_GRFMGR_OBJECTRELEASE
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtCacheOptions_Impl* SvtCacheOptions::m_pDataContainer = NULL;
-sal_Int32 SvtCacheOptions::m_nRefCount = 0;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtCacheOptions::SvtCacheOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already!
- if( m_pDataContainer == NULL )
- {
- m_pDataContainer = new SvtCacheOptions_Impl();
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtCacheOptions::~SvtCacheOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetWriterOLE_Objects() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetWriterOLE_Objects();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetDrawingEngineOLE_Objects() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetDrawingEngineOLE_Objects();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetGraphicManagerTotalCacheSize() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetGraphicManagerTotalCacheSize();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetGraphicManagerObjectCacheSize() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetGraphicManagerObjectCacheSize();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtCacheOptions::GetGraphicManagerObjectReleaseTime() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetGraphicManagerObjectReleaseTime();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetWriterOLE_Objects( sal_Int32 nWriterOLE )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetWriterOLE_Objects( nWriterOLE );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetDrawingEngineOLE_Objects( sal_Int32 nDrawingOLE )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetDrawingEngineOLE_Objects( nDrawingOLE );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetGraphicManagerTotalCacheSize( sal_Int32 nGrfMgrTotalSize )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetGraphicManagerTotalCacheSize( nGrfMgrTotalSize );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetGraphicManagerObjectCacheSize( sal_Int32 nGrfMgrObjectSize )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetGraphicManagerObjectCacheSize( nGrfMgrObjectSize );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCacheOptions::SetGraphicManagerObjectReleaseTime( sal_Int32 nGrfMgrObjectReleaseTime )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetGraphicManagerObjectReleaseTime( nGrfMgrObjectReleaseTime );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtCacheOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/cjkoptions.cxx b/svtools/source/config/cjkoptions.cxx
deleted file mode 100644
index 66d70cd1e2a3..000000000000
--- a/svtools/source/config/cjkoptions.cxx
+++ /dev/null
@@ -1,510 +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: cjkoptions.cxx,v $
- * $Revision: 1.22 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include <svtools/cjkoptions.hxx>
-
-#include <svtools/languageoptions.hxx>
-#include <i18npool/lang.h>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.h>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
-
-#include <itemholder2.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::rtl;
-
-#define C2U(cChar) OUString::createFromAscii(cChar)
-#define CFG_READONLY_DEFAULT sal_False
-/* -----------------------------10.04.01 12:39--------------------------------
-
- ---------------------------------------------------------------------------*/
-class SvtCJKOptions_Impl : public utl::ConfigItem
-{
- sal_Bool bIsLoaded;
- sal_Bool bCJKFont;
- sal_Bool bVerticalText;
- sal_Bool bAsianTypography;
- sal_Bool bJapaneseFind;
- sal_Bool bRuby;
- sal_Bool bChangeCaseMap;
- sal_Bool bDoubleLines;
- sal_Bool bEmphasisMarks;
- sal_Bool bVerticalCallOut;
-
- sal_Bool bROCJKFont;
- sal_Bool bROVerticalText;
- sal_Bool bROAsianTypography;
- sal_Bool bROJapaneseFind;
- sal_Bool bRORuby;
- sal_Bool bROChangeCaseMap;
- sal_Bool bRODoubleLines;
- sal_Bool bROEmphasisMarks;
- sal_Bool bROVerticalCallOut;
-
-public:
- SvtCJKOptions_Impl();
- ~SvtCJKOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames );
- virtual void Commit();
- void Load();
-
- sal_Bool IsLoaded() { return bIsLoaded; }
-
- sal_Bool IsCJKFontEnabled() const { return bCJKFont; }
- sal_Bool IsVerticalTextEnabled() const { return bVerticalText; }
- sal_Bool IsAsianTypographyEnabled() const { return bAsianTypography; }
- sal_Bool IsJapaneseFindEnabled() const { return bJapaneseFind; }
- sal_Bool IsRubyEnabled() const { return bRuby; }
- sal_Bool IsChangeCaseMapEnabled() const { return bChangeCaseMap; }
- sal_Bool IsDoubleLinesEnabled() const { return bDoubleLines; }
- sal_Bool IsEmphasisMarksEnabled() const { return bEmphasisMarks; }
- sal_Bool IsVerticalCallOutEnabled() const { return bVerticalCallOut; }
-
- sal_Bool IsAnyEnabled() const {
- return bCJKFont||bVerticalText||bAsianTypography||bJapaneseFind||
- bRuby||bChangeCaseMap||bDoubleLines||bEmphasisMarks||bVerticalCallOut; }
- void SetAll(sal_Bool bSet);
- sal_Bool IsReadOnly(SvtCJKOptions::EOption eOption) const;
-};
-/*-- 10.04.01 12:41:57---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-namespace
-{
- struct PropertyNames
- : public rtl::Static< Sequence<OUString>, PropertyNames > {};
-}
-
-SvtCJKOptions_Impl::SvtCJKOptions_Impl() :
- utl::ConfigItem(C2U("Office.Common/I18N/CJK")),
- bIsLoaded(sal_False),
- bCJKFont(sal_True),
- bVerticalText(sal_True),
- bAsianTypography(sal_True),
- bJapaneseFind(sal_True),
- bRuby(sal_True),
- bChangeCaseMap(sal_True),
- bDoubleLines(sal_True),
- bEmphasisMarks(sal_True),
- bVerticalCallOut(sal_True),
- bROCJKFont(CFG_READONLY_DEFAULT),
- bROVerticalText(CFG_READONLY_DEFAULT),
- bROAsianTypography(CFG_READONLY_DEFAULT),
- bROJapaneseFind(CFG_READONLY_DEFAULT),
- bRORuby(CFG_READONLY_DEFAULT),
- bROChangeCaseMap(CFG_READONLY_DEFAULT),
- bRODoubleLines(CFG_READONLY_DEFAULT),
- bROEmphasisMarks(CFG_READONLY_DEFAULT),
- bROVerticalCallOut(CFG_READONLY_DEFAULT)
-{
-}
-/*-- 10.04.01 12:41:57---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SvtCJKOptions_Impl::~SvtCJKOptions_Impl()
-{
-}
-/* -----------------------------20.04.01 14:34--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SvtCJKOptions_Impl::SetAll(sal_Bool bSet)
-{
- if (
- !bROCJKFont &&
- !bROVerticalText &&
- !bROAsianTypography &&
- !bROJapaneseFind &&
- !bRORuby &&
- !bROChangeCaseMap &&
- !bRODoubleLines &&
- !bROEmphasisMarks &&
- !bROVerticalCallOut
- )
- {
- bCJKFont=bSet;
- bVerticalText=bSet;
- bAsianTypography=bSet;
- bJapaneseFind=bSet;
- bRuby=bSet;
- bChangeCaseMap=bSet;
- bDoubleLines=bSet;
- bEmphasisMarks=bSet;
- bVerticalCallOut=bSet;
-
- SetModified();
- Commit();
- }
-}
-/*-- 10.04.01 12:41:56---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtCJKOptions_Impl::Load()
-{
- Sequence<OUString> &rPropertyNames = PropertyNames::get();
- if(!rPropertyNames.getLength())
- {
- rPropertyNames.realloc(9);
- OUString* pNames = rPropertyNames.getArray();
-
- pNames[0] = C2U("CJKFont");
- pNames[1] = C2U("VerticalText");
- pNames[2] = C2U("AsianTypography");
- pNames[3] = C2U("JapaneseFind");
- pNames[4] = C2U("Ruby");
- pNames[5] = C2U("ChangeCaseMap");
- pNames[6] = C2U("DoubleLines");
- pNames[7] = C2U("EmphasisMarks");
- pNames[8] = C2U("VerticalCallOut");
-
- EnableNotification( rPropertyNames );
- }
- Sequence< Any > aValues = GetProperties(rPropertyNames);
- Sequence< sal_Bool > aROStates = GetReadOnlyStates(rPropertyNames);
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" );
- DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" );
- if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() )
- {
- for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ )
- {
- if( pValues[nProp].hasValue() )
- {
- sal_Bool bValue = *(sal_Bool*)pValues[nProp].getValue();
- switch ( nProp )
- {
- case 0: { bCJKFont = bValue; bROCJKFont = pROStates[nProp]; } break;
- case 1: { bVerticalText = bValue; bROVerticalText = pROStates[nProp]; } break;
- case 2: { bAsianTypography = bValue; bROAsianTypography = pROStates[nProp]; } break;
- case 3: { bJapaneseFind = bValue; bROJapaneseFind = pROStates[nProp]; } break;
- case 4: { bRuby = bValue; bRORuby = pROStates[nProp]; } break;
- case 5: { bChangeCaseMap = bValue; bROChangeCaseMap = pROStates[nProp]; } break;
- case 6: { bDoubleLines = bValue; bRODoubleLines = pROStates[nProp]; } break;
- case 7: { bEmphasisMarks = bValue; bROEmphasisMarks = pROStates[nProp]; } break;
- case 8: { bVerticalCallOut = bValue; bROVerticalCallOut = pROStates[nProp]; } break;
- }
- }
- }
- }
-
- SvtSystemLanguageOptions aSystemLocaleSettings;
- LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage();
- sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
-
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
- if ( !bCJKFont && (( nScriptType & SCRIPTTYPE_ASIAN )||
- ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_ASIAN ))))
- {
- SetAll(sal_True);
- }
- bIsLoaded = sal_True;
-}
-/*-- 10.04.01 12:41:57---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtCJKOptions_Impl::Notify( const Sequence< OUString >& )
-{
- Load();
-}
-/*-- 10.04.01 12:41:57---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtCJKOptions_Impl::Commit()
-{
- Sequence<OUString> &rPropertyNames = PropertyNames::get();
- OUString* pOrgNames = rPropertyNames.getArray();
- sal_Int32 nOrgCount = rPropertyNames.getLength();
-
- Sequence< OUString > aNames(nOrgCount);
- Sequence< Any > aValues(nOrgCount);
-
- OUString* pNames = aNames.getArray();
- Any* pValues = aValues.getArray();
- sal_Int32 nRealCount = 0;
-
- const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < nOrgCount; nProp++)
- {
- switch(nProp)
- {
- case 0:
- {
- if (!bROCJKFont)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bCJKFont, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 1:
- {
- if (!bROVerticalText)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bVerticalText, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 2:
- {
- if (!bROAsianTypography)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bAsianTypography, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 3:
- {
- if (!bROJapaneseFind)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bJapaneseFind, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 4:
- {
- if (!bRORuby)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bRuby, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 5:
- {
- if (!bROChangeCaseMap)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bChangeCaseMap, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 6:
- {
- if (!bRODoubleLines)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bDoubleLines, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 7:
- {
- if (!bROEmphasisMarks)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bEmphasisMarks, rType);
- ++nRealCount;
- }
- }
- break;
-
- case 8:
- {
- if (!bROVerticalCallOut)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue(&bVerticalCallOut, rType);
- ++nRealCount;
- }
- }
- break;
- }
- }
- aNames.realloc(nRealCount);
- aValues.realloc(nRealCount);
- PutProperties(aNames, aValues);
-}
-/*-- 13.02.2003 12:12---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtCJKOptions_Impl::IsReadOnly(SvtCJKOptions::EOption eOption) const
-{
- sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
- switch(eOption)
- {
- case SvtCJKOptions::E_CJKFONT : bReadOnly = bROCJKFont; break;
- case SvtCJKOptions::E_VERTICALTEXT : bReadOnly = bROVerticalText; break;
- case SvtCJKOptions::E_ASIANTYPOGRAPHY : bReadOnly = bROAsianTypography; break;
- case SvtCJKOptions::E_JAPANESEFIND : bReadOnly = bROJapaneseFind; break;
- case SvtCJKOptions::E_RUBY : bReadOnly = bRORuby; break;
- case SvtCJKOptions::E_CHANGECASEMAP : bReadOnly = bROChangeCaseMap; break;
- case SvtCJKOptions::E_DOUBLELINES : bReadOnly = bRODoubleLines; break;
- case SvtCJKOptions::E_EMPHASISMARKS : bReadOnly = bROEmphasisMarks; break;
- case SvtCJKOptions::E_VERTICALCALLOUT : bReadOnly = bROVerticalCallOut; break;
- case SvtCJKOptions::E_ALL : if (bROCJKFont || bROVerticalText || bROAsianTypography || bROJapaneseFind || bRORuby || bROChangeCaseMap || bRODoubleLines || bROEmphasisMarks || bROVerticalCallOut)
- bReadOnly = sal_True;
- break;
- }
- return bReadOnly;
-}
-
-// global ----------------------------------------------------------------
-
-static SvtCJKOptions_Impl* pCJKOptions = NULL;
-static sal_Int32 nCJKRefCount = 0;
-namespace { struct CJKMutex : public rtl::Static< ::osl::Mutex , CJKMutex >{}; }
-
-
-// class SvtCJKOptions --------------------------------------------------
-
-SvtCJKOptions::SvtCJKOptions(sal_Bool bDontLoad)
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( CJKMutex::get() );
- if ( !pCJKOptions )
- {
- pCJKOptions = new SvtCJKOptions_Impl;
- ItemHolder2::holdConfigItem(E_CJKOPTIONS);
- }
- if( !bDontLoad && !pCJKOptions->IsLoaded())
- pCJKOptions->Load();
-
- ++nCJKRefCount;
- pImp = pCJKOptions;
-}
-
-// -----------------------------------------------------------------------
-
-SvtCJKOptions::~SvtCJKOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( CJKMutex::get() );
- if ( !--nCJKRefCount )
- DELETEZ( pCJKOptions );
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsCJKFontEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsCJKFontEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsVerticalTextEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsVerticalTextEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsAsianTypographyEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsAsianTypographyEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsJapaneseFindEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsJapaneseFindEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsRubyEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsRubyEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsChangeCaseMapEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsChangeCaseMapEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsDoubleLinesEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsDoubleLinesEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsEmphasisMarksEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsEmphasisMarksEnabled();
-}
-// -----------------------------------------------------------------------
-sal_Bool SvtCJKOptions::IsVerticalCallOutEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsVerticalCallOutEnabled();
-}
-/*-- 20.04.01 14:32:04---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtCJKOptions::SetAll(sal_Bool bSet)
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- pCJKOptions->SetAll(bSet);
-}
-/*-- 20.04.01 14:32:06---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtCJKOptions::IsAnyEnabled() const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsAnyEnabled();
-}
-/*-- 13.02.2003 12:11---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtCJKOptions::IsReadOnly(EOption eOption) const
-{
- DBG_ASSERT(pCJKOptions->IsLoaded(), "CJK options not loaded");
- return pCJKOptions->IsReadOnly(eOption);
-}
-
diff --git a/svtools/source/config/cmdoptions.cxx b/svtools/source/config/cmdoptions.cxx
deleted file mode 100644
index 356b6782b892..000000000000
--- a/svtools/source/config/cmdoptions.cxx
+++ /dev/null
@@ -1,631 +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: cmdoptions.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/cmdoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <cppuhelper/weakref.hxx>
-#include <tools/urlobj.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <itemholder1.hxx>
-
-#include <algorithm>
-#include <hash_map>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::std ;
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::beans ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_CMDOPTIONS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Commands/Execute" ))
-#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" ))
-
-#define SETNODE_DISABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Disabled" ))
-
-#define PROPERTYNAME_CMD OUString(RTL_CONSTASCII_USTRINGPARAM("Command" ))
-
-#define PROPERTYCOUNT 1
-
-#define OFFSET_CMD 0
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-// Method to retrieve a hash code from a string. May be we have to change it to decrease collisions in the hash map
-struct OUStringHashCode
-{
- size_t operator()( const ::rtl::OUString& sString ) const
- {
- return sString.hashCode();
- }
-};
-
-/*-****************************************************************************************************************
- @descr support simple command option structures and operations on it
-****************************************************************************************************************-*/
-class SvtCmdOptions
-{
- public:
- //---------------------------------------------------------------------------------------------------------
- // the only way to free memory!
- void Clear()
- {
- m_aCommandHashMap.clear();
- }
-
- sal_Bool HasEntries() const
- {
- return ( m_aCommandHashMap.size() > 0 );
- }
-
- void SetContainerSize( sal_Int32 nSize )
- {
- m_aCommandHashMap.resize( nSize );
- }
-
- sal_Bool Lookup( const OUString& aCmd ) const
- {
- CommandHashMap::const_iterator pEntry = m_aCommandHashMap.find( aCmd );
- return ( pEntry != m_aCommandHashMap.end() );
- }
-
- void AddCommand( const OUString& aCmd )
- {
- m_aCommandHashMap.insert( CommandHashMap::value_type( aCmd, 0 ) );
- }
-
- //---------------------------------------------------------------------------------------------------------
- // convert internal list to external format
- // for using it on right menus realy
- // Notice: We build a property list with 4 entries and set it on result list then.
- // The while-loop starts with pointer on internal member list lSetupEntries, change to
- // lUserEntries then and stop after that with NULL!
- // Separator entries will be packed in another way then normal entries! We define
- // special strings "sEmpty" and "sSeperator" to perform too ...
- Sequence< OUString > GetList() const
- {
- sal_Int32 nCount = (sal_Int32)m_aCommandHashMap.size();
- sal_Int32 nIndex = 0;
- Sequence< OUString > aList( nCount );
-
- CommandHashMap::const_iterator pEntry = m_aCommandHashMap.begin();
- while ( pEntry != m_aCommandHashMap.end() )
- aList[nIndex++] = pEntry->first;
-
- return aList;
- }
-
- private:
- class CommandHashMap : public ::std::hash_map< ::rtl::OUString ,
- sal_Int32 ,
- OUStringHashCode ,
- ::std::equal_to< ::rtl::OUString > >
- {
- public:
- inline void free()
- {
- CommandHashMap().swap( *this );
- }
- };
-
- CommandHashMap m_aCommandHashMap;
-};
-
-typedef ::std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > > SvtFrameVector;
-
-class SvtCommandOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtCommandOptions_Impl();
- ~SvtCommandOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "lPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& lPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short base implementation of public interface for "SvtDynamicMenuOptions"!
- @descr These class is used as static member of "SvtDynamicMenuOptions" ...
- => The code exist only for one time and isn't duplicated for every instance!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- void Clear ( SvtCommandOptions::CmdOption eCmdOption );
- sal_Bool HasEntries ( SvtCommandOptions::CmdOption eOption ) const;
- sal_Bool Lookup ( SvtCommandOptions::CmdOption eCmdOption, const OUString& ) const;
- Sequence< OUString > GetList ( SvtCommandOptions::CmdOption eCmdOption ) const ;
- void AddCommand ( SvtCommandOptions::CmdOption eCmdOption,
- const OUString& sURL );
- void EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame);
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of our configuration management which represent oue module tree
- @descr These methods return the current list of key names! We need it to get needed values from our
- configuration management and support dynamical menu item lists!
-
- @seealso -
-
- @param "nDisabledCount" , returns count of menu entries for "new"
- @return A list of configuration key names is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< OUString > impl_GetPropertyNames();
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
- SvtCmdOptions m_aDisabledCommands;
- SvtFrameVector m_lFrames;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtCommandOptions_Impl::SvtCommandOptions_Impl()
- // Init baseclasses first
- : ConfigItem( ROOTNODE_CMDOPTIONS )
- // Init member then...
-{
- // Get names and values of all accessable menu entries and fill internal structures.
- // See impl_GetPropertyNames() for further informations.
- Sequence< OUString > lNames = impl_GetPropertyNames ();
- Sequence< Any > lValues = GetProperties ( lNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- // Attention: List for names and values have an internal construction pattern!
- sal_Int32 nItem = 0 ;
- OUString sCmd ;
-
- // Set size of hash_map reach a used size of approx. 60%
- m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 );
-
- // Get names/values for disabled commands.
- for( nItem=0; nItem < lNames.getLength(); ++nItem )
- {
- // Currently only one value
- lValues[nItem] >>= sCmd;
- m_aDisabledCommands.AddCommand( sCmd );
- }
-
-/*TODO: Not used in the moment! see Notify() ...
- // Enable notification mechanism of ouer baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys! */
- Sequence< OUString > aNotifySeq( 1 );
- aNotifySeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Disabled" ));
- EnableNotification( aNotifySeq, sal_True );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtCommandOptions_Impl::~SvtCommandOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions_Impl::Notify( const Sequence< OUString >& )
-{
- MutexGuard aGuard( SvtCommandOptions::GetOwnStaticMutex() );
-
- Sequence< OUString > lNames = impl_GetPropertyNames ();
- Sequence< Any > lValues = GetProperties ( lNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtCommandOptions_Impl::SvtCommandOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- // Attention: List for names and values have an internal construction pattern!
- sal_Int32 nItem = 0 ;
- OUString sCmd ;
-
- // Set size of hash_map reach a used size of approx. 60%
- m_aDisabledCommands.Clear();
- m_aDisabledCommands.SetContainerSize( lNames.getLength() * 10 / 6 );
-
- // Get names/values for disabled commands.
- for( nItem=0; nItem < lNames.getLength(); ++nItem )
- {
- // Currently only one value
- lValues[nItem] >>= sCmd;
- m_aDisabledCommands.AddCommand( sCmd );
- }
-
- // dont forget to update all existing frames and her might cached dispatch objects!
- // But look for already killed frames. We hold weak references instead of hard ones ...
- for (SvtFrameVector::const_iterator pIt = m_lFrames.begin();
- pIt != m_lFrames.end() ;
- ++pIt )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame(pIt->get(), ::com::sun::star::uno::UNO_QUERY);
- if (xFrame.is())
- xFrame->contextChanged();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions_Impl::Commit()
-{
- DBG_ERROR( "SvtCommandOptions_Impl::Commit()\nNot implemented yet!\n" );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions_Impl::Clear( SvtCommandOptions::CmdOption eCmdOption )
-{
- switch( eCmdOption )
- {
- case SvtCommandOptions::CMDOPTION_DISABLED:
- {
- m_aDisabledCommands.Clear();
- SetModified();
- }
- break;
-
- default:
- DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::Clear()\nUnknown option type given!\n" );
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtCommandOptions_Impl::HasEntries( SvtCommandOptions::CmdOption eOption ) const
-{
- if ( eOption == SvtCommandOptions::CMDOPTION_DISABLED )
- return ( m_aDisabledCommands.HasEntries() > 0 );
- else
- return sal_False;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< OUString > SvtCommandOptions_Impl::GetList( SvtCommandOptions::CmdOption eCmdOption ) const
-{
- Sequence< OUString > lReturn;
-
- switch( eCmdOption )
- {
- case SvtCommandOptions::CMDOPTION_DISABLED:
- {
- lReturn = m_aDisabledCommands.GetList();
- }
- break;
-
- default:
- DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" );
- }
-
- return lReturn;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtCommandOptions_Impl::Lookup( SvtCommandOptions::CmdOption eCmdOption, const OUString& aCommand ) const
-{
- switch( eCmdOption )
- {
- case SvtCommandOptions::CMDOPTION_DISABLED:
- {
- return m_aDisabledCommands.Lookup( aCommand );
- }
- default:
- DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" );
- }
-
- return sal_False;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions_Impl::AddCommand( SvtCommandOptions::CmdOption eCmdOption, const OUString& sCmd )
-{
- switch( eCmdOption )
- {
- case SvtCommandOptions::CMDOPTION_DISABLED:
- {
- m_aDisabledCommands.AddCommand( sCmd );
- SetModified();
- }
- break;
-
- default:
- DBG_ASSERT( sal_False, "SvtCommandOptions_Impl::GetList()\nUnknown option type given!\n" );
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions_Impl::EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
-{
- // check if frame already exists inside list
- // ignore double registrations
- // every frame must be notified one times only!
- ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xWeak(xFrame);
- SvtFrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak);
- if (pIt == m_lFrames.end())
- m_lFrames.push_back(xWeak);
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtCommandOptions_Impl::impl_GetPropertyNames()
-{
- // First get ALL names of current existing list items in configuration!
- Sequence< OUString > lDisabledItems = GetNodeNames( SETNODE_DISABLED, utl::CONFIG_NAME_LOCAL_PATH );
-
- OUString aSetNode( SETNODE_DISABLED );
- aSetNode += PATHDELIMITER;
-
- OUString aCommandKey( PATHDELIMITER );
- aCommandKey += PROPERTYNAME_CMD;
-
- // Expand all keys
- for (sal_Int32 i=0; i<lDisabledItems.getLength(); ++i )
- {
- OUStringBuffer aBuffer( 32 );
- aBuffer.append( aSetNode );
- aBuffer.append( lDisabledItems[i] );
- aBuffer.append( aCommandKey );
- lDisabledItems[i] = aBuffer.makeStringAndClear();
- }
-
- // Return result.
- return lDisabledItems;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtCommandOptions_Impl* SvtCommandOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtCommandOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtCommandOptions::SvtCommandOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- m_pDataContainer = new SvtCommandOptions_Impl;
- ItemHolder1::holdConfigItem(E_CMDOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtCommandOptions::~SvtCommandOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions::Clear( CmdOption eCmdOption )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->Clear( eCmdOption );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtCommandOptions::HasEntries( CmdOption eOption ) const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->HasEntries( eOption );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtCommandOptions::Lookup( CmdOption eCmdOption, const OUString& aCommandURL ) const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->Lookup( eCmdOption, aCommandURL );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< OUString > SvtCommandOptions::GetList( CmdOption eCmdOption ) const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetList( eCmdOption );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions::AddCommand( CmdOption eCmdOption, const OUString& sURL )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->AddCommand( eCmdOption, sURL );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCommandOptions::EstablisFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->EstablisFrameCallback(xFrame);
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtCommandOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index 0c39fde11390..9008d7a27ee1 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
#include <svtools/colorcfg.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -46,8 +41,8 @@
#include <unotools/configitem.hxx>
#include <unotools/configpathes.hxx>
#include <com/sun/star/uno/Sequence.h>
-#include <svtools/poolitem.hxx> //Any2Bool
-#include <svtools/smplhint.hxx>
+#include <svl/poolitem.hxx> //Any2Bool
+#include <svl/smplhint.hxx>
#include <vos/mutex.hxx>
#include <itemholder2.hxx>
@@ -81,15 +76,12 @@ ColorConfig_Impl* ColorConfig::m_pImpl = NULL;
/* -----------------------------16.01.01 15:36--------------------------------
---------------------------------------------------------------------------*/
-class ColorConfig_Impl : public utl::ConfigItem, public SfxBroadcaster
+class ColorConfig_Impl : public utl::ConfigItem
{
ColorConfigValue m_aConfigValues[ColorConfigEntryCount];
sal_Bool m_bEditMode;
rtl::OUString m_sIsVisible;
rtl::OUString m_sLoadedScheme;
- sal_Bool m_bIsBroadcastEnabled;
- static sal_Bool m_bLockBroadcast;
- static sal_Bool m_bBroadcastWhenUnlocked;
uno::Sequence< ::rtl::OUString> GetPropertyNames(const rtl::OUString& rScheme);
public:
@@ -118,13 +110,6 @@ public:
void ClearModified(){ConfigItem::ClearModified();}
void SettingsChanged();
- static void DisableBroadcast();
- static void EnableBroadcast();
- static sal_Bool IsEnableBroadcast();
-
- static void LockBroadcast();
- static void UnlockBroadcast();
-
// #100822#
DECL_LINK( DataChangedEventListener, VclWindowEvent* );
@@ -219,13 +204,10 @@ uno::Sequence< OUString> ColorConfig_Impl::GetPropertyNames(const rtl::OUString&
/* -----------------------------22.03.2002 14:37------------------------------
---------------------------------------------------------------------------*/
-sal_Bool ColorConfig_Impl::m_bLockBroadcast = sal_False;
-sal_Bool ColorConfig_Impl::m_bBroadcastWhenUnlocked = sal_False;
ColorConfig_Impl::ColorConfig_Impl(sal_Bool bEditMode) :
ConfigItem(C2U("Office.UI/ColorScheme")),
m_bEditMode(bEditMode),
- m_sIsVisible(C2U("/IsVisible")),
- m_bIsBroadcastEnabled(sal_True)
+ m_sIsVisible(C2U("/IsVisible"))
{
if(!m_bEditMode)
{
@@ -249,23 +231,6 @@ ColorConfig_Impl::~ColorConfig_Impl()
// #100822#
::Application::RemoveEventListener( LINK(this, ColorConfig_Impl, DataChangedEventListener) );
}
-// -----------------------------------------------------------------------------
-void ColorConfig_Impl::DisableBroadcast()
-{
- if ( ColorConfig::m_pImpl )
- ColorConfig::m_pImpl->m_bIsBroadcastEnabled = sal_False;
-}
-// -----------------------------------------------------------------------------
-void ColorConfig_Impl::EnableBroadcast()
-{
- if ( ColorConfig::m_pImpl )
- ColorConfig::m_pImpl->m_bIsBroadcastEnabled = sal_True;
-}
-// -----------------------------------------------------------------------------
-sal_Bool ColorConfig_Impl::IsEnableBroadcast()
-{
- return ColorConfig::m_pImpl ? ColorConfig::m_pImpl->m_bIsBroadcastEnabled : sal_False;
-}
/* -----------------------------22.03.2002 14:38------------------------------
---------------------------------------------------------------------------*/
@@ -308,16 +273,7 @@ void ColorConfig_Impl::Notify( const uno::Sequence<OUString>& )
{
//loading via notification always uses the default setting
Load(::rtl::OUString());
-
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
-
- if(m_bLockBroadcast)
- {
- m_bBroadcastWhenUnlocked = sal_True;
- ImplUpdateApplicationSettings();
- }
- else
- Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED));
+ NotifyListeners(0);
}
/* -----------------------------22.03.2002 14:38------------------------------
@@ -414,34 +370,7 @@ void ColorConfig_Impl::SettingsChanged()
ImplUpdateApplicationSettings();
- Broadcast( SfxSimpleHint( SFX_HINT_COLORS_CHANGED ) );
-}
-/* -----------------11.12.2002 09:21-----------------
- *
- * --------------------------------------------------*/
-void ColorConfig_Impl::LockBroadcast()
-{
- m_bLockBroadcast = sal_True;
-}
-/* -----------------11.12.2002 09:21-----------------
- *
- * --------------------------------------------------*/
-void ColorConfig_Impl::UnlockBroadcast()
-{
- if ( m_bBroadcastWhenUnlocked )
- {
- m_bBroadcastWhenUnlocked = ColorConfig::m_pImpl != NULL;
- if ( m_bBroadcastWhenUnlocked )
- {
- ColorConfig::m_pImpl->ImplUpdateApplicationSettings();
- if ( ColorConfig::m_pImpl->IsEnableBroadcast() )
- {
- m_bBroadcastWhenUnlocked = sal_False;
- ColorConfig::m_pImpl->Broadcast(SfxSimpleHint(SFX_HINT_COLORS_CHANGED));
- }
- }
- }
- m_bLockBroadcast = sal_False;
+ NotifyListeners(0);
}
/* -----------------------------2002/08/16 12:07 -----------------------------
#100822#
@@ -500,7 +429,7 @@ ColorConfig::ColorConfig()
ItemHolder2::holdConfigItem(E_COLORCFG);
}
++nColorRefCount_Impl;
- StartListening( *m_pImpl);
+ m_pImpl->AddListener(this);
}
/* -----------------------------16.01.01 15:36--------------------------------
@@ -508,7 +437,7 @@ ColorConfig::ColorConfig()
ColorConfig::~ColorConfig()
{
::osl::MutexGuard aGuard( ColorMutex_Impl::get() );
- EndListening( *m_pImpl);
+ m_pImpl->RemoveListener(this);
if(!--nColorRefCount_Impl)
{
delete m_pImpl;
@@ -636,15 +565,6 @@ ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, sal_Bool bS
return aRet;
}
-/* -----------------------------12.04.2002 09:25------------------------------
-
- ---------------------------------------------------------------------------*/
-void ColorConfig::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
-
- Broadcast( rHint );
-}
/* -----------------------------25.03.2002 12:01------------------------------
---------------------------------------------------------------------------*/
@@ -652,14 +572,14 @@ EditableColorConfig::EditableColorConfig() :
m_pImpl(new ColorConfig_Impl),
m_bModified(sal_False)
{
- m_pImpl->LockBroadcast();
+ m_pImpl->BlockBroadcasts(TRUE);
}
/*-- 25.03.2002 12:03:08---------------------------------------------------
-----------------------------------------------------------------------*/
EditableColorConfig::~EditableColorConfig()
{
- m_pImpl->UnlockBroadcast();
+ m_pImpl->BlockBroadcasts(FALSE);
if(m_bModified)
m_pImpl->SetModified();
if(m_pImpl->IsModified())
@@ -757,12 +677,12 @@ void EditableColorConfig::Commit()
// -----------------------------------------------------------------------------
void EditableColorConfig::DisableBroadcast()
{
- m_pImpl->DisableBroadcast();
+ m_pImpl->BlockBroadcasts(TRUE);
}
// -----------------------------------------------------------------------------
void EditableColorConfig::EnableBroadcast()
{
- m_pImpl->EnableBroadcast();
+ m_pImpl->BlockBroadcasts(FALSE);
}
// -----------------------------------------------------------------------------
diff --git a/svtools/source/config/compatibility.cxx b/svtools/source/config/compatibility.cxx
deleted file mode 100644
index a55aff0c90f8..000000000000
--- a/svtools/source/config/compatibility.cxx
+++ /dev/null
@@ -1,807 +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: compatibility.cxx,v $
- * $Revision: 1.16 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/compatibility.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#ifndef __SGI_STL_VECTOR
-#include <vector>
-#endif
-
-#include <itemholder1.hxx>
-
-#include <algorithm>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::std;
-using namespace ::utl;
-using namespace ::rtl;
-using namespace ::osl;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_OPTIONS OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.Compatibility/" ) )
-#define PATHDELIMITER OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) )
-#define SETNODE_ALLFILEFORMATS OUString( RTL_CONSTASCII_USTRINGPARAM( "AllFileFormats" ) )
-
-#define PROPERTYNAME_NAME COMPATIBILITY_PROPERTYNAME_NAME
-#define PROPERTYNAME_MODULE COMPATIBILITY_PROPERTYNAME_MODULE
-#define PROPERTYNAME_USEPRTMETRICS COMPATIBILITY_PROPERTYNAME_USEPRTMETRICS
-#define PROPERTYNAME_ADDSPACING COMPATIBILITY_PROPERTYNAME_ADDSPACING
-#define PROPERTYNAME_ADDSPACINGATPAGES COMPATIBILITY_PROPERTYNAME_ADDSPACINGATPAGES
-#define PROPERTYNAME_USEOURTABSTOPS COMPATIBILITY_PROPERTYNAME_USEOURTABSTOPS
-#define PROPERTYNAME_NOEXTLEADING COMPATIBILITY_PROPERTYNAME_NOEXTLEADING
-#define PROPERTYNAME_USELINESPACING COMPATIBILITY_PROPERTYNAME_USELINESPACING
-#define PROPERTYNAME_ADDTABLESPACING COMPATIBILITY_PROPERTYNAME_ADDTABLESPACING
-#define PROPERTYNAME_USEOBJPOS COMPATIBILITY_PROPERTYNAME_USEOBJECTPOSITIONING
-#define PROPERTYNAME_USEOURTEXTWRAP COMPATIBILITY_PROPERTYNAME_USEOURTEXTWRAPPING
-#define PROPERTYNAME_CONSIDERWRAPSTYLE COMPATIBILITY_PROPERTYNAME_CONSIDERWRAPPINGSTYLE
-#define PROPERTYNAME_EXPANDWORDSPACE COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE
-
-#define PROPERTYCOUNT 13
-
-#define OFFSET_NAME 0
-#define OFFSET_MODULE 1
-#define OFFSET_USEPRTMETRICS 2
-#define OFFSET_ADDSPACING 3
-#define OFFSET_ADDSPACINGATPAGES 4
-#define OFFSET_USEOURTABSTOPS 5
-#define OFFSET_NOEXTLEADING 6
-#define OFFSET_USELINESPACING 7
-#define OFFSET_ADDTABLESPACING 8
-#define OFFSET_USEOBJPOS 9
-#define OFFSET_USEOURTEXTWRAPPING 10
-#define OFFSET_CONSIDERWRAPPINGSTYLE 11
-#define OFFSET_EXPANDWORDSPACE 12
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-/*-****************************************************************************************************************
- @descr struct to hold information about one compatibility entry
-****************************************************************************************************************-*/
-struct SvtCompatibilityEntry
-{
- public:
- SvtCompatibilityEntry() :
- bUsePrtMetrics( false ), bAddSpacing( false ),
- bAddSpacingAtPages( false ), bUseOurTabStops( false ),
- bNoExtLeading( false ), bUseLineSpacing( false ),
- bAddTableSpacing( false ), bUseObjPos( false ),
- bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ),
- bExpandWordSpace( true ) {}
- SvtCompatibilityEntry(
- const OUString& _rName, const OUString& _rNewModule ) :
- sName( _rName ), sModule( _rNewModule ),
- bUsePrtMetrics( false ), bAddSpacing( false ),
- bAddSpacingAtPages( false ), bUseOurTabStops( false ),
- bNoExtLeading( false ), bUseLineSpacing( false ),
- bAddTableSpacing( false ), bUseObjPos( false ),
- bUseOurTextWrapping( false ), bConsiderWrappingStyle( false ),
- bExpandWordSpace( true ) {}
-
- inline void SetUsePrtMetrics( bool _bSet ) { bUsePrtMetrics = _bSet; }
- inline void SetAddSpacing( bool _bSet ) { bAddSpacing = _bSet; }
- inline void SetAddSpacingAtPages( bool _bSet ) { bAddSpacingAtPages = _bSet; }
- inline void SetUseOurTabStops( bool _bSet ) { bUseOurTabStops = _bSet; }
- inline void SetNoExtLeading( bool _bSet ) { bNoExtLeading = _bSet; }
- inline void SetUseLineSpacing( bool _bSet ) { bUseLineSpacing = _bSet; }
- inline void SetAddTableSpacing( bool _bSet ) { bAddTableSpacing = _bSet; }
- inline void SetUseObjPos( bool _bSet ) { bUseObjPos = _bSet; }
- inline void SetUseOurTextWrapping( bool _bSet ) { bUseOurTextWrapping = _bSet; }
- inline void SetConsiderWrappingStyle( bool _bSet ) { bConsiderWrappingStyle = _bSet; }
- inline void SetExpandWordSpace( bool _bSet ) { bExpandWordSpace = _bSet; }
-
- public:
- OUString sName;
- OUString sModule;
- bool bUsePrtMetrics;
- bool bAddSpacing;
- bool bAddSpacingAtPages;
- bool bUseOurTabStops;
- bool bNoExtLeading;
- bool bUseLineSpacing;
- bool bAddTableSpacing;
- bool bUseObjPos;
- bool bUseOurTextWrapping;
- bool bConsiderWrappingStyle;
- bool bExpandWordSpace;
-};
-
-/*-****************************************************************************************************************
- @descr support simple menu structures and operations on it
-****************************************************************************************************************-*/
-class SvtCompatibility
-{
- public:
- //---------------------------------------------------------------------------------------------------------
- // append one entry
- void AppendEntry( const SvtCompatibilityEntry& rEntry )
- {
- lEntries.push_back( rEntry );
- }
-
- //---------------------------------------------------------------------------------------------------------
- // the only way to free memory!
- void Clear()
- {
- lEntries.clear();
- }
-
- //---------------------------------------------------------------------------------------------------------
- // convert internal list to external format
- Sequence< Sequence< PropertyValue > > GetList() const
- {
- sal_Int32 nCount = (sal_Int32)lEntries.size();
- sal_Int32 nStep = 0;
- Sequence< PropertyValue > lProperties( PROPERTYCOUNT );
- Sequence< Sequence< PropertyValue > > lResult( nCount );
- const vector< SvtCompatibilityEntry >* pList = &lEntries;
-
- lProperties[ OFFSET_NAME ].Name = PROPERTYNAME_NAME;
- lProperties[ OFFSET_MODULE ].Name = PROPERTYNAME_MODULE;
- lProperties[ OFFSET_USEPRTMETRICS ].Name = PROPERTYNAME_USEPRTMETRICS;
- lProperties[ OFFSET_ADDSPACING ].Name = PROPERTYNAME_ADDSPACING;
- lProperties[ OFFSET_ADDSPACINGATPAGES ].Name = PROPERTYNAME_ADDSPACINGATPAGES;
- lProperties[ OFFSET_USEOURTABSTOPS ].Name = PROPERTYNAME_USEOURTABSTOPS;
- lProperties[ OFFSET_NOEXTLEADING ].Name = PROPERTYNAME_NOEXTLEADING;
- lProperties[ OFFSET_USELINESPACING ].Name = PROPERTYNAME_USELINESPACING;
- lProperties[ OFFSET_ADDTABLESPACING ].Name = PROPERTYNAME_ADDTABLESPACING;
- lProperties[ OFFSET_USEOBJPOS ].Name = PROPERTYNAME_USEOBJPOS;
- lProperties[ OFFSET_USEOURTEXTWRAPPING ].Name = PROPERTYNAME_USEOURTEXTWRAP;
- lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Name = PROPERTYNAME_CONSIDERWRAPSTYLE;
- lProperties[ OFFSET_EXPANDWORDSPACE ].Name = PROPERTYNAME_EXPANDWORDSPACE;
-
- for ( vector< SvtCompatibilityEntry >::const_iterator pItem = pList->begin();
- pItem != pList->end(); ++pItem )
- {
- lProperties[ OFFSET_NAME ].Value <<= pItem->sName;
- lProperties[ OFFSET_MODULE ].Value <<= pItem->sModule;
- lProperties[ OFFSET_USEPRTMETRICS ].Value <<= pItem->bUsePrtMetrics;
- lProperties[ OFFSET_ADDSPACING ].Value <<= pItem->bAddSpacing;
- lProperties[ OFFSET_ADDSPACINGATPAGES ].Value <<= pItem->bAddSpacingAtPages;
- lProperties[ OFFSET_USEOURTABSTOPS ].Value <<= pItem->bUseOurTabStops;
- lProperties[ OFFSET_NOEXTLEADING ].Value <<= pItem->bNoExtLeading;
- lProperties[ OFFSET_USELINESPACING ].Value <<= pItem->bUseLineSpacing;
- lProperties[ OFFSET_ADDTABLESPACING ].Value <<= pItem->bAddTableSpacing;
- lProperties[ OFFSET_USEOBJPOS ].Value <<= pItem->bUseObjPos;
- lProperties[ OFFSET_USEOURTEXTWRAPPING ].Value <<= pItem->bUseOurTextWrapping;
- lProperties[ OFFSET_CONSIDERWRAPPINGSTYLE ].Value <<= pItem->bConsiderWrappingStyle;
- lProperties[ OFFSET_EXPANDWORDSPACE ].Value <<= pItem->bExpandWordSpace;
- lResult[ nStep ] = lProperties;
- ++nStep;
- }
-
- return lResult;
- }
-
- int size() const
- {
- return lEntries.size();
- }
-
- const SvtCompatibilityEntry& operator[]( int i )
- {
- return lEntries[i];
- }
-
- private:
- vector< SvtCompatibilityEntry > lEntries;
-};
-
-class SvtCompatibilityOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtCompatibilityOptions_Impl();
- ~SvtCompatibilityOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "lPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& lPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short base implementation of public interface for "SvtCompatibilityOptions"!
- @descr These class is used as static member of "SvtCompatibilityOptions" ...
- => The code exist only for one time and isn't duplicated for every instance!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- void Clear();
- Sequence< Sequence< PropertyValue > > GetList() const;
- void AppendItem( const ::rtl::OUString& _sName,
- const ::rtl::OUString& _sModule,
- bool _bUsePrtMetrics,
- bool _bAddSpacing,
- bool _bAddSpacingAtPages,
- bool _bUseOurTabStops,
- bool _bNoExtLeading,
- bool _bUseLineSpacing,
- bool _bAddTableSpacing,
- bool _bUseObjPos,
- bool _bUseOurTextWrapping,
- bool _bConsiderWrappingStyle,
- bool _bExpandWordSpace );
-
- inline bool IsUsePrtDevice() const { return m_aDefOptions.bUsePrtMetrics; }
- inline bool IsAddSpacing() const { return m_aDefOptions.bAddSpacing; }
- inline bool IsAddSpacingAtPages() const { return m_aDefOptions.bAddSpacingAtPages; }
- inline bool IsUseOurTabStops() const { return m_aDefOptions.bUseOurTabStops; }
- inline bool IsNoExtLeading() const { return m_aDefOptions.bNoExtLeading; }
- inline bool IsUseLineSpacing() const { return m_aDefOptions.bUseLineSpacing; }
- inline bool IsAddTableSpacing() const { return m_aDefOptions.bAddTableSpacing; }
- inline bool IsUseObjPos() const { return m_aDefOptions.bUseObjPos; }
- inline bool IsUseOurTextWrapping() const { return m_aDefOptions.bUseOurTextWrapping; }
- inline bool IsConsiderWrappingStyle() const { return m_aDefOptions.bConsiderWrappingStyle; }
- inline bool IsExpandWordSpace() const { return m_aDefOptions.bExpandWordSpace; }
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of our configuration management which represent one module tree
- @descr These methods return the current list of key names! We need it to get needed values from our
- configuration management and support dynamical menu item lists!
-
- @seealso -
-
- @param -
- @return A list of configuration key names is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< OUString > impl_GetPropertyNames( Sequence< OUString >& rItems );
-
- /*-****************************************************************************************************//**
- @short expand the list for all well known properties to destination
- @descr -
- @attention -
-
- @seealso method impl_GetPropertyNames()
-
- @param "lSource" , original list
- @param "lDestination" , destination of operation
- @return A list of configuration key names is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- void impl_ExpandPropertyNames( const Sequence< OUString >& lSource,
- Sequence< OUString >& lDestination );
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- SvtCompatibility m_aOptions;
- SvtCompatibilityEntry m_aDefOptions;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl()
- // Init baseclasses first
- : ConfigItem( ROOTNODE_OPTIONS )
- // Init member then...
-{
- // Get names and values of all accessable menu entries and fill internal structures.
- // See impl_GetPropertyNames() for further informations.
- Sequence< OUString > lNodes;
- Sequence< OUString > lNames = impl_GetPropertyNames( lNodes );
- sal_uInt32 nCount = lNodes.getLength();
- Sequence< Any > lValues = GetProperties( lNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !( lNames.getLength()!=lValues.getLength() ), "SvtCompatibilityOptions_Impl::SvtCompatibilityOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- SvtCompatibilityEntry aItem;
- sal_uInt32 nItem = 0;
- sal_uInt32 nPosition = 0;
-
- // Get names/values for new menu.
- // 4 subkeys for every item!
- bool bDefaultFound = false;
- for( nItem = 0; nItem < nCount; ++nItem )
- {
- aItem.sName = lNodes[ nItem ];
- lValues[ nPosition++ ] >>= aItem.sModule;
- lValues[ nPosition++ ] >>= aItem.bUsePrtMetrics;
- lValues[ nPosition++ ] >>= aItem.bAddSpacing;
- lValues[ nPosition++ ] >>= aItem.bAddSpacingAtPages;
- lValues[ nPosition++ ] >>= aItem.bUseOurTabStops;
- lValues[ nPosition++ ] >>= aItem.bNoExtLeading;
- lValues[ nPosition++ ] >>= aItem.bUseLineSpacing;
- lValues[ nPosition++ ] >>= aItem.bAddTableSpacing;
- lValues[ nPosition++ ] >>= aItem.bUseObjPos;
- lValues[ nPosition++ ] >>= aItem.bUseOurTextWrapping;
- lValues[ nPosition++ ] >>= aItem.bConsiderWrappingStyle;
- lValues[ nPosition++ ] >>= aItem.bExpandWordSpace;
- m_aOptions.AppendEntry( aItem );
-
- if ( !bDefaultFound && aItem.sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False )
- {
- m_aDefOptions = aItem;
- bDefaultFound = true;
- }
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtCompatibilityOptions_Impl::~SvtCompatibilityOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCompatibilityOptions_Impl::Notify( const Sequence< OUString >& )
-{
- DBG_ASSERT( sal_False, "SvtCompatibilityOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCompatibilityOptions_Impl::Commit()
-{
- // Write all properties!
- // Delete complete set first.
- ClearNodeSet( SETNODE_ALLFILEFORMATS );
-
- SvtCompatibilityEntry aItem;
- OUString sNode;
- Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT - 1 );
- sal_uInt32 nItem = 0;
- sal_uInt32 nNewCount = m_aOptions.size();
- for( nItem = 0; nItem < nNewCount; ++nItem )
- {
- aItem = m_aOptions[ nItem ];
- sNode = SETNODE_ALLFILEFORMATS + PATHDELIMITER + aItem.sName + PATHDELIMITER;
-
- lPropertyValues[ OFFSET_MODULE - 1 ].Name = sNode + PROPERTYNAME_MODULE;
- lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Name = sNode + PROPERTYNAME_USEPRTMETRICS;
- lPropertyValues[ OFFSET_ADDSPACING - 1 ].Name = sNode + PROPERTYNAME_ADDSPACING;
- lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Name = sNode + PROPERTYNAME_ADDSPACINGATPAGES;
- lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Name = sNode + PROPERTYNAME_USEOURTABSTOPS;
- lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Name = sNode + PROPERTYNAME_NOEXTLEADING;
- lPropertyValues[ OFFSET_USELINESPACING - 1 ].Name = sNode + PROPERTYNAME_USELINESPACING;
- lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Name = sNode + PROPERTYNAME_ADDTABLESPACING;
- lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Name = sNode + PROPERTYNAME_USEOBJPOS;
- lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Name = sNode + PROPERTYNAME_USEOURTEXTWRAP;
- lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Name = sNode + PROPERTYNAME_CONSIDERWRAPSTYLE;
- lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Name = sNode + PROPERTYNAME_EXPANDWORDSPACE;
-
- lPropertyValues[ OFFSET_MODULE - 1 ].Value <<= aItem.sModule;
- lPropertyValues[ OFFSET_USEPRTMETRICS - 1 ].Value <<= aItem.bUsePrtMetrics;
- lPropertyValues[ OFFSET_ADDSPACING - 1 ].Value <<= aItem.bAddSpacing;
- lPropertyValues[ OFFSET_ADDSPACINGATPAGES - 1 ].Value <<= aItem.bAddSpacingAtPages;
- lPropertyValues[ OFFSET_USEOURTABSTOPS - 1 ].Value <<= aItem.bUseOurTabStops;
- lPropertyValues[ OFFSET_NOEXTLEADING - 1 ].Value <<= aItem.bNoExtLeading;
- lPropertyValues[ OFFSET_USELINESPACING - 1 ].Value <<= aItem.bUseLineSpacing;
- lPropertyValues[ OFFSET_ADDTABLESPACING - 1 ].Value <<= aItem.bAddTableSpacing;
- lPropertyValues[ OFFSET_USEOBJPOS - 1 ].Value <<= aItem.bUseObjPos;
- lPropertyValues[ OFFSET_USEOURTEXTWRAPPING - 1 ].Value <<= aItem.bUseOurTextWrapping;
- lPropertyValues[ OFFSET_CONSIDERWRAPPINGSTYLE - 1 ].Value <<= aItem.bConsiderWrappingStyle;
- lPropertyValues[ OFFSET_EXPANDWORDSPACE - 1 ].Value <<= aItem.bExpandWordSpace;
-
- SetSetProperties( SETNODE_ALLFILEFORMATS, lPropertyValues );
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCompatibilityOptions_Impl::Clear()
-{
- m_aOptions.Clear();
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions_Impl::GetList() const
-{
- Sequence< Sequence< PropertyValue > > lReturn;
- lReturn = m_aOptions.GetList();
- return lReturn;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-
-void SvtCompatibilityOptions_Impl::AppendItem( const ::rtl::OUString& _sName,
- const ::rtl::OUString& _sModule,
- bool _bUsePrtMetrics,
- bool _bAddSpacing,
- bool _bAddSpacingAtPages,
- bool _bUseOurTabStops,
- bool _bNoExtLeading,
- bool _bUseLineSpacing,
- bool _bAddTableSpacing,
- bool _bUseObjPos,
- bool _bUseOurTextWrapping,
- bool _bConsiderWrappingStyle,
- bool _bExpandWordSpace )
-{
- SvtCompatibilityEntry aItem( _sName, _sModule );
- aItem.SetUsePrtMetrics( _bUsePrtMetrics );
- aItem.SetAddSpacing( _bAddSpacing );
- aItem.SetAddSpacingAtPages( _bAddSpacingAtPages );
- aItem.SetUseOurTabStops( _bUseOurTabStops );
- aItem.SetNoExtLeading( _bNoExtLeading );
- aItem.SetUseLineSpacing( _bUseLineSpacing );
- aItem.SetAddTableSpacing( _bAddTableSpacing );
- aItem.SetUseObjPos( _bUseObjPos );
- aItem.SetUseOurTextWrapping( _bUseOurTextWrapping );
- aItem.SetConsiderWrappingStyle( _bConsiderWrappingStyle );
- aItem.SetExpandWordSpace( _bExpandWordSpace );
- m_aOptions.AppendEntry( aItem );
-
- // default item reset?
- if ( _sName.equals( COMPATIBILITY_DEFAULT_NAME ) != sal_False )
- m_aDefOptions = aItem;
-
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtCompatibilityOptions_Impl::impl_GetPropertyNames( Sequence< OUString >& rItems )
-{
- // First get ALL names of current existing list items in configuration!
- rItems = GetNodeNames( SETNODE_ALLFILEFORMATS );
- // expand list to result list ...
- Sequence< OUString > lProperties( rItems.getLength() * ( PROPERTYCOUNT - 1 ) );
- impl_ExpandPropertyNames( rItems, lProperties );
- // Return result.
- return lProperties;
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-void SvtCompatibilityOptions_Impl::impl_ExpandPropertyNames(
- const Sequence< OUString >& lSource, Sequence< OUString >& lDestination )
-{
- OUString sFixPath;
- sal_Int32 nDestStep = 0;
- sal_Int32 nSourceCount = lSource.getLength();
- // Copy entries to destination and expand every item with 2 supported sub properties.
- for( sal_Int32 nSourceStep = 0; nSourceStep < nSourceCount; ++nSourceStep )
- {
- sFixPath = SETNODE_ALLFILEFORMATS;
- sFixPath += PATHDELIMITER;
- sFixPath += lSource[ nSourceStep ];
- sFixPath += PATHDELIMITER;
-
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_MODULE;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_USEPRTMETRICS;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_ADDSPACING;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_ADDSPACINGATPAGES;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_USEOURTABSTOPS;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_NOEXTLEADING;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_USELINESPACING;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_ADDTABLESPACING;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_USEOBJPOS;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_USEOURTEXTWRAP;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_CONSIDERWRAPSTYLE;
- ++nDestStep;
- lDestination[nDestStep] = sFixPath;
- lDestination[nDestStep] += PROPERTYNAME_EXPANDWORDSPACE;
- ++nDestStep;
- }
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtCompatibilityOptions_Impl* SvtCompatibilityOptions::m_pDataContainer = NULL;
-sal_Int32 SvtCompatibilityOptions::m_nRefCount = 0;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtCompatibilityOptions::SvtCompatibilityOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- m_pDataContainer = new SvtCompatibilityOptions_Impl;
- ItemHolder1::holdConfigItem(E_COMPATIBILITY);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtCompatibilityOptions::~SvtCompatibilityOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCompatibilityOptions::Clear()
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->Clear();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtCompatibilityOptions::AppendItem( const ::rtl::OUString& sName,
- const ::rtl::OUString& sModule,
- bool bUsePrtMetrics,
- bool bAddSpacing,
- bool bAddSpacingAtPages,
- bool bUseOurTabStops,
- bool bNoExtLeading,
- bool bUseLineSpacing,
- bool bAddTableSpacing,
- bool bUseObjPos,
- bool bUseOurTextWrapping,
- bool bConsiderWrappingStyle,
- bool bExpandWordSpace )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->AppendItem(
- sName, sModule, bUsePrtMetrics, bAddSpacing,
- bAddSpacingAtPages, bUseOurTabStops, bNoExtLeading,
- bUseLineSpacing, bAddTableSpacing, bUseObjPos,
- bUseOurTextWrapping, bConsiderWrappingStyle, bExpandWordSpace );
-}
-
-bool SvtCompatibilityOptions::IsUsePrtDevice() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsUsePrtDevice();
-}
-
-bool SvtCompatibilityOptions::IsAddSpacing() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsAddSpacing();
-}
-
-bool SvtCompatibilityOptions::IsAddSpacingAtPages() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsAddSpacingAtPages();
-}
-
-bool SvtCompatibilityOptions::IsUseOurTabStops() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsUseOurTabStops();
-}
-
-bool SvtCompatibilityOptions::IsNoExtLeading() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsNoExtLeading();
-}
-
-bool SvtCompatibilityOptions::IsUseLineSpacing() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsUseLineSpacing();
-}
-
-bool SvtCompatibilityOptions::IsAddTableSpacing() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsAddTableSpacing();
-}
-
-bool SvtCompatibilityOptions::IsUseObjectPositioning() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsUseObjPos();
-}
-
-bool SvtCompatibilityOptions::IsUseOurTextWrapping() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsUseOurTextWrapping();
-}
-
-bool SvtCompatibilityOptions::IsConsiderWrappingStyle() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsConsiderWrappingStyle();
-}
-
-bool SvtCompatibilityOptions::IsExpandWordSpace() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsExpandWordSpace();
-}
-
-Sequence< Sequence< PropertyValue > > SvtCompatibilityOptions::GetList() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetList();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtCompatibilityOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
-
diff --git a/svtools/source/config/ctloptions.cxx b/svtools/source/config/ctloptions.cxx
deleted file mode 100644
index 5d2bf131add1..000000000000
--- a/svtools/source/config/ctloptions.cxx
+++ /dev/null
@@ -1,503 +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: ctloptions.cxx,v $
- * $Revision: 1.18.140.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include <svtools/ctloptions.hxx>
-
-#include <svtools/languageoptions.hxx>
-#include <i18npool/mslangid.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.h>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-#include <vos/mutex.hxx>
-#include <svtools/smplhint.hxx>
-#include <vcl/svapp.hxx>
-#include <rtl/instance.hxx>
-
-#include <itemholder2.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-#define ASCII_STR(s) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
-#define CFG_READONLY_DEFAULT sal_False
-
-// SvtCJKOptions_Impl ----------------------------------------------------------
-
-class SvtCTLOptions_Impl : public utl::ConfigItem, public SfxBroadcaster
-{
-private:
- sal_Bool m_bIsLoaded;
- sal_Bool m_bCTLFontEnabled;
- sal_Bool m_bCTLSequenceChecking;
- sal_Bool m_bCTLRestricted;
- sal_Bool m_bCTLTypeAndReplace;
- SvtCTLOptions::CursorMovement m_eCTLCursorMovement;
- SvtCTLOptions::TextNumerals m_eCTLTextNumerals;
-
- sal_Bool m_bROCTLFontEnabled;
- sal_Bool m_bROCTLSequenceChecking;
- sal_Bool m_bROCTLRestricted;
- sal_Bool m_bROCTLTypeAndReplace;
- sal_Bool m_bROCTLCursorMovement;
- sal_Bool m_bROCTLTextNumerals;
-
-public:
- SvtCTLOptions_Impl();
- ~SvtCTLOptions_Impl();
-
- virtual void Notify( const Sequence< rtl::OUString >& _aPropertyNames );
- virtual void Commit();
- void Load();
-
- sal_Bool IsLoaded() { return m_bIsLoaded; }
- void SetCTLFontEnabled( sal_Bool _bEnabled );
- sal_Bool IsCTLFontEnabled() const { return m_bCTLFontEnabled; }
-
- void SetCTLSequenceChecking( sal_Bool _bEnabled );
- sal_Bool IsCTLSequenceChecking() const { return m_bCTLSequenceChecking;}
-
- void SetCTLSequenceCheckingRestricted( sal_Bool _bEnable );
- sal_Bool IsCTLSequenceCheckingRestricted( void ) const { return m_bCTLRestricted; }
-
- void SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable );
- sal_Bool IsCTLSequenceCheckingTypeAndReplace() const { return m_bCTLTypeAndReplace; }
-
- void SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement );
- SvtCTLOptions::CursorMovement
- GetCTLCursorMovement() const { return m_eCTLCursorMovement; }
-
- void SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals );
- SvtCTLOptions::TextNumerals
- GetCTLTextNumerals() const { return m_eCTLTextNumerals; }
-
- sal_Bool IsReadOnly(SvtCTLOptions::EOption eOption) const;
-};
-//------------------------------------------------------------------------------
-namespace
-{
- struct PropertyNames
- : public rtl::Static< Sequence< rtl::OUString >, PropertyNames > {};
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtCTLOptions_Impl::IsReadOnly(SvtCTLOptions::EOption eOption) const
-{
- sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
- switch(eOption)
- {
- case SvtCTLOptions::E_CTLFONT : bReadOnly = m_bROCTLFontEnabled ; break;
- case SvtCTLOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_bROCTLSequenceChecking ; break;
- case SvtCTLOptions::E_CTLCURSORMOVEMENT : bReadOnly = m_bROCTLCursorMovement ; break;
- case SvtCTLOptions::E_CTLTEXTNUMERALS : bReadOnly = m_bROCTLTextNumerals ; break;
- case SvtCTLOptions::E_CTLSEQUENCECHECKINGRESTRICTED: bReadOnly = m_bROCTLRestricted ; break;
- case SvtCTLOptions::E_CTLSEQUENCECHECKINGTYPEANDREPLACE: bReadOnly = m_bROCTLTypeAndReplace; break;
- default: DBG_ERROR( "SvtCTLOptions_Impl::IsReadOnly() - invalid option" );
- }
- return bReadOnly;
-}
-//------------------------------------------------------------------------------
-SvtCTLOptions_Impl::SvtCTLOptions_Impl() :
-
- utl::ConfigItem( ASCII_STR("Office.Common/I18N/CTL") ),
-
- m_bIsLoaded ( sal_False ),
- m_bCTLFontEnabled ( sal_False ),
- m_bCTLSequenceChecking ( sal_False ),
- m_bCTLRestricted ( sal_False ),
- m_eCTLCursorMovement ( SvtCTLOptions::MOVEMENT_LOGICAL ),
- m_eCTLTextNumerals ( SvtCTLOptions::NUMERALS_ARABIC ),
-
- m_bROCTLFontEnabled ( CFG_READONLY_DEFAULT ),
- m_bROCTLSequenceChecking( CFG_READONLY_DEFAULT ),
- m_bROCTLRestricted ( CFG_READONLY_DEFAULT ),
- m_bROCTLCursorMovement ( CFG_READONLY_DEFAULT ),
- m_bROCTLTextNumerals ( CFG_READONLY_DEFAULT )
-{
-}
-//------------------------------------------------------------------------------
-SvtCTLOptions_Impl::~SvtCTLOptions_Impl()
-{
- if ( IsModified() == sal_True )
- Commit();
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions_Impl::Notify( const Sequence< rtl::OUString >& )
-{
- Load();
- Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED));
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions_Impl::Commit()
-{
- Sequence< rtl::OUString > &rPropertyNames = PropertyNames::get();
- rtl::OUString* pOrgNames = rPropertyNames.getArray();
- sal_Int32 nOrgCount = rPropertyNames.getLength();
-
- Sequence< rtl::OUString > aNames( nOrgCount );
- Sequence< Any > aValues( nOrgCount );
-
- rtl::OUString* pNames = aNames.getArray();
- Any* pValues = aValues.getArray();
- sal_Int32 nRealCount = 0;
-
- const uno::Type& rType = ::getBooleanCppuType();
-
- for ( int nProp = 0; nProp < nOrgCount; nProp++ )
- {
- switch ( nProp )
- {
- case 0:
- {
- if (!m_bROCTLFontEnabled)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLFontEnabled, rType );
- ++nRealCount;
- }
- }
- break;
-
- case 1:
- {
- if (!m_bROCTLSequenceChecking)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLSequenceChecking, rType );
- ++nRealCount;
- }
- }
- break;
-
- case 2:
- {
- if (!m_bROCTLCursorMovement)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount] <<= (sal_Int32)m_eCTLCursorMovement;
- ++nRealCount;
- }
- }
- break;
-
- case 3:
- {
- if (!m_bROCTLTextNumerals)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount] <<= (sal_Int32)m_eCTLTextNumerals;
- ++nRealCount;
- }
- }
- break;
-
- case 4:
- {
- if (!m_bROCTLRestricted)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLRestricted, rType );
- ++nRealCount;
- }
- }
- break;
- case 5:
- {
- if(!m_bROCTLTypeAndReplace)
- {
- pNames[nRealCount] = pOrgNames[nProp];
- pValues[nRealCount].setValue( &m_bCTLTypeAndReplace, rType );
- ++nRealCount;
- }
- }
- break;
- }
- }
- aNames.realloc(nRealCount);
- aValues.realloc(nRealCount);
- PutProperties( aNames, aValues );
- //broadcast changes
- Broadcast(SfxSimpleHint(SFX_HINT_CTL_SETTINGS_CHANGED));
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions_Impl::Load()
-{
- Sequence< rtl::OUString >& rPropertyNames = PropertyNames::get();
- if ( !rPropertyNames.getLength() )
- {
- rPropertyNames.realloc(6);
- rtl::OUString* pNames = rPropertyNames.getArray();
- pNames[0] = ASCII_STR("CTLFont");
- pNames[1] = ASCII_STR("CTLSequenceChecking");
- pNames[2] = ASCII_STR("CTLCursorMovement");
- pNames[3] = ASCII_STR("CTLTextNumerals");
- pNames[4] = ASCII_STR("CTLSequenceCheckingRestricted");
- pNames[5] = ASCII_STR("CTLSequenceCheckingTypeAndReplace");
- EnableNotification( rPropertyNames );
- }
- Sequence< Any > aValues = GetProperties( rPropertyNames );
- Sequence< sal_Bool > aROStates = GetReadOnlyStates( rPropertyNames );
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- DBG_ASSERT( aValues.getLength() == rPropertyNames.getLength(), "GetProperties failed" );
- DBG_ASSERT( aROStates.getLength() == rPropertyNames.getLength(), "GetReadOnlyStates failed" );
- if ( aValues.getLength() == rPropertyNames.getLength() && aROStates.getLength() == rPropertyNames.getLength() )
- {
- sal_Bool bValue = sal_False;
- sal_Int32 nValue = 0;
-
- for ( int nProp = 0; nProp < rPropertyNames.getLength(); nProp++ )
- {
- if ( pValues[nProp].hasValue() )
- {
- if ( pValues[nProp] >>= bValue )
- {
- switch ( nProp )
- {
- case 0: { m_bCTLFontEnabled = bValue; m_bROCTLFontEnabled = pROStates[nProp]; } break;
- case 1: { m_bCTLSequenceChecking = bValue; m_bROCTLSequenceChecking = pROStates[nProp]; } break;
- case 4: { m_bCTLRestricted = bValue; m_bROCTLRestricted = pROStates[nProp]; } break;
- case 5: { m_bCTLTypeAndReplace = bValue; m_bROCTLTypeAndReplace = pROStates[nProp]; } break;
- }
- }
- else if ( pValues[nProp] >>= nValue )
- {
- switch ( nProp )
- {
- case 2: { m_eCTLCursorMovement = (SvtCTLOptions::CursorMovement)nValue; m_bROCTLCursorMovement = pROStates[nProp]; } break;
- case 3: { m_eCTLTextNumerals = (SvtCTLOptions::TextNumerals)nValue; m_bROCTLTextNumerals = pROStates[nProp]; } break;
- }
- }
- }
- }
- }
- sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
- SvtSystemLanguageOptions aSystemLocaleSettings;
- LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage();
- sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
- if( !m_bCTLFontEnabled && (( nType & SCRIPTTYPE_COMPLEX ) ||
- ((eSystemLanguage != LANGUAGE_SYSTEM) && ( nWinScript & SCRIPTTYPE_COMPLEX ))) )
- {
- m_bCTLFontEnabled = sal_True;
- sal_uInt16 nLanguage = Application::GetSettings().GetLanguage();
- //enable sequence checking for the appropriate languages
- m_bCTLSequenceChecking = m_bCTLRestricted = m_bCTLTypeAndReplace =
- (MsLangId::needsSequenceChecking( nLanguage) ||
- MsLangId::needsSequenceChecking( eSystemLanguage));
- Commit();
- }
- m_bIsLoaded = sal_True;
-}
-//------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLFontEnabled( sal_Bool _bEnabled )
-{
- if(!m_bROCTLFontEnabled && m_bCTLFontEnabled != _bEnabled)
- {
- m_bCTLFontEnabled = _bEnabled;
- SetModified();
- }
-}
-//------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLSequenceChecking( sal_Bool _bEnabled )
-{
- if(!m_bROCTLSequenceChecking && m_bCTLSequenceChecking != _bEnabled)
- {
- SetModified();
- m_bCTLSequenceChecking = _bEnabled;
- }
-}
-//------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLSequenceCheckingRestricted( sal_Bool _bEnabled )
-{
- if(!m_bROCTLRestricted && m_bCTLRestricted != _bEnabled)
- {
- SetModified();
- m_bCTLRestricted = _bEnabled;
- }
-}
-//------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnabled )
-{
- if(!m_bROCTLTypeAndReplace && m_bCTLTypeAndReplace != _bEnabled)
- {
- SetModified();
- m_bCTLTypeAndReplace = _bEnabled;
- }
-}
-//------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement )
-{
- if (!m_bROCTLCursorMovement && m_eCTLCursorMovement != _eMovement )
- {
- SetModified();
- m_eCTLCursorMovement = _eMovement;
- }
-}
-//------------------------------------------------------------------------------
-void SvtCTLOptions_Impl::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals )
-{
- if (!m_bROCTLTextNumerals && m_eCTLTextNumerals != _eNumerals )
- {
- SetModified();
- m_eCTLTextNumerals = _eNumerals;
- }
-}
-// global ----------------------------------------------------------------
-
-static SvtCTLOptions_Impl* pCTLOptions = NULL;
-static sal_Int32 nCTLRefCount = 0;
-namespace { struct CTLMutex : public rtl::Static< osl::Mutex, CTLMutex > {}; }
-
-// class SvtCTLOptions --------------------------------------------------
-
-SvtCTLOptions::SvtCTLOptions( sal_Bool bDontLoad )
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( CTLMutex::get() );
- if ( !pCTLOptions )
- {
- pCTLOptions = new SvtCTLOptions_Impl;
- ItemHolder2::holdConfigItem(E_CTLOPTIONS);
- }
- if( !bDontLoad && !pCTLOptions->IsLoaded() )
- pCTLOptions->Load();
-
- ++nCTLRefCount;
- m_pImp = pCTLOptions;
- StartListening( *m_pImp);
-}
-
-// -----------------------------------------------------------------------
-
-SvtCTLOptions::~SvtCTLOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( CTLMutex::get() );
-
- if ( !--nCTLRefCount )
- DELETEZ( pCTLOptions );
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLFontEnabled( sal_Bool _bEnabled )
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- pCTLOptions->SetCTLFontEnabled( _bEnabled );
-}
-// -----------------------------------------------------------------------------
-sal_Bool SvtCTLOptions::IsCTLFontEnabled() const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->IsCTLFontEnabled();
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLSequenceChecking( sal_Bool _bEnabled )
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- pCTLOptions->SetCTLSequenceChecking(_bEnabled);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SvtCTLOptions::IsCTLSequenceChecking() const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->IsCTLSequenceChecking();
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable )
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- pCTLOptions->SetCTLSequenceCheckingRestricted(_bEnable);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SvtCTLOptions::IsCTLSequenceCheckingRestricted( void ) const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->IsCTLSequenceCheckingRestricted();
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable )
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- pCTLOptions->SetCTLSequenceCheckingTypeAndReplace(_bEnable);
-}
-// -----------------------------------------------------------------------------
-sal_Bool SvtCTLOptions::IsCTLSequenceCheckingTypeAndReplace() const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->IsCTLSequenceCheckingTypeAndReplace();
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLCursorMovement( SvtCTLOptions::CursorMovement _eMovement )
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- pCTLOptions->SetCTLCursorMovement( _eMovement );
-}
-// -----------------------------------------------------------------------------
-SvtCTLOptions::CursorMovement SvtCTLOptions::GetCTLCursorMovement() const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->GetCTLCursorMovement();
-}
-// -----------------------------------------------------------------------------
-void SvtCTLOptions::SetCTLTextNumerals( SvtCTLOptions::TextNumerals _eNumerals )
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- pCTLOptions->SetCTLTextNumerals( _eNumerals );
-}
-// -----------------------------------------------------------------------------
-SvtCTLOptions::TextNumerals SvtCTLOptions::GetCTLTextNumerals() const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->GetCTLTextNumerals();
-}
-// -----------------------------------------------------------------------------
-sal_Bool SvtCTLOptions::IsReadOnly(EOption eOption) const
-{
- DBG_ASSERT( pCTLOptions->IsLoaded(), "CTL options not loaded" );
- return pCTLOptions->IsReadOnly(eOption);
-}
-/* -----------------30.04.2003 10:40-----------------
-
- --------------------------------------------------*/
-void SvtCTLOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
- Broadcast( rHint );
-}
-
-// -----------------------------------------------------------------------------
-
diff --git a/svtools/source/config/defaultoptions.cxx b/svtools/source/config/defaultoptions.cxx
deleted file mode 100644
index fbbcf60a11a6..000000000000
--- a/svtools/source/config/defaultoptions.cxx
+++ /dev/null
@@ -1,354 +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: defaultoptions.cxx,v $
- * $Revision: 1.15 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <svtools/defaultoptions.hxx>
-#include <svtools/pathoptions.hxx>
-#include <unotools/configitem.hxx>
-#include <unotools/configmgr.hxx>
-#include <tools/debug.hxx>
-#include <tools/resmgr.hxx>
-#include <tools/urlobj.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-
-#include <vos/process.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <rtl/instance.hxx>
-
-#include <itemholder1.hxx>
-
-using namespace osl;
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-
-// define ----------------------------------------------------------------
-
-#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
-
-#define DEFAULTPATH__ADDIN 0
-#define DEFAULTPATH__AUTOCORRECT 1
-#define DEFAULTPATH__AUTOTEXT 2
-#define DEFAULTPATH__BACKUP 3
-#define DEFAULTPATH__BASIC 4
-#define DEFAULTPATH__BITMAP 5
-#define DEFAULTPATH__CONFIG 6
-#define DEFAULTPATH__DICTIONARY 7
-#define DEFAULTPATH__FAVORITES 8
-#define DEFAULTPATH__FILTER 9
-#define DEFAULTPATH__GALLERY 10
-#define DEFAULTPATH__GRAPHIC 11
-#define DEFAULTPATH__HELP 12
-#define DEFAULTPATH__LINGUISTIC 13
-#define DEFAULTPATH__MODULE 14
-#define DEFAULTPATH__PALETTE 15
-#define DEFAULTPATH__PLUGIN 16
-#define DEFAULTPATH__TEMP 17
-#define DEFAULTPATH__TEMPLATE 18
-#define DEFAULTPATH__USERCONFIG 19
-#define DEFAULTPATH__WORK 20
-#define DEFAULTPATH__USERDICTIONARY 21
-
-// class SvtDefaultOptions_Impl ------------------------------------------
-
-class SvtDefaultOptions_Impl : public utl::ConfigItem
-{
-public:
- String m_aAddinPath;
- String m_aAutoCorrectPath;
- String m_aAutoTextPath;
- String m_aBackupPath;
- String m_aBasicPath;
- String m_aBitmapPath;
- String m_aConfigPath;
- String m_aDictionaryPath;
- String m_aFavoritesPath;
- String m_aFilterPath;
- String m_aGalleryPath;
- String m_aGraphicPath;
- String m_aHelpPath;
- String m_aLinguisticPath;
- String m_aModulePath;
- String m_aPalettePath;
- String m_aPluginPath;
- String m_aTempPath;
- String m_aTemplatePath;
- String m_aUserConfigPath;
- String m_aWorkPath;
- String m_aUserDictionaryPath;
-
- SvtDefaultOptions_Impl();
-
- String GetDefaultPath( USHORT nId ) const;
-};
-
-// global ----------------------------------------------------------------
-
-static SvtDefaultOptions_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-typedef String SvtDefaultOptions_Impl:: *PathStrPtr;
-
-struct PathToDefaultMapping_Impl
-{
- SvtPathOptions::Pathes _ePath;
- PathStrPtr _pDefaultPath;
-};
-
-static PathToDefaultMapping_Impl __READONLY_DATA PathMap_Impl[] =
-{
- { SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath },
- { SvtPathOptions::PATH_AUTOCORRECT, &SvtDefaultOptions_Impl::m_aAutoCorrectPath },
- { SvtPathOptions::PATH_AUTOTEXT, &SvtDefaultOptions_Impl::m_aAutoTextPath },
- { SvtPathOptions::PATH_BACKUP, &SvtDefaultOptions_Impl::m_aBackupPath },
- { SvtPathOptions::PATH_BASIC, &SvtDefaultOptions_Impl::m_aBasicPath },
- { SvtPathOptions::PATH_BITMAP, &SvtDefaultOptions_Impl::m_aBitmapPath },
- { SvtPathOptions::PATH_CONFIG, &SvtDefaultOptions_Impl::m_aConfigPath },
- { SvtPathOptions::PATH_DICTIONARY, &SvtDefaultOptions_Impl::m_aDictionaryPath },
- { SvtPathOptions::PATH_FAVORITES, &SvtDefaultOptions_Impl::m_aFavoritesPath },
- { SvtPathOptions::PATH_FILTER, &SvtDefaultOptions_Impl::m_aFilterPath },
- { SvtPathOptions::PATH_GALLERY, &SvtDefaultOptions_Impl::m_aGalleryPath },
- { SvtPathOptions::PATH_GRAPHIC, &SvtDefaultOptions_Impl::m_aGraphicPath },
- { SvtPathOptions::PATH_HELP, &SvtDefaultOptions_Impl::m_aHelpPath },
- { SvtPathOptions::PATH_LINGUISTIC, &SvtDefaultOptions_Impl::m_aLinguisticPath },
- { SvtPathOptions::PATH_MODULE, &SvtDefaultOptions_Impl::m_aModulePath },
- { SvtPathOptions::PATH_PALETTE, &SvtDefaultOptions_Impl::m_aPalettePath },
- { SvtPathOptions::PATH_PLUGIN, &SvtDefaultOptions_Impl::m_aPluginPath },
- { SvtPathOptions::PATH_TEMP, &SvtDefaultOptions_Impl::m_aTempPath },
- { SvtPathOptions::PATH_TEMPLATE, &SvtDefaultOptions_Impl::m_aTemplatePath },
- { SvtPathOptions::PATH_USERCONFIG, &SvtDefaultOptions_Impl::m_aUserConfigPath },
- { SvtPathOptions::PATH_WORK, &SvtDefaultOptions_Impl::m_aWorkPath }
-};
-
-// functions -------------------------------------------------------------
-
-Sequence< OUString > GetDefaultPropertyNames()
-{
- static const char* aPropNames[] =
- {
- "Addin", // PATH_ADDIN
- "AutoCorrect", // PATH_AUTOCORRECT
- "AutoText", // PATH_AUTOTEXT
- "Backup", // PATH_BACKUP
- "Basic", // PATH_BASIC
- "Bitmap", // PATH_BITMAP
- "Config", // PATH_CONFIG
- "Dictionary", // PATH_DICTIONARY
- "Favorite", // PATH_FAVORITES
- "Filter", // PATH_FILTER
- "Gallery", // PATH_GALLERY
- "Graphic", // PATH_GRAPHIC
- "Help", // PATH_HELP
- "Linguistic", // PATH_LINGUISTIC
- "Module", // PATH_MODULE
- "Palette", // PATH_PALETTE
- "Plugin", // PATH_PLUGIN
- "Temp", // PATH_TEMP
- "Template", // PATH_TEMPLATE
- "UserConfig", // PATH_USERCONFIG
- "Work" // PATH_WORK
- };
-
- const int nCount = sizeof( aPropNames ) / sizeof( const char* );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
-
- return aNames;
-}
-
-// class SvtDefaultOptions_Impl ------------------------------------------
-
-String SvtDefaultOptions_Impl::GetDefaultPath( USHORT nId ) const
-{
- String aRet;
- USHORT nIdx = 0;
-
- while ( PathMap_Impl[nIdx]._ePath <= SvtPathOptions::PATH_WORK )
- {
- if ( nId == PathMap_Impl[nIdx]._ePath && PathMap_Impl[nIdx]._pDefaultPath )
- {
- aRet = this->*(PathMap_Impl[nIdx]._pDefaultPath);
- if ( nId == SvtPathOptions::PATH_ADDIN ||
- nId == SvtPathOptions::PATH_FILTER ||
- nId == SvtPathOptions::PATH_HELP ||
- nId == SvtPathOptions::PATH_MODULE ||
- nId == SvtPathOptions::PATH_PLUGIN )
- {
- String aTmp;
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aRet, aTmp );
- aRet = aTmp;
- }
-
- break;
- }
- ++nIdx;
- }
-
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
-SvtDefaultOptions_Impl::SvtDefaultOptions_Impl() : ConfigItem( ASCII_STR("Office.Common/Path/Default") )
-{
- /*ConfigManager* pCfgMgr =*/ ConfigManager::GetConfigManager();
- Sequence< OUString > aNames = GetDefaultPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- EnableNotification( aNames );
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- if ( aValues.getLength() == aNames.getLength() )
- {
- SvtPathOptions aPathOpt;
- OUString aTempStr, aFullPath;
-
- for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
- {
- if ( pValues[nProp].hasValue() )
- {
- switch ( pValues[nProp].getValueTypeClass() )
- {
- case ::com::sun::star::uno::TypeClass_STRING :
- {
- // multi pathes
- if ( pValues[nProp] >>= aTempStr )
- aFullPath = aPathOpt.SubstituteVariable( aTempStr );
- else
- {
- DBG_ERRORFILE( "any operator >>= failed" );
- }
- break;
- }
-
- case ::com::sun::star::uno::TypeClass_SEQUENCE :
- {
- // single pathes
- aFullPath = OUString();
- Sequence < OUString > aList;
- if ( pValues[nProp] >>= aList )
- {
- sal_Int32 nCount = aList.getLength();
- for ( sal_Int32 nPosition = 0; nPosition < nCount; ++nPosition )
- {
- aTempStr = aPathOpt.SubstituteVariable( aList[ nPosition ] );
- aFullPath += aTempStr;
- if ( nPosition < nCount-1 )
- aFullPath += OUString( RTL_CONSTASCII_USTRINGPARAM(";") );
- }
- }
- else
- {
- DBG_ERRORFILE( "any operator >>= failed" );
- }
- break;
- }
-
- default:
- {
- DBG_ERRORFILE( "Wrong any type" );
- }
- }
-
- switch ( nProp )
- {
- case DEFAULTPATH__ADDIN: m_aAddinPath = String( aFullPath ); break;
- case DEFAULTPATH__AUTOCORRECT: m_aAutoCorrectPath = String( aFullPath ); break;
- case DEFAULTPATH__AUTOTEXT: m_aAutoTextPath = String( aFullPath ); break;
- case DEFAULTPATH__BACKUP: m_aBackupPath = String( aFullPath ); break;
- case DEFAULTPATH__BASIC: m_aBasicPath = String( aFullPath ); break;
- case DEFAULTPATH__BITMAP: m_aBitmapPath = String( aFullPath ); break;
- case DEFAULTPATH__CONFIG: m_aConfigPath = String( aFullPath ); break;
- case DEFAULTPATH__DICTIONARY: m_aDictionaryPath = String( aFullPath ); break;
- case DEFAULTPATH__FAVORITES: m_aFavoritesPath = String( aFullPath ); break;
- case DEFAULTPATH__FILTER: m_aFilterPath = String( aFullPath ); break;
- case DEFAULTPATH__GALLERY: m_aGalleryPath = String( aFullPath ); break;
- case DEFAULTPATH__GRAPHIC: m_aGraphicPath = String( aFullPath ); break;
- case DEFAULTPATH__HELP: m_aHelpPath = String( aFullPath ); break;
- case DEFAULTPATH__LINGUISTIC: m_aLinguisticPath = String( aFullPath ); break;
- case DEFAULTPATH__MODULE: m_aModulePath = String( aFullPath ); break;
- case DEFAULTPATH__PALETTE: m_aPalettePath = String( aFullPath ); break;
- case DEFAULTPATH__PLUGIN: m_aPluginPath = String( aFullPath ); break;
- case DEFAULTPATH__TEMP: m_aTempPath = String( aFullPath ); break;
- case DEFAULTPATH__TEMPLATE: m_aTemplatePath = String( aFullPath ); break;
- case DEFAULTPATH__USERCONFIG: m_aUserConfigPath = String( aFullPath ); break;
- case DEFAULTPATH__WORK: m_aWorkPath = String( aFullPath ); break;
- case DEFAULTPATH__USERDICTIONARY: m_aUserDictionaryPath = String( aFullPath );break;
-
- default:
- DBG_ERRORFILE( "invalid index to load a default path" );
- }
- }
- }
- }
-}
-
-// class SvtDefaultOptions -----------------------------------------------
-namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; }
-
-SvtDefaultOptions::SvtDefaultOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( lclMutex::get() );
- if ( !pOptions )
- {
- pOptions = new SvtDefaultOptions_Impl;
- ItemHolder1::holdConfigItem(E_DEFAULTOPTIONS);
- }
- ++nRefCount;
- pImp = pOptions;
-}
-
-// -----------------------------------------------------------------------
-
-SvtDefaultOptions::~SvtDefaultOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( lclMutex::get() );
- if ( !--nRefCount )
- {
- if ( pOptions->IsModified() )
- pOptions->Commit();
- DELETEZ( pOptions );
- }
-}
-
-// -----------------------------------------------------------------------
-
-String SvtDefaultOptions::GetDefaultPath( USHORT nId ) const
-{
- return pImp->GetDefaultPath( nId );
-}
-
diff --git a/svtools/source/config/dynamicmenuoptions.cxx b/svtools/source/config/dynamicmenuoptions.cxx
deleted file mode 100644
index 7b60a1c3716c..000000000000
--- a/svtools/source/config/dynamicmenuoptions.cxx
+++ /dev/null
@@ -1,923 +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: dynamicmenuoptions.cxx,v $
- * $Revision: 1.18 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/dynamicmenuoptions.hxx>
-#include <svtools/moduleoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#ifndef __SGI_STL_VECTOR
-#include <vector>
-#endif
-
-#include <itemholder1.hxx>
-
-#include <algorithm>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::std ;
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::beans ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_MENUS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Menus/" ))
-#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" ))
-
-#define SETNODE_NEWMENU OUString(RTL_CONSTASCII_USTRINGPARAM("New" ))
-#define SETNODE_WIZARDMENU OUString(RTL_CONSTASCII_USTRINGPARAM("Wizard" ))
-#define SETNODE_HELPBOOKMARKS OUString(RTL_CONSTASCII_USTRINGPARAM("HelpBookmarks" ))
-
-#define PROPERTYNAME_URL DYNAMICMENU_PROPERTYNAME_URL
-#define PROPERTYNAME_TITLE DYNAMICMENU_PROPERTYNAME_TITLE
-#define PROPERTYNAME_IMAGEIDENTIFIER DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER
-#define PROPERTYNAME_TARGETNAME DYNAMICMENU_PROPERTYNAME_TARGETNAME
-
-#define PROPERTYCOUNT 4
-
-#define OFFSET_URL 0
-#define OFFSET_TITLE 1
-#define OFFSET_IMAGEIDENTIFIER 2
-#define OFFSET_TARGETNAME 3
-
-#define PATHPREFIX_SETUP OUString(RTL_CONSTASCII_USTRINGPARAM("m" ))
-#define PATHPREFIX_USER OUString(RTL_CONSTASCII_USTRINGPARAM("u" ))
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-/*-****************************************************************************************************************
- @descr struct to hold information about one menu entry.
-****************************************************************************************************************-*/
-struct SvtDynMenuEntry
-{
- public:
- SvtDynMenuEntry() {};
-
- SvtDynMenuEntry( const OUString& sNewURL ,
- const OUString& sNewTitle ,
- const OUString& sNewImageIdentifier ,
- const OUString& sNewTargetName )
- {
- sURL = sNewURL ;
- sTitle = sNewTitle ;
- sImageIdentifier = sNewImageIdentifier ;
- sTargetName = sNewTargetName ;
- }
-
- public:
- OUString sName ;
- OUString sURL ;
- OUString sTitle ;
- OUString sImageIdentifier ;
- OUString sTargetName ;
-};
-
-/*-****************************************************************************************************************
- @descr support simple menu structures and operations on it
-****************************************************************************************************************-*/
-class SvtDynMenu
-{
- public:
- //---------------------------------------------------------------------------------------------------------
- // append setup written menu entry
- // Don't touch name of entry. It was defined by setup and must be the same everytime!
- // Look for double menu entries here too ... may be some seperator items are supeflous ...
- void AppendSetupEntry( const SvtDynMenuEntry& rEntry )
- {
- if(
- ( lSetupEntries.size() < 1 ) ||
- ( lSetupEntries.rbegin()->sURL != rEntry.sURL )
- )
- {
- lSetupEntries.push_back( rEntry );
- }
- }
-
- //---------------------------------------------------------------------------------------------------------
- // append user specific menu entry
- // We must find unique name for it by using special prefix
- // and next count of user setted entries!
- // Look for double menu entries here too ... may be some seperator items are supeflous ...
- void AppendUserEntry( SvtDynMenuEntry& rEntry )
- {
- if(
- ( lUserEntries.size() < 1 ) ||
- ( lUserEntries.rbegin()->sURL != rEntry.sURL )
- )
- {
- rEntry.sName = PATHPREFIX_USER;
- rEntry.sName += OUString::valueOf( (sal_Int32)impl_getNextUserEntryNr() );
- lUserEntries.push_back( rEntry );
- }
- }
-
- //---------------------------------------------------------------------------------------------------------
- // the only way to free memory!
- void Clear()
- {
- lSetupEntries.clear();
- lUserEntries.clear();
- }
-
- //---------------------------------------------------------------------------------------------------------
- // convert internal list to external format
- // for using it on right menus realy
- // Notice: We build a property list with 4 entries and set it on result list then.
- // The while-loop starts with pointer on internal member list lSetupEntries, change to
- // lUserEntries then and stop after that with NULL!
- // Separator entries will be packed in another way then normal entries! We define
- // special strings "sEmpty" and "sSeperator" to perform too ...
- Sequence< Sequence< PropertyValue > > GetList() const
- {
- sal_Int32 nSetupCount = (sal_Int32)lSetupEntries.size();
- sal_Int32 nUserCount = (sal_Int32)lUserEntries.size();
- sal_Int32 nStep = 0;
- Sequence< PropertyValue > lProperties ( PROPERTYCOUNT );
- Sequence< Sequence< PropertyValue > > lResult ( nSetupCount+nUserCount );
- OUString sSeperator ( RTL_CONSTASCII_USTRINGPARAM("private:separator") );
- OUString sEmpty ;
- const vector< SvtDynMenuEntry >* pList = &lSetupEntries;
-
- lProperties[OFFSET_URL ].Name = PROPERTYNAME_URL ;
- lProperties[OFFSET_TITLE ].Name = PROPERTYNAME_TITLE ;
- lProperties[OFFSET_IMAGEIDENTIFIER].Name = PROPERTYNAME_IMAGEIDENTIFIER ;
- lProperties[OFFSET_TARGETNAME ].Name = PROPERTYNAME_TARGETNAME ;
-
- while( pList != NULL )
- {
- for( vector< SvtDynMenuEntry >::const_iterator pItem =pList->begin();
- pItem!=pList->end() ;
- ++pItem )
- {
- if( pItem->sURL == sSeperator )
- {
- lProperties[OFFSET_URL ].Value <<= sSeperator ;
- lProperties[OFFSET_TITLE ].Value <<= sEmpty ;
- lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= sEmpty ;
- lProperties[OFFSET_TARGETNAME ].Value <<= sEmpty ;
- }
- else
- {
- lProperties[OFFSET_URL ].Value <<= pItem->sURL ;
- lProperties[OFFSET_TITLE ].Value <<= pItem->sTitle ;
- lProperties[OFFSET_IMAGEIDENTIFIER ].Value <<= pItem->sImageIdentifier;
- lProperties[OFFSET_TARGETNAME ].Value <<= pItem->sTargetName ;
- }
- lResult[nStep] = lProperties;
- ++nStep;
- }
- if( pList == &lSetupEntries )
- pList = &lUserEntries;
- else
- pList = NULL;
- }
- return lResult;
- }
-
- private:
- //---------------------------------------------------------------------------------------------------------
- // search for an entry named "ux" with x=[0..i] inside our menu
- // which has set highest number x. So we can add another user entry.
- sal_Int32 impl_getNextUserEntryNr() const
- {
- sal_Int32 nNr = 0;
- for( vector< SvtDynMenuEntry >::const_iterator pItem =lUserEntries.begin();
- pItem!=lUserEntries.end() ;
- ++pItem )
- {
- if( pItem->sName.compareTo( PATHPREFIX_USER, 1 ) == 0 )
- {
- OUString sNr = pItem->sName.copy( 1, pItem->sName.getLength()-1 );
- sal_Int32 nCheckNr = sNr.toInt32();
- if( nCheckNr > nNr )
- nNr = nCheckNr;
- }
- }
- // Attention: Code isn't prepared for recyling of unused fragmented numbers!
- // If we reach end of sal_Int32 range ... we must stop further working ...
- // But I think nobody expand a menu to more then 1000 ... 100000 ... entries ... or?
- DBG_ASSERT( !(nNr>0x7fffffff), "Menu::impl_getNextUserEntryNr()\nUser count can be out of range next time ...\n" );
- return nNr;
- }
-
- private:
- vector< SvtDynMenuEntry > lSetupEntries;
- vector< SvtDynMenuEntry > lUserEntries ;
-};
-
-class SvtDynamicMenuOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtDynamicMenuOptions_Impl();
- ~SvtDynamicMenuOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "lPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& lPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short base implementation of public interface for "SvtDynamicMenuOptions"!
- @descr These class is used as static member of "SvtDynamicMenuOptions" ...
- => The code exist only for one time and isn't duplicated for every instance!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- void Clear ( EDynamicMenuType eMenu );
- Sequence< Sequence< PropertyValue > > GetMenu ( EDynamicMenuType eMenu ) const ;
- void AppendItem ( EDynamicMenuType eMenu ,
- const OUString& sURL ,
- const OUString& sTitle ,
- const OUString& sImageIdentifier,
- const OUString& sTargetName );
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of our configuration management which represent oue module tree
- @descr These methods return the current list of key names! We need it to get needed values from our
- configuration management and support dynamical menu item lists!
-
- @seealso -
-
- @param "nNewCount" , returns count of menu entries for "new"
- @param "nWizardCount" , returns count of menu entries for "wizard"
- @return A list of configuration key names is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< OUString > impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount );
-
- /*-****************************************************************************************************//**
- @short sort given source list and expand it for all well known properties to destination
- @descr We must support sets of entries with count inside the name .. but some of them could be missing!
- e.g. s1-s2-s3-s0-u1-s6-u5-u7
- Then we must sort it by name and expand it to the follow one:
- sSetNode/s0/URL
- sSetNode/s0/Title
- sSetNode/s0/...
- sSetNode/s1/URL
- sSetNode/s1/Title
- sSetNode/s1/...
- ...
- sSetNode/s6/URL
- sSetNode/s6/Title
- sSetNode/s6/...
- sSetNode/u1/URL
- sSetNode/u1/Title
- sSetNode/u1/...
- ...
- sSetNode/u7/URL
- sSetNode/u7/Title
- sSetNode/u7/...
- Rules: We start with all setup written entries names "sx" and x=[0..n].
- Then we handle all "ux" items. Inside these blocks we sort it ascending by number.
-
- @attention We add these expanded list to the end of given "lDestination" list!
- So we must start on "lDestination.getLength()".
- Reallocation of memory of destination list is done by us!
-
- @seealso method impl_GetPropertyNames()
-
- @param "lSource" , original list (e.g. [m1-m2-m3-m6-m0] )
- @param "lDestination" , destination of operation
- @param "sSetNode" , name of configuration set to build complete path
- @return A list of configuration key names is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- void impl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource ,
- Sequence< OUString >& lDestination ,
- const OUString& sSetNode );
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- SvtDynMenu m_aNewMenu ;
- SvtDynMenu m_aWizardMenu ;
- SvtDynMenu m_aHelpBookmarksMenu ;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()
- // Init baseclasses first
- : ConfigItem( ROOTNODE_MENUS )
- // Init member then...
-{
- // Get names and values of all accessable menu entries and fill internal structures.
- // See impl_GetPropertyNames() for further informations.
- sal_uInt32 nNewCount = 0;
- sal_uInt32 nWizardCount = 0;
- sal_uInt32 nHelpBookmarksCount = 0;
- Sequence< OUString > lNames = impl_GetPropertyNames ( nNewCount ,
- nWizardCount ,
- nHelpBookmarksCount );
- Sequence< Any > lValues = GetProperties ( lNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(lNames.getLength()!=lValues.getLength()), "SvtDynamicMenuOptions_Impl::SvtDynamicMenuOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- // Attention: List for names and values have an internal construction pattern!
- //
- // first "New" menu ...
- // Name Value
- // /New/1/URL "private:factory/swriter"
- // /New/1/Title "Neues Writer Dokument"
- // /New/1/ImageIdentifier "icon_writer"
- // /New/1/TargetName "_blank"
- //
- // /New/2/URL "private:factory/scalc"
- // /New/2/Title "Neues Calc Dokument"
- // /New/2/ImageIdentifier "icon_calc"
- // /New/2/TargetName "_blank"
- //
- // second "Wizard" menu ...
- // /Wizard/1/URL "file://b"
- // /Wizard/1/Title "MalWas"
- // /Wizard/1/ImageIdentifier "icon_?"
- // /Wizard/1/TargetName "_self"
- //
- // ... and so on ...
-
- sal_uInt32 nItem = 0 ;
- sal_uInt32 nPosition = 0 ;
- OUString sName ;
-
- // We must use these one instance object(!) to get information about installed modules.
- // These information are used to filter menu entries wich need not installed modules ...
- // Such entries shouldnt be available then!
- // see impl_IsEntrySupported() too
- SvtModuleOptions aModuleOptions;
-
- // Get names/values for new menu.
- // 4 subkeys for every item!
- for( nItem=0; nItem<nNewCount; ++nItem )
- {
- SvtDynMenuEntry aItem ;
- lValues[nPosition] >>= aItem.sURL ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sTitle ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sImageIdentifier ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sTargetName ;
- ++nPosition;
- m_aNewMenu.AppendSetupEntry( aItem );
- }
-
- // Attention: Don't reset nPosition here!
-
- // Get names/values for wizard menu.
- // 4 subkeys for every item!
- for( nItem=0; nItem<nWizardCount; ++nItem )
- {
- SvtDynMenuEntry aItem ;
- lValues[nPosition] >>= aItem.sURL ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sTitle ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sImageIdentifier ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sTargetName ;
- ++nPosition;
- m_aWizardMenu.AppendSetupEntry( aItem );
- }
-
- // Attention: Don't reset nPosition here!
-
- // Get names/values for wizard menu.
- // 4 subkeys for every item!
- for( nItem=0; nItem<nHelpBookmarksCount; ++nItem )
- {
- SvtDynMenuEntry aItem ;
- lValues[nPosition] >>= aItem.sURL ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sTitle ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sImageIdentifier ;
- ++nPosition;
- lValues[nPosition] >>= aItem.sTargetName ;
- ++nPosition;
- m_aHelpBookmarksMenu.AppendSetupEntry( aItem );
- }
-
-/*TODO: Not used in the moment! see Notify() ...
- // Enable notification mechanism of ouer baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys!
- EnableNotification( lNames );
-*/
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtDynamicMenuOptions_Impl::~SvtDynamicMenuOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions_Impl::Notify( const Sequence< OUString >& )
-{
- DBG_ASSERT( sal_False, "SvtDynamicMenuOptions_Impl::Notify()\nNot implemented yet! I don't know how I can handle a dynamical list of unknown properties ...\n" );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions_Impl::Commit()
-{
- DBG_ERROR( "SvtDynamicMenuOptions_Impl::Commit()\nNot implemented yet!\n" );
- /*
- // Write all properties!
- // Delete complete sets first.
- ClearNodeSet( SETNODE_NEWMENU );
- ClearNodeSet( SETNODE_WIZARDMENU );
- ClearNodeSet( SETNODE_HELPBOOKMARKS );
-
- MenuEntry aItem ;
- OUString sNode ;
- Sequence< PropertyValue > lPropertyValues( PROPERTYCOUNT );
- sal_uInt32 nItem = 0 ;
-
- // Copy "new" menu entries to save-list!
- sal_uInt32 nNewCount = m_aNewMenu.size();
- for( nItem=0; nItem<nNewCount; ++nItem )
- {
- aItem = m_aNewMenu[nItem];
- // Format: "New/1/URL"
- // "New/1/Title"
- // ...
- sNode = SETNODE_NEWMENU + PATHDELIMITER + PATHPREFIX + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
-
- lPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_URL ;
- lPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_TITLE ;
- lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Name = sNode + PROPERTYNAME_IMAGEIDENTIFIER ;
- lPropertyValues[OFFSET_TARGETNAME ].Name = sNode + PROPERTYNAME_TARGETNAME ;
-
- lPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- lPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ;
- lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Value <<= aItem.sImageIdentifier ;
- lPropertyValues[OFFSET_TARGETNAME ].Value <<= aItem.sTargetName ;
-
- SetSetProperties( SETNODE_NEWMENU, lPropertyValues );
- }
-
- // Copy "wizard" menu entries to save-list!
- sal_uInt32 nWizardCount = m_aWizardMenu.size();
- for( nItem=0; nItem<nWizardCount; ++nItem )
- {
- aItem = m_aWizardMenu[nItem];
- // Format: "Wizard/1/URL"
- // "Wizard/1/Title"
- // ...
- sNode = SETNODE_WIZARDMENU + PATHDELIMITER + PATHPREFIX + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
-
- lPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_URL ;
- lPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_TITLE ;
- lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Name = sNode + PROPERTYNAME_IMAGEIDENTIFIER ;
- lPropertyValues[OFFSET_TARGETNAME ].Name = sNode + PROPERTYNAME_TARGETNAME ;
-
- lPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- lPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ;
- lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Value <<= aItem.sImageIdentifier ;
- lPropertyValues[OFFSET_TARGETNAME ].Value <<= aItem.sTargetName ;
-
- SetSetProperties( SETNODE_WIZARDMENU, lPropertyValues );
- }
-
- // Copy help bookmarks entries to save-list!
- sal_uInt32 nHelpBookmarksCount = m_aHelpBookmarksMenu.size();
- for( nItem=0; nItem<nHelpBookmarksCount; ++nItem )
- {
- aItem = m_aHelpBookmarksMenu[nItem];
- // Format: "HelpBookmarks/1/URL"
- // "HelpBookmarks/1/Title"
- // ...
- sNode = SETNODE_HELPBOOKMARKS + PATHDELIMITER + PATHPREFIX + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
-
- lPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_URL ;
- lPropertyValues[OFFSET_TITLE ].Name = sNode + PROPERTYNAME_TITLE ;
- lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Name = sNode + PROPERTYNAME_IMAGEIDENTIFIER ;
- lPropertyValues[OFFSET_TARGETNAME ].Name = sNode + PROPERTYNAME_TARGETNAME ;
-
- lPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- lPropertyValues[OFFSET_TITLE ].Value <<= aItem.sTitle ;
- lPropertyValues[OFFSET_IMAGEIDENTIFIER ].Value <<= aItem.sImageIdentifier ;
- lPropertyValues[OFFSET_TARGETNAME ].Value <<= aItem.sTargetName ;
-
- SetSetProperties( SETNODE_HELPBOOKMARKS, lPropertyValues );
- }
- */
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions_Impl::Clear( EDynamicMenuType eMenu )
-{
- switch( eMenu )
- {
- case E_NEWMENU : {
- m_aNewMenu.Clear();
- SetModified();
- }
- break;
-
- case E_WIZARDMENU : {
- m_aWizardMenu.Clear();
- SetModified();
- }
- break;
-
- case E_HELPBOOKMARKS : {
- m_aHelpBookmarksMenu.Clear();
- SetModified();
- }
- break;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< Sequence< PropertyValue > > SvtDynamicMenuOptions_Impl::GetMenu( EDynamicMenuType eMenu ) const
-{
- Sequence< Sequence< PropertyValue > > lReturn;
- switch( eMenu )
- {
- case E_NEWMENU : {
- lReturn = m_aNewMenu.GetList();
- }
- break;
-
- case E_WIZARDMENU : {
- lReturn = m_aWizardMenu.GetList();
- }
- break;
-
- case E_HELPBOOKMARKS : {
- lReturn = m_aHelpBookmarksMenu.GetList();
- }
- break;
- }
- return lReturn;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions_Impl::AppendItem( EDynamicMenuType eMenu ,
- const OUString& sURL ,
- const OUString& sTitle ,
- const OUString& sImageIdentifier,
- const OUString& sTargetName )
-{
- SvtDynMenuEntry aItem( sURL, sTitle, sImageIdentifier, sTargetName );
-
- switch( eMenu )
- {
- case E_NEWMENU : {
- m_aNewMenu.AppendUserEntry( aItem );
- SetModified();
- }
- break;
-
- case E_WIZARDMENU : {
- m_aWizardMenu.AppendUserEntry( aItem );
- SetModified();
- }
- break;
-
- case E_HELPBOOKMARKS : {
- m_aHelpBookmarksMenu.AppendUserEntry( aItem );
- SetModified();
- }
- break;
- }
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtDynamicMenuOptions_Impl::impl_GetPropertyNames( sal_uInt32& nNewCount, sal_uInt32& nWizardCount, sal_uInt32& nHelpBookmarksCount )
-{
- // First get ALL names of current existing list items in configuration!
- Sequence< OUString > lNewItems = GetNodeNames( SETNODE_NEWMENU );
- Sequence< OUString > lWizardItems = GetNodeNames( SETNODE_WIZARDMENU );
- Sequence< OUString > lHelpBookmarksItems = GetNodeNames( SETNODE_HELPBOOKMARKS );
-
- // Get information about list counts ...
- nNewCount = lNewItems.getLength ();
- nWizardCount = lWizardItems.getLength ();
- nHelpBookmarksCount = lHelpBookmarksItems.getLength();
-
- // Sort and expand all three list to result list ...
- Sequence< OUString > lProperties;
- impl_SortAndExpandPropertyNames( lNewItems , lProperties, SETNODE_NEWMENU );
- impl_SortAndExpandPropertyNames( lWizardItems , lProperties, SETNODE_WIZARDMENU );
- impl_SortAndExpandPropertyNames( lHelpBookmarksItems, lProperties, SETNODE_HELPBOOKMARKS );
-
- // Return result.
- return lProperties;
-}
-
-//*****************************************************************************************************************
-// private helper
-//*****************************************************************************************************************
-class CountWithPrefixSort
-{
- public:
- int operator() ( const OUString& s1 ,
- const OUString& s2 ) const
- {
- // Get order numbers from entry name without prefix.
- // e.g. "m10" => 10
- // "m5" => 5
- sal_Int32 n1 = s1.copy( 1, s1.getLength()-1 ).toInt32();
- sal_Int32 n2 = s2.copy( 1, s2.getLength()-1 ).toInt32();
- // MUST be in [0,1] ... because it's a difference between
- // insert-positions of given entries in sorted list!
- return( n1<n2 );
- }
-};
-
-class SelectByPrefix
-{
- public:
- bool operator() ( const OUString& s ) const
- {
- // Prefer setup written entries by check first letter of given string. It must be a "s".
- return( s.indexOf( PATHPREFIX_SETUP ) == 0 );
- }
-};
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions_Impl::impl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource ,
- Sequence< OUString >& lDestination ,
- const OUString& sSetNode )
-{
- OUString sFixPath ;
- vector< OUString > lTemp ;
- sal_Int32 nSourceCount = lSource.getLength() ;
- sal_Int32 nDestinationStep = lDestination.getLength() ; // start on end of current list ...!
-
- lDestination.realloc( (nSourceCount*PROPERTYCOUNT)+nDestinationStep ); // get enough memory for copy operations after nDestination ...
-
- // Copy all items to temp. vector to use fast sort operations :-)
- for( sal_Int32 nSourceStep=0; nSourceStep<nSourceCount; ++nSourceStep )
- lTemp.push_back( lSource[nSourceStep] );
-
- // Sort all entries by number ...
- stable_sort( lTemp.begin(), lTemp.end(), CountWithPrefixSort() );
- // and split into setup & user written entries!
- stable_partition( lTemp.begin(), lTemp.end(), SelectByPrefix() );
-
- // Copy sorted entries to destination and expand every item with
- // 4 supported sub properties.
- for( vector< OUString >::const_iterator pItem =lTemp.begin() ;
- pItem!=lTemp.end() ;
- ++pItem )
- {
- sFixPath = sSetNode ;
- sFixPath += PATHDELIMITER ;
- sFixPath += *pItem ;
- sFixPath += PATHDELIMITER ;
-
- lDestination[nDestinationStep] = sFixPath ;
- lDestination[nDestinationStep] += PROPERTYNAME_URL ;
- ++nDestinationStep;
- lDestination[nDestinationStep] = sFixPath ;
- lDestination[nDestinationStep] += PROPERTYNAME_TITLE ;
- ++nDestinationStep;
- lDestination[nDestinationStep] = sFixPath ;
- lDestination[nDestinationStep] += PROPERTYNAME_IMAGEIDENTIFIER ;
- ++nDestinationStep;
- lDestination[nDestinationStep] = sFixPath ;
- lDestination[nDestinationStep] += PROPERTYNAME_TARGETNAME ;
- ++nDestinationStep;
- }
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtDynamicMenuOptions_Impl* SvtDynamicMenuOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtDynamicMenuOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtDynamicMenuOptions::SvtDynamicMenuOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- m_pDataContainer = new SvtDynamicMenuOptions_Impl;
- ItemHolder1::holdConfigItem(E_DYNAMICMENUOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtDynamicMenuOptions::~SvtDynamicMenuOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions::Clear( EDynamicMenuType eMenu )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->Clear( eMenu );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< Sequence< PropertyValue > > SvtDynamicMenuOptions::GetMenu( EDynamicMenuType eMenu ) const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetMenu( eMenu );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtDynamicMenuOptions::AppendItem( EDynamicMenuType eMenu ,
- const OUString& sURL ,
- const OUString& sTitle ,
- const OUString& sImageIdentifier,
- const OUString& sTargetName )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->AppendItem( eMenu, sURL, sTitle, sImageIdentifier, sTargetName );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtDynamicMenuOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/eventcfg.cxx b/svtools/source/config/eventcfg.cxx
deleted file mode 100644
index 6026c3d4a3a0..000000000000
--- a/svtools/source/config/eventcfg.cxx
+++ /dev/null
@@ -1,458 +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: eventcfg.cxx,v $
- * $Revision: 1.8.24.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include "eventcfg.hxx"
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <cppuhelper/weakref.hxx>
-
-#ifndef __SGI_STL_HASH_MAP
-#include <hash_map>
-#endif
-#include <tools/urlobj.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <itemholder1.hxx>
-
-#include <algorithm>
-
-using namespace ::std ;
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star;
-
-#define ROOTNODE_EVENTS OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Events/ApplicationEvents" ))
-#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/"))
-#define SETNODE_BINDINGS OUString(RTL_CONSTASCII_USTRINGPARAM("Bindings" ))
-#define PROPERTYNAME_BINDINGURL OUString(RTL_CONSTASCII_USTRINGPARAM("BindingURL"))
-
-const char* pEventAsciiNames[] =
-{
-"OnStartApp",
-"OnCloseApp",
-"OnCreate",
-"OnNew",
-"OnLoadFinished",
-"OnLoad",
-"OnPrepareUnload",
-"OnUnload",
-"OnSave",
-"OnSaveDone",
-"OnSaveFailed",
-"OnSaveAs",
-"OnSaveAsDone",
-"OnSaveAsFailed",
-"OnCopyTo",
-"OnCopyToDone",
-"OnCopyToFailed",
-"OnFocus",
-"OnUnfocus",
-"OnPrint",
-"OnViewCreated",
-"OnPrepareViewClosing",
-"OnViewClosed",
-"OnModifyChanged",
-"OnTitleChanged",
-"OnVisAreaChanged",
-"OnModeChanged",
-"OnStorageChanged"
-};
-
-GlobalEventConfig_Impl::GlobalEventConfig_Impl()
- : ConfigItem( ROOTNODE_EVENTS, CONFIG_MODE_IMMEDIATE_UPDATE )
-{
- // the supported event names
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STARTAPP] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEAPP] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DOCCREATED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CREATEDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_LOADFINISHED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_OPENDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCDONE] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEDOCFAILED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCDONE] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVEASDOCFAILED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCDONE] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_SAVETODOCFAILED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_ACTIVATEDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_DEACTIVATEDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PRINTDOC] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VIEWCREATED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_PREPARECLOSEVIEW] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_CLOSEVIEW] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODIFYCHANGED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_TITLECHANGED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_VISAREACHANGED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_MODECHANGED] ) );
- m_supportedEvents.push_back(::rtl::OUString::createFromAscii( pEventAsciiNames[STR_EVENT_STORAGECHANGED] ) );
-
- initBindingInfo();
-
-/*TODO: Not used in the moment! see Notify() ...
- // Enable notification mechanism of our baseclass.
- // We need it to get information about changes outside these class on our used configuration keys! */
- Sequence< OUString > aNotifySeq( 1 );
- aNotifySeq[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( "Events" ));
- EnableNotification( aNotifySeq, sal_True );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-GlobalEventConfig_Impl::~GlobalEventConfig_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-::rtl::OUString GlobalEventConfig_Impl::GetEventName( sal_Int32 nIndex )
-{
- if ( nIndex < (sal_Int32) m_supportedEvents.size() )
- return m_supportedEvents[nIndex];
- else
- return rtl::OUString();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void GlobalEventConfig_Impl::Notify( const Sequence< OUString >& )
-{
- MutexGuard aGuard( GlobalEventConfig::GetOwnStaticMutex() );
-
- initBindingInfo();
-
- // dont forget to update all existing frames and her might cached dispatch objects!
- // But look for already killed frames. We hold weak references instead of hard ones ...
- for (FrameVector::const_iterator pIt = m_lFrames.begin();
- pIt != m_lFrames.end() ;
- ++pIt )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame(pIt->get(), ::com::sun::star::uno::UNO_QUERY);
- if (xFrame.is())
- xFrame->contextChanged();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void GlobalEventConfig_Impl::Commit()
-{
- //DF need to check it this is correct??
- OSL_TRACE("In GlobalEventConfig_Impl::Commit");
- EventBindingHash::const_iterator it = m_eventBindingHash.begin();
- EventBindingHash::const_iterator it_end = m_eventBindingHash.end();
- // clear the existing nodes
- ClearNodeSet( SETNODE_BINDINGS );
- Sequence< beans::PropertyValue > seqValues( 1 );
- OUString sNode;
- static const OUString sPrefix(SETNODE_BINDINGS + PATHDELIMITER + OUString::createFromAscii("BindingType['"));
- static const OUString sPostfix(OUString::createFromAscii("']") + PATHDELIMITER + PROPERTYNAME_BINDINGURL);
- //step through the list of events
- for(int i=0;it!=it_end;++it,++i)
- {
- //no point in writing out empty bindings!
- if(it->second.getLength() == 0 )
- continue;
- sNode = sPrefix + it->first + sPostfix;
- OSL_TRACE("writing binding for: %s",::rtl::OUStringToOString(sNode , RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- seqValues[ 0 ].Name = sNode;
- seqValues[ 0 ].Value <<= it->second;
- //write the data to the registry
- SetSetProperties(SETNODE_BINDINGS,seqValues);
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void GlobalEventConfig_Impl::EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
-{
- // check if frame already exists inside list
- // ignore double registrations
- // every frame must be notified one times only!
- ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XFrame > xWeak(xFrame);
- FrameVector::const_iterator pIt = ::std::find(m_lFrames.begin(), m_lFrames.end(), xWeak);
- if (pIt == m_lFrames.end())
- m_lFrames.push_back(xWeak);
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-void GlobalEventConfig_Impl::initBindingInfo()
-{
- // Get ALL names of current existing list items in configuration!
- Sequence< OUString > lEventNames = GetNodeNames( SETNODE_BINDINGS, utl::CONFIG_NAME_LOCAL_PATH );
-
- OUString aSetNode( SETNODE_BINDINGS );
- aSetNode += PATHDELIMITER;
-
- OUString aCommandKey( PATHDELIMITER );
- aCommandKey += PROPERTYNAME_BINDINGURL;
-
- // Expand all keys
- Sequence< OUString > lMacros(1);
- for (sal_Int32 i=0; i<lEventNames.getLength(); ++i )
- {
- OUStringBuffer aBuffer( 32 );
- aBuffer.append( aSetNode );
- aBuffer.append( lEventNames[i] );
- aBuffer.append( aCommandKey );
- lMacros[0] = aBuffer.makeStringAndClear();
- OSL_TRACE("reading binding for: %s",::rtl::OUStringToOString(lMacros[0] , RTL_TEXTENCODING_ASCII_US ).pData->buffer);
- Sequence< Any > lValues = GetProperties( lMacros );
- OUString sMacroURL;
- if( lValues.getLength() > 0 )
- {
- lValues[0] >>= sMacroURL;
- sal_Int32 startIndex = lEventNames[i].indexOf('\'');
- sal_Int32 endIndex = lEventNames[i].lastIndexOf('\'');
- if( startIndex >=0 && endIndex > 0 )
- {
- startIndex++;
- OUString eventName = lEventNames[i].copy(startIndex,endIndex-startIndex);
- m_eventBindingHash[ eventName ] = sMacroURL;
- }
- }
- }
-}
-
-Reference< container::XNameReplace > SAL_CALL GlobalEventConfig_Impl::getEvents() throw (::com::sun::star::uno::RuntimeException)
-{
- //how to return this object as an XNameReplace?
- Reference< container::XNameReplace > ret;
- return ret;
-}
-
-void SAL_CALL GlobalEventConfig_Impl::replaceByName( const OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-{
- Sequence< beans::PropertyValue > props;
- //DF should we prepopulate the hash with a list of valid event Names?
- if( sal_False == ( aElement >>= props ) )
- {
- throw lang::IllegalArgumentException( OUString(),
- Reference< XInterface > (), 2);
- }
- OUString macroURL;
- sal_Int32 nPropCount = props.getLength();
- for( sal_Int32 index = 0 ; index < nPropCount ; ++index )
- {
- if ( props[ index ].Name.compareToAscii( "Script" ) == 0 )
- props[ index ].Value >>= macroURL;
- }
- m_eventBindingHash[ aName ] = macroURL;
- SetModified();
-}
-
-Any SAL_CALL GlobalEventConfig_Impl::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-{
- Any aRet;
- Sequence< beans::PropertyValue > props(2);
- props[0].Name = OUString::createFromAscii("EventType");
- props[0].Value <<= OUString::createFromAscii("Script");
- props[1].Name = OUString::createFromAscii("Script");
- EventBindingHash::const_iterator it = m_eventBindingHash.find( aName );
- if( it != m_eventBindingHash.end() )
- {
- props[1].Value <<= it->second;
- }
- else
- {
- // not yet accessed - is it a supported name?
- SupportedEventsVector::const_iterator pos = ::std::find(
- m_supportedEvents.begin(), m_supportedEvents.end(), aName );
- if ( pos == m_supportedEvents.end() )
- throw container::NoSuchElementException( aName, NULL );
-
- props[1].Value <<= OUString();
- }
- aRet <<= props;
- return aRet;
-}
-
-Sequence< OUString > SAL_CALL GlobalEventConfig_Impl::getElementNames( ) throw (RuntimeException)
-{
- const ::rtl::OUString* pRet = m_supportedEvents.empty() ? NULL : &m_supportedEvents[0];
- return uno::Sequence< ::rtl::OUString >(pRet, m_supportedEvents.size());
-}
-
-sal_Bool SAL_CALL GlobalEventConfig_Impl::hasByName( const OUString& aName ) throw (RuntimeException)
-{
- if ( m_eventBindingHash.find( aName ) != m_eventBindingHash.end() )
- return sal_True;
-
- // never accessed before - is it supported in general?
- SupportedEventsVector::const_iterator pos = ::std::find(
- m_supportedEvents.begin(), m_supportedEvents.end(), aName );
- if ( pos != m_supportedEvents.end() )
- return sal_True;
-
- return sal_False;
-}
-
-Type SAL_CALL GlobalEventConfig_Impl::getElementType( ) throw (RuntimeException)
-{
- //DF definitly not sure about this??
- return ::getCppuType((const Sequence<beans::PropertyValue>*)0);
-}
-
-sal_Bool SAL_CALL GlobalEventConfig_Impl::hasElements( ) throw (RuntimeException)
-{
- return ( m_eventBindingHash.empty() );
-}
-
-// and now the wrapper
-
-
-//initialize static member
-GlobalEventConfig_Impl* GlobalEventConfig::m_pImpl = NULL ;
-sal_Int32 GlobalEventConfig::m_nRefCount = 0 ;
-
-GlobalEventConfig::GlobalEventConfig()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase our refcount ...
- ++m_nRefCount;
- // ... and initialize our data container only if it not already exist!
- if( m_pImpl == NULL )
- {
- m_pImpl = new GlobalEventConfig_Impl;
- ItemHolder1::holdConfigItem(E_EVENTCFG);
- }
-}
-
-GlobalEventConfig::~GlobalEventConfig()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease our refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy our static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pImpl;
- m_pImpl = NULL;
- }
-}
-
-void GlobalEventConfig::EstablishFrameCallback(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pImpl->EstablishFrameCallback( xFrame );
-}
-
-Reference< container::XNameReplace > SAL_CALL GlobalEventConfig::getEvents() throw (::com::sun::star::uno::RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- Reference< container::XNameReplace > ret(this);
- return ret;
-}
-
-void SAL_CALL GlobalEventConfig::replaceByName( const OUString& aName, const Any& aElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pImpl->replaceByName( aName, aElement );
-}
-Any SAL_CALL GlobalEventConfig::getByName( const OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pImpl->getByName( aName );
-}
-Sequence< OUString > SAL_CALL GlobalEventConfig::getElementNames( ) throw (RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pImpl->getElementNames( );
-}
-sal_Bool SAL_CALL GlobalEventConfig::hasByName( const OUString& aName ) throw (RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pImpl->hasByName( aName );
-}
-Type SAL_CALL GlobalEventConfig::getElementType( ) throw (RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pImpl->getElementType( );
-}
-sal_Bool SAL_CALL GlobalEventConfig::hasElements( ) throw (RuntimeException)
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pImpl->hasElements( );
-}
-
-Mutex& GlobalEventConfig::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect following code with
- // the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that
- // another instance of our class will be faster then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
-
-::rtl::OUString GlobalEventConfig::GetEventName( sal_Int32 nIndex )
-{
- return GlobalEventConfig().m_pImpl->GetEventName( nIndex );
-}
-
diff --git a/svtools/source/config/extcolorcfg.cxx b/svtools/source/config/extcolorcfg.cxx
index 4610a1571baf..89bf41ac9f58 100644
--- a/svtools/source/config/extcolorcfg.cxx
+++ b/svtools/source/config/extcolorcfg.cxx
@@ -27,11 +27,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
#include "extcolorcfg.hxx"
#include <com/sun/star/uno/Any.hxx>
@@ -43,8 +40,8 @@
#include <unotools/configitem.hxx>
#include <unotools/configpathes.hxx>
#include <com/sun/star/uno/Sequence.h>
-#include <svtools/poolitem.hxx> //Any2Bool
-#include <svtools/smplhint.hxx>
+#include <svl/poolitem.hxx> //Any2Bool
+#include <svl/smplhint.hxx>
#include <vos/mutex.hxx>
/* #100822# ----
diff --git a/svtools/source/config/extendedsecurityoptions.cxx b/svtools/source/config/extendedsecurityoptions.cxx
deleted file mode 100644
index 2f3c57ea4748..000000000000
--- a/svtools/source/config/extendedsecurityoptions.cxx
+++ /dev/null
@@ -1,541 +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: extendedsecurityoptions.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/extendedsecurityoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/wldcrd.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <svtools/pathoptions.hxx>
-
-#include <hash_map>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_SECURITY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Security"))
-
-#define SECURE_EXTENSIONS_SET OUString(RTL_CONSTASCII_USTRINGPARAM("SecureExtensions"))
-#define EXTENSION_PROPNAME OUString(RTL_CONSTASCII_USTRINGPARAM("/Extension"))
-
-#define PROPERTYNAME_HYPERLINKS_OPEN OUString(RTL_CONSTASCII_USTRINGPARAM("Hyperlinks/Open"))
-
-#define PROPERTYHANDLE_HYPERLINKS_OPEN 0
-
-#define PROPERTYCOUNT 1
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-struct OUStringHashCode
-{
- size_t operator()( const ::rtl::OUString& sString ) const
- {
- return sString.hashCode();
- }
-};
-
-class ExtensionHashMap : public ::std::hash_map< ::rtl::OUString,
- sal_Int32,
- OUStringHashCode,
- ::std::equal_to< ::rtl::OUString > >
-{
- public:
- inline void free()
- {
- ExtensionHashMap().swap( *this );
- }
-};
-
-class SvtExtendedSecurityOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtExtendedSecurityOptions_Impl();
- ~SvtExtendedSecurityOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short Access method to check for security problems
- @descr Different methods to check for security related problems.
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_Bool IsSecureHyperlink( const rtl::OUString& aURL ) const;
- Sequence< rtl::OUString > GetSecureExtensionList() const;
-
- SvtExtendedSecurityOptions::OpenHyperlinkMode GetOpenHyperlinkMode();
- void SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode aMode );
- sal_Bool IsOpenHyperlinkModeReadOnly() const;
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management.
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- static Sequence< OUString > GetPropertyNames();
-
- /*-****************************************************************************************************//**
- @short Fills the hash map with all extensions known to be secure
- @descr These methods fills the given hash map object with all extensions known to be secure.
-
- @seealso -
-
- @param aHashMap
- A hash map to be filled with secure extension strings.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
- void FillExtensionHashMap( ExtensionHashMap& aHashMap );
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
- OUString m_aSecureExtensionsSetName;
- OUString m_aExtensionPropName;
-
- SvtExtendedSecurityOptions::OpenHyperlinkMode m_eOpenHyperlinkMode;
- sal_Bool m_bROOpenHyperlinkMode;
- ExtensionHashMap m_aExtensionHashMap;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_SECURITY ),
- m_aSecureExtensionsSetName( SECURE_EXTENSIONS_SET ),
- m_aExtensionPropName( EXTENSION_PROPNAME ),
- m_bROOpenHyperlinkMode(sal_False)
- // Init member then.
-{
- // Fill the extension hash map with all secure extension strings
- FillExtensionHashMap( m_aExtensionHashMap );
-
- Sequence< OUString > seqNames = GetPropertyNames();
- Sequence< Any > seqValues = GetProperties( seqNames );
- Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames );
-
- sal_Int32 nPropertyCount = seqValues.getLength();
- for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- // Safe impossible cases.
- // Check any for valid value.
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()\nInvalid property value detected!\n" );
- switch( nProperty )
- {
- case PROPERTYHANDLE_HYPERLINKS_OPEN:
- {
- DBG_ASSERT( ( seqValues[nProperty].getValueTypeClass() == TypeClass_LONG ), "SvtExtendedSecurityOptions_Impl::SvtExtendedSecurityOptions_Impl()\nWho has changed the value type of 'Hyperlink/Open'?" );
-
- sal_Int32 nMode = SvtExtendedSecurityOptions::OPEN_WITHSECURITYCHECK;
- if ( seqValues[nProperty] >>= nMode )
- m_eOpenHyperlinkMode = (SvtExtendedSecurityOptions::OpenHyperlinkMode)nMode;
- else {
- DBG_ERROR("Wrong type for Open mode!");
- }
- m_bROOpenHyperlinkMode = seqRO[nProperty];
- }
- break;
- }
- }
-
- // Enable notification mechanism of our baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys!
- Sequence< OUString > seqNotifyNames( 1 );
- seqNotifyNames[0] = m_aSecureExtensionsSetName;
- EnableNotification( seqNotifyNames );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions_Impl::~SvtExtendedSecurityOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtExtendedSecurityOptions_Impl::Notify( const Sequence< OUString >& )
-{
- // Not implemented
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtExtendedSecurityOptions_Impl::Commit()
-{
- // Get names of supported properties, create a list for values and copy current values to it.
- Sequence< OUString > seqNames = GetPropertyNames ();
- sal_Int32 nCount = seqNames.getLength();
- Sequence< Any > seqValues ( nCount );
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_HYPERLINKS_OPEN: {
- seqValues[nProperty] <<= (sal_Int32)m_eOpenHyperlinkMode;
- }
- break;
- }
- }
-
- // Set properties in configuration.
- PutProperties( seqNames, seqValues );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtExtendedSecurityOptions_Impl::IsSecureHyperlink( const OUString& aURL ) const
-{
- INetURLObject aURLObject( aURL );
-
- String aExtension = aURLObject.getExtension();
- aExtension.ToLowerAscii();
-
- ExtensionHashMap::const_iterator pIter = m_aExtensionHashMap.find( aExtension );
- if ( pIter != m_aExtensionHashMap.end() )
- return sal_True;
- else
- return sal_False;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetSecureExtensionList() const
-{
- Sequence< OUString > aResult( m_aExtensionHashMap.size() );
-
- sal_Int32 nIndex = 0;
- for ( ExtensionHashMap::const_iterator pIter = m_aExtensionHashMap.begin();
- pIter != m_aExtensionHashMap.end(); pIter++ )
- {
- aResult[nIndex++] = pIter->first;
- }
-
- return aResult;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions_Impl::GetOpenHyperlinkMode()
-{
- return m_eOpenHyperlinkMode;
-}
-/* -----------------09.07.2003 11:26-----------------
-
- --------------------------------------------------*/
-sal_Bool SvtExtendedSecurityOptions_Impl::IsOpenHyperlinkModeReadOnly() const
-{
- return m_bROOpenHyperlinkMode;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtExtendedSecurityOptions_Impl::SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode eNewMode )
-{
- m_eOpenHyperlinkMode = eNewMode;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-void SvtExtendedSecurityOptions_Impl::FillExtensionHashMap( ExtensionHashMap& aHashMap )
-{
- // Get sequence with secure extensions from configuration
- Sequence< OUString > seqNodes = GetNodeNames( m_aSecureExtensionsSetName );
-
- OUString aValue;
- Sequence< Any > aValues;
- Sequence< OUString > aPropSeq( 1 );
- for ( int i = 0; i < seqNodes.getLength(); i++ )
- {
- // Create access name for property
- OUStringBuffer aExtEntryProp( m_aSecureExtensionsSetName );
- aExtEntryProp.appendAscii( "/" );
- aExtEntryProp.append( seqNodes[i] );
- aExtEntryProp.append( m_aExtensionPropName );
-
- aPropSeq[0] = aExtEntryProp.makeStringAndClear();
- aValues = GetProperties( aPropSeq );
- if ( aValues.getLength() == 1 )
- {
- // Don't use value if sequence has not the correct length
- if ( aValues[0] >>= aValue )
- // Add extension into secure extensions hash map
- aHashMap.insert( ExtensionHashMap::value_type( aValue.toAsciiLowerCase(), 1 ) );
- else
- {
- DBG_ERRORFILE( "SvtExtendedSecurityOptions_Impl::FillExtensionHashMap(): not string value?" );
- }
- }
- }
-}
-
-//*****************************************************************************************************************
-// private method (currently not used)
-//*****************************************************************************************************************
-Sequence< OUString > SvtExtendedSecurityOptions_Impl::GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_HYPERLINKS_OPEN
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions_Impl* SvtExtendedSecurityOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtExtendedSecurityOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions::SvtExtendedSecurityOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetInitMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtExtendedSecurityOptions_Impl::ctor()");
- m_pDataContainer = new SvtExtendedSecurityOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_EXTENDEDSECURITYOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions::~SvtExtendedSecurityOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetInitMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtExtendedSecurityOptions::IsSecureHyperlink( const rtl::OUString& aURL ) const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsSecureHyperlink( aURL );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< rtl::OUString > SvtExtendedSecurityOptions::GetSecureExtensionList() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->GetSecureExtensionList();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-SvtExtendedSecurityOptions::OpenHyperlinkMode SvtExtendedSecurityOptions::GetOpenHyperlinkMode()
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->GetOpenHyperlinkMode();
-}
-/* -----------------09.07.2003 11:26-----------------
-
- --------------------------------------------------*/
-sal_Bool SvtExtendedSecurityOptions::IsOpenHyperlinkModeReadOnly() const
-{
- return m_pDataContainer->IsOpenHyperlinkModeReadOnly();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtExtendedSecurityOptions::SetOpenHyperlinkMode( SvtExtendedSecurityOptions::OpenHyperlinkMode eMode )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetOpenHyperlinkMode( eMode );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtExtendedSecurityOptions::GetInitMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/fltrcfg.cxx b/svtools/source/config/fltrcfg.cxx
deleted file mode 100644
index 056826bf62ba..000000000000
--- a/svtools/source/config/fltrcfg.cxx
+++ /dev/null
@@ -1,611 +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: fltrcfg.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include "fltrcfg.hxx"
-#include <tools/debug.hxx>
-
-#include <rtl/logfile.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-
-#define C2U(cChar) OUString::createFromAscii(cChar)
-
-// -----------------------------------------------------------------------
-#define FILTERCFG_WORD_CODE 0x0001
-#define FILTERCFG_WORD_STORAGE 0x0002
-#define FILTERCFG_EXCEL_CODE 0x0004
-#define FILTERCFG_EXCEL_STORAGE 0x0008
-#define FILTERCFG_PPOINT_CODE 0x0010
-#define FILTERCFG_PPOINT_STORAGE 0x0020
-#define FILTERCFG_MATH_LOAD 0x0100
-#define FILTERCFG_MATH_SAVE 0x0200
-#define FILTERCFG_WRITER_LOAD 0x0400
-#define FILTERCFG_WRITER_SAVE 0x0800
-#define FILTERCFG_CALC_LOAD 0x1000
-#define FILTERCFG_CALC_SAVE 0x2000
-#define FILTERCFG_IMPRESS_LOAD 0x4000
-#define FILTERCFG_IMPRESS_SAVE 0x8000
-#define FILTERCFG_EXCEL_EXECTBL 0x10000
-#define FILTERCFG_ENABLE_PPT_PREVIEW 0x20000
-#define FILTERCFG_ENABLE_EXCEL_PREVIEW 0x40000
-#define FILTERCFG_ENABLE_WORD_PREVIEW 0x80000
-#define FILTERCFG_USE_ENHANCED_FIELDS 0x100000
-
-static SvtFilterOptions* pOptions=0;
-
-/* -----------------------------22.01.01 10:23--------------------------------
-
- ---------------------------------------------------------------------------*/
-class SvtAppFilterOptions_Impl : public utl::ConfigItem
-{
- sal_Bool bLoadVBA;
- sal_Bool bSaveVBA;
-public:
- SvtAppFilterOptions_Impl(const OUString& rRoot) :
- utl::ConfigItem(rRoot),
- bLoadVBA(sal_False),
- bSaveVBA(sal_False) {}
- ~SvtAppFilterOptions_Impl();
- virtual void Commit();
- void Load();
-
- sal_Bool IsLoad() const {return bLoadVBA;}
- void SetLoad(sal_Bool bSet)
- {
- if(bSet != bLoadVBA)
- SetModified();
- bLoadVBA = bSet;
- }
- sal_Bool IsSave() const {return bSaveVBA;}
- void SetSave(sal_Bool bSet)
- {
- if(bSet != bSaveVBA)
- SetModified();
- bSaveVBA = bSet;
- }
-};
-
-/* -----------------------------22.01.01 11:08--------------------------------
-
- ---------------------------------------------------------------------------*/
-SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl()
-{
- if(IsModified())
- Commit();
-}
-/* -----------------------------22.01.01 10:38--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SvtAppFilterOptions_Impl::Commit()
-{
- Sequence<OUString> aNames(2);
- OUString* pNames = aNames.getArray();
- pNames[0] = C2U("Load");
- pNames[1] = C2U("Save");
- Sequence<Any> aValues(aNames.getLength());
- Any* pValues = aValues.getArray();
-
- const Type& rType = ::getBooleanCppuType();
- pValues[0].setValue(&bLoadVBA, rType);
- pValues[1].setValue(&bSaveVBA, rType);
-
- PutProperties(aNames, aValues);
-}
-/* -----------------------------22.01.01 10:38--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SvtAppFilterOptions_Impl::Load()
-{
- Sequence<OUString> aNames(2);
- OUString* pNames = aNames.getArray();
- pNames[0] = C2U("Load");
- pNames[1] = C2U("Save");
-
- Sequence<Any> aValues = GetProperties(aNames);
- const Any* pValues = aValues.getConstArray();
-
- if(pValues[0].hasValue())
- bLoadVBA = *(sal_Bool*)pValues[0].getValue();
- if(pValues[1].hasValue())
- bSaveVBA = *(sal_Bool*)pValues[1].getValue();
-}
-
-// -----------------------------------------------------------------------
-class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl
-{
- sal_Bool bLoadExecutable;
-public:
- SvtCalcFilterOptions_Impl(const OUString& rRoot) :
- SvtAppFilterOptions_Impl(rRoot),
- bLoadExecutable(sal_False)
- {}
- virtual void Commit();
- void Load();
-
- sal_Bool IsLoadExecutable() const {return bLoadExecutable;}
- void SetLoadExecutable(sal_Bool bSet)
- {
- if(bSet != bLoadExecutable)
- SetModified();
- bLoadExecutable = bSet;
- }
-};
-
-void SvtCalcFilterOptions_Impl::Commit()
-{
- SvtAppFilterOptions_Impl::Commit();
-
- Sequence<OUString> aNames(1);
- aNames[0] = C2U("Executable");
- Sequence<Any> aValues(1);
- aValues[0] <<= bLoadExecutable;
-
- PutProperties(aNames, aValues);
-}
-
-void SvtCalcFilterOptions_Impl::Load()
-{
- SvtAppFilterOptions_Impl::Load();
-
- Sequence<OUString> aNames(1);
- aNames[0] = C2U("Executable");
-
- Sequence<Any> aValues = GetProperties(aNames);
- const Any* pValues = aValues.getConstArray();
- if(pValues[0].hasValue())
- bLoadExecutable = *(sal_Bool*)pValues[0].getValue();
-}
-
-/* -----------------------------22.01.01 10:32--------------------------------
-
- ---------------------------------------------------------------------------*/
-struct SvtFilterOptions_Impl
-{
- ULONG nFlags;
- SvtAppFilterOptions_Impl aWriterCfg;
- SvtCalcFilterOptions_Impl aCalcCfg;
- SvtAppFilterOptions_Impl aImpressCfg;
-
- SvtFilterOptions_Impl() :
- aWriterCfg(C2U("Office.Writer/Filter/Import/VBA")),
- aCalcCfg(C2U("Office.Calc/Filter/Import/VBA")),
- aImpressCfg(C2U("Office.Impress/Filter/Import/VBA"))
- {
- nFlags = FILTERCFG_WORD_CODE |
- FILTERCFG_WORD_STORAGE |
- FILTERCFG_EXCEL_CODE |
- FILTERCFG_EXCEL_STORAGE |
- FILTERCFG_PPOINT_CODE |
- FILTERCFG_PPOINT_STORAGE |
- FILTERCFG_MATH_LOAD |
- FILTERCFG_MATH_SAVE |
- FILTERCFG_WRITER_LOAD |
- FILTERCFG_WRITER_SAVE |
- FILTERCFG_CALC_LOAD |
- FILTERCFG_CALC_SAVE |
- FILTERCFG_IMPRESS_LOAD |
- FILTERCFG_IMPRESS_SAVE |
- FILTERCFG_USE_ENHANCED_FIELDS;
- Load();
- }
-
- void SetFlag( ULONG nFlag, BOOL bSet );
- BOOL IsFlag( ULONG nFlag ) const;
- void Load()
- {
- aWriterCfg.Load();
- aCalcCfg.Load();
- aImpressCfg.Load();
- }
-};
-/* -----------------------------22.01.01 10:34--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SvtFilterOptions_Impl::SetFlag( ULONG nFlag, BOOL bSet )
-{
- switch(nFlag)
- {
- case FILTERCFG_WORD_CODE: aWriterCfg.SetLoad(bSet);break;
- case FILTERCFG_WORD_STORAGE: aWriterCfg.SetSave(bSet);break;
- case FILTERCFG_EXCEL_CODE: aCalcCfg.SetLoad(bSet);break;
- case FILTERCFG_EXCEL_STORAGE: aCalcCfg.SetSave(bSet);break;
- case FILTERCFG_EXCEL_EXECTBL: aCalcCfg.SetLoadExecutable(bSet);break;
- case FILTERCFG_PPOINT_CODE: aImpressCfg.SetLoad(bSet);break;
- case FILTERCFG_PPOINT_STORAGE: aImpressCfg.SetSave(bSet);break;
- default:
- if( bSet )
- nFlags |= nFlag;
- else
- nFlags &= ~nFlag;
- }
-}
-/* -----------------------------22.01.01 10:35--------------------------------
-
- ---------------------------------------------------------------------------*/
-BOOL SvtFilterOptions_Impl::IsFlag( ULONG nFlag ) const
-{
- BOOL bRet;
- switch(nFlag)
- {
- case FILTERCFG_WORD_CODE : bRet = aWriterCfg.IsLoad();break;
- case FILTERCFG_WORD_STORAGE : bRet = aWriterCfg.IsSave();break;
- case FILTERCFG_EXCEL_CODE : bRet = aCalcCfg.IsLoad();break;
- case FILTERCFG_EXCEL_STORAGE : bRet = aCalcCfg.IsSave();break;
- case FILTERCFG_EXCEL_EXECTBL : bRet = aCalcCfg.IsLoadExecutable();break;
- case FILTERCFG_PPOINT_CODE : bRet = aImpressCfg.IsLoad();break;
- case FILTERCFG_PPOINT_STORAGE : bRet = aImpressCfg.IsSave();break;
- default:
- bRet = 0 != (nFlags & nFlag );
- }
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-SvtFilterOptions::SvtFilterOptions() :
- ConfigItem( C2U("Office.Common/Filter/Microsoft") ),
- pImp(new SvtFilterOptions_Impl)
-{
- RTL_LOGFILE_CONTEXT(aLog, "svtools SvtFilterOptions::SvtFilterOptions()");
- EnableNotification(GetPropertyNames());
- Load();
-}
-// -----------------------------------------------------------------------
-SvtFilterOptions::~SvtFilterOptions()
-{
- delete pImp;
-}
-/* -----------------------------22.01.01 08:45--------------------------------
-
- ---------------------------------------------------------------------------*/
-const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
-{
- static Sequence<OUString> aNames;
- if(!aNames.getLength())
- {
- int nCount = 12;
- aNames.realloc(nCount);
- static const char* aPropNames[] =
- {
- "Import/MathTypeToMath", // 0
- "Import/WinWordToWriter", // 1
- "Import/PowerPointToImpress", // 2
- "Import/ExcelToCalc", // 3
- "Export/MathToMathType", // 4
- "Export/WriterToWinWord", // 5
- "Export/ImpressToPowerPoint", // 6
- "Export/CalcToExcel", // 7
- "Export/EnablePowerPointPreview", // 8
- "Export/EnableExcelPreview", // 9
- "Export/EnableWordPreview", // 10
- "Import/ImportWWFieldsAsEnhancedFields" // 11
- };
- OUString* pNames = aNames.getArray();
- for(int i = 0; i < nCount; i++)
- pNames[i] = C2U(aPropNames[i]);
- }
- return aNames;
-}
-//-----------------------------------------------------------------------
-static ULONG lcl_GetFlag(sal_Int32 nProp)
-{
- ULONG nFlag = 0;
- switch(nProp)
- {
- case 0: nFlag = FILTERCFG_MATH_LOAD; break;
- case 1: nFlag = FILTERCFG_WRITER_LOAD; break;
- case 2: nFlag = FILTERCFG_IMPRESS_LOAD; break;
- case 3: nFlag = FILTERCFG_CALC_LOAD; break;
- case 4: nFlag = FILTERCFG_MATH_SAVE; break;
- case 5: nFlag = FILTERCFG_WRITER_SAVE; break;
- case 6: nFlag = FILTERCFG_IMPRESS_SAVE; break;
- case 7: nFlag = FILTERCFG_CALC_SAVE; break;
- case 8: nFlag = FILTERCFG_ENABLE_PPT_PREVIEW; break;
- case 9: nFlag = FILTERCFG_ENABLE_EXCEL_PREVIEW; break;
- case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break;
- case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break;
-
- default: DBG_ERROR("illegal value");
- }
- return nFlag;
-}
-/*-- 22.01.01 08:53:03---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtFilterOptions::Notify( const Sequence<OUString>& )
-{
- Load();
-}
-/*-- 22.01.01 08:53:04---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtFilterOptions::Commit()
-{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues(aNames.getLength());
- Any* pValues = aValues.getArray();
-
- const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- ULONG nFlag = lcl_GetFlag(nProp);
- sal_Bool bVal = pImp->IsFlag( nFlag);
- pValues[nProp].setValue(&bVal, rType);
-
- }
- PutProperties(aNames, aValues);
-}
-/*-- 22.01.01 08:53:04---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtFilterOptions::Load()
-{
- pImp->Load();
- const Sequence<OUString>& rNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(rNames);
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == rNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == rNames.getLength())
- {
- for(int nProp = 0; nProp < rNames.getLength(); nProp++)
- {
- if(pValues[nProp].hasValue())
- {
- sal_Bool bVal = *(sal_Bool*)pValues[nProp].getValue();
- ULONG nFlag = lcl_GetFlag(nProp);
- pImp->SetFlag( nFlag, bVal);
- }
- }
- }
-}
-// -----------------------------------------------------------------------
-
-void SvtFilterOptions::SetLoadWordBasicCode( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_WORD_CODE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadWordBasicCode() const
-{
- return pImp->IsFlag( FILTERCFG_WORD_CODE );
-}
-
-void SvtFilterOptions::SetLoadWordBasicStorage( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_WORD_STORAGE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadWordBasicStorage() const
-{
- return pImp->IsFlag( FILTERCFG_WORD_STORAGE );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtFilterOptions::SetLoadExcelBasicCode( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_EXCEL_CODE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadExcelBasicCode() const
-{
- return pImp->IsFlag( FILTERCFG_EXCEL_CODE );
-}
-
-void SvtFilterOptions::SetLoadExcelBasicExecutable( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_EXCEL_EXECTBL, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadExcelBasicExecutable() const
-{
- return pImp->IsFlag( FILTERCFG_EXCEL_EXECTBL );
-}
-
-void SvtFilterOptions::SetLoadExcelBasicStorage( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_EXCEL_STORAGE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadExcelBasicStorage() const
-{
- return pImp->IsFlag( FILTERCFG_EXCEL_STORAGE );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtFilterOptions::SetLoadPPointBasicCode( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_PPOINT_CODE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadPPointBasicCode() const
-{
- return pImp->IsFlag( FILTERCFG_PPOINT_CODE );
-}
-
-void SvtFilterOptions::SetLoadPPointBasicStorage( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_PPOINT_STORAGE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsLoadPPointBasicStorage() const
-{
- return pImp->IsFlag( FILTERCFG_PPOINT_STORAGE );
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SvtFilterOptions::IsMathType2Math() const
-{
- return pImp->IsFlag( FILTERCFG_MATH_LOAD );
-}
-
-void SvtFilterOptions::SetMathType2Math( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_MATH_LOAD, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsMath2MathType() const
-{
- return pImp->IsFlag( FILTERCFG_MATH_SAVE );
-}
-
-void SvtFilterOptions::SetMath2MathType( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_MATH_SAVE, bFlag );
- SetModified();
-}
-
-
-// -----------------------------------------------------------------------
-BOOL SvtFilterOptions::IsWinWord2Writer() const
-{
- return pImp->IsFlag( FILTERCFG_WRITER_LOAD );
-}
-
-void SvtFilterOptions::SetWinWord2Writer( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_WRITER_LOAD, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsWriter2WinWord() const
-{
- return pImp->IsFlag( FILTERCFG_WRITER_SAVE );
-}
-
-void SvtFilterOptions::SetWriter2WinWord( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_WRITER_SAVE, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsUseEnhancedFields() const
-{
- return false; // disable for now;
-// return pImp->IsFlag( FILTERCFG_USE_ENHANCED_FIELDS );
-}
-
-void SvtFilterOptions::SetUseEnhancedFields( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_USE_ENHANCED_FIELDS, bFlag );
- SetModified();
-}
-
-// -----------------------------------------------------------------------
-BOOL SvtFilterOptions::IsExcel2Calc() const
-{
- return pImp->IsFlag( FILTERCFG_CALC_LOAD );
-}
-
-void SvtFilterOptions::SetExcel2Calc( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_CALC_LOAD, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsCalc2Excel() const
-{
- return pImp->IsFlag( FILTERCFG_CALC_SAVE );
-}
-
-void SvtFilterOptions::SetCalc2Excel( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_CALC_SAVE, bFlag );
- SetModified();
-}
-
-
-// -----------------------------------------------------------------------
-BOOL SvtFilterOptions::IsPowerPoint2Impress() const
-{
- return pImp->IsFlag( FILTERCFG_IMPRESS_LOAD );
-}
-
-void SvtFilterOptions::SetPowerPoint2Impress( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_IMPRESS_LOAD, bFlag );
- SetModified();
-}
-
-BOOL SvtFilterOptions::IsImpress2PowerPoint() const
-{
- return pImp->IsFlag( FILTERCFG_IMPRESS_SAVE );
-}
-
-void SvtFilterOptions::SetImpress2PowerPoint( BOOL bFlag )
-{
- pImp->SetFlag( FILTERCFG_IMPRESS_SAVE, bFlag );
- SetModified();
-}
-
-SvtFilterOptions* SvtFilterOptions::Get()
-{
- if ( !pOptions )
- pOptions = new SvtFilterOptions;
- return pOptions;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SvtFilterOptions::IsEnablePPTPreview() const
-{
- return pImp->IsFlag( FILTERCFG_ENABLE_PPT_PREVIEW );
-}
-
-
-BOOL SvtFilterOptions::IsEnableCalcPreview() const
-{
- return pImp->IsFlag( FILTERCFG_ENABLE_EXCEL_PREVIEW );
-}
-
-
-BOOL SvtFilterOptions::IsEnableWordPreview() const
-{
- return pImp->IsFlag( FILTERCFG_ENABLE_WORD_PREVIEW );
-}
-
-
diff --git a/svtools/source/config/fontoptions.cxx b/svtools/source/config/fontoptions.cxx
deleted file mode 100644
index 1044344ff567..000000000000
--- a/svtools/source/config/fontoptions.cxx
+++ /dev/null
@@ -1,514 +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: fontoptions.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/fontoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_FONT OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Font" ))
-
-#define PROPERTYNAME_REPLACEMENTTABLE OUString(RTL_CONSTASCII_USTRINGPARAM("Substitution/Replacement" ))
-#define PROPERTYNAME_FONTHISTORY OUString(RTL_CONSTASCII_USTRINGPARAM("View/History" ))
-#define PROPERTYNAME_FONTWYSIWYG OUString(RTL_CONSTASCII_USTRINGPARAM("View/ShowFontBoxWYSIWYG" ))
-
-#define PROPERTYHANDLE_REPLACEMENTTABLE 0
-#define PROPERTYHANDLE_FONTHISTORY 1
-#define PROPERTYHANDLE_FONTWYSIWYG 2
-
-#define PROPERTYCOUNT 3
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-class SvtFontOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtFontOptions_Impl();
- ~SvtFontOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These method give us a chance to regulate acces to ouer internal values.
- It's not used in the moment - but it's possible for the feature!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_Bool IsReplacementTableEnabled ( ) const ;
- void EnableReplacementTable ( sal_Bool bState ) ;
-
- sal_Bool IsFontHistoryEnabled ( ) const ;
- void EnableFontHistory ( sal_Bool bState ) ;
-
- sal_Bool IsFontWYSIWYGEnabled ( ) const ;
- void EnableFontWYSIWYG ( sal_Bool bState ) ;
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management.
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- static Sequence< OUString > impl_GetPropertyNames();
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- sal_Bool m_bReplacementTable ;
- sal_Bool m_bFontHistory ;
- sal_Bool m_bFontWYSIWYG ;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtFontOptions_Impl::SvtFontOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_FONT )
- // Init member then.
- , m_bReplacementTable ( sal_False )
- , m_bFontHistory ( sal_False )
- , m_bFontWYSIWYG ( sal_False )
-{
- // Use our static list of configuration keys to get his values.
- Sequence< OUString > seqNames = impl_GetPropertyNames ( );
- Sequence< Any > seqValues = GetProperties ( seqNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- // Safe impossible cases.
- // Check any for valid value.
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nInvalid property value detected!\n" );
- switch( nProperty )
- {
- case PROPERTYHANDLE_REPLACEMENTTABLE : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\Substitution\\Replacement\"?" );
- seqValues[nProperty] >>= m_bReplacementTable;
- }
- break;
- case PROPERTYHANDLE_FONTHISTORY : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\View\\History\"?" );
- seqValues[nProperty] >>= m_bFontHistory;
- }
- break;
- case PROPERTYHANDLE_FONTWYSIWYG : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::SvtFontOptions_Impl()\nWho has changed the value type of \"Office.Common\\Font\\View\\ShowFontBoxWYSIWYG\"?" );
- seqValues[nProperty] >>= m_bFontWYSIWYG;
- }
- break;
- }
- }
-
- // Enable notification mechanism of ouer baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys!
- EnableNotification( seqNames );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtFontOptions_Impl::~SvtFontOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
-{
- // Use given list of updated properties to get his values from configuration directly!
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- // Safe impossible cases.
- // We need values from ALL notified configuration keys.
- DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtFontOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
- // Step over list of property names and get right value from coreesponding value list to set it on internal members!
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- if( seqPropertyNames[nProperty] == PROPERTYNAME_REPLACEMENTTABLE )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\Substitution\\Replacement\"?" );
- seqValues[nProperty] >>= m_bReplacementTable;
- }
- else
- if( seqPropertyNames[nProperty] == PROPERTYNAME_FONTHISTORY )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\View\\History\"?" );
- seqValues[nProperty] >>= m_bFontHistory;
- }
- else
- if( seqPropertyNames[nProperty] == PROPERTYNAME_FONTWYSIWYG )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtFontOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Font\\View\\ShowFontBoxWYSIWYG\"?" );
- seqValues[nProperty] >>= m_bFontWYSIWYG;
- }
- #if OSL_DEBUG_LEVEL > 1
- else DBG_ASSERT( sal_False, "SvtFontOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" );
- #endif
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions_Impl::Commit()
-{
- // Get names of supported properties, create a list for values and copy current values to it.
- Sequence< OUString > seqNames = impl_GetPropertyNames();
- sal_Int32 nCount = seqNames.getLength();
- Sequence< Any > seqValues ( nCount );
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_REPLACEMENTTABLE : {
- seqValues[nProperty] <<= m_bReplacementTable;
- }
- break;
- case PROPERTYHANDLE_FONTHISTORY : {
- seqValues[nProperty] <<= m_bFontHistory;
- }
- break;
- case PROPERTYHANDLE_FONTWYSIWYG : {
- seqValues[nProperty] <<= m_bFontWYSIWYG;
- }
- break;
- }
- }
- // Set properties in configuration.
- PutProperties( seqNames, seqValues );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtFontOptions_Impl::IsReplacementTableEnabled() const
-{
- return m_bReplacementTable;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions_Impl::EnableReplacementTable( sal_Bool bState )
-{
- m_bReplacementTable = bState;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtFontOptions_Impl::IsFontHistoryEnabled() const
-{
- return m_bFontHistory;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions_Impl::EnableFontHistory( sal_Bool bState )
-{
- m_bFontHistory = bState;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtFontOptions_Impl::IsFontWYSIWYGEnabled() const
-{
- return m_bFontWYSIWYG;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions_Impl::EnableFontWYSIWYG( sal_Bool bState )
-{
- m_bFontWYSIWYG = bState;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtFontOptions_Impl::impl_GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_REPLACEMENTTABLE ,
- PROPERTYNAME_FONTHISTORY ,
- PROPERTYNAME_FONTWYSIWYG ,
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtFontOptions_Impl* SvtFontOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtFontOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtFontOptions::SvtFontOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtFontOptions_Impl::ctor()");
- m_pDataContainer = new SvtFontOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_FONTOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtFontOptions::~SvtFontOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtFontOptions::IsReplacementTableEnabled() const
-{
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsReplacementTableEnabled();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions::EnableReplacementTable( sal_Bool bState )
-{
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->EnableReplacementTable( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtFontOptions::IsFontHistoryEnabled() const
-{
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsFontHistoryEnabled();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions::EnableFontHistory( sal_Bool bState )
-{
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->EnableFontHistory( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtFontOptions::IsFontWYSIWYGEnabled() const
-{
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsFontWYSIWYGEnabled();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtFontOptions::EnableFontWYSIWYG( sal_Bool bState )
-{
- MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->EnableFontWYSIWYG( bState );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtFontOptions::impl_GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/fontsubstconfig.cxx b/svtools/source/config/fontsubstconfig.cxx
index 8fe799dec67a..dc9bfa64e6d4 100644
--- a/svtools/source/config/fontsubstconfig.cxx
+++ b/svtools/source/config/fontsubstconfig.cxx
@@ -31,13 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
#include "fontsubstconfig.hxx"
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
@@ -129,6 +124,10 @@ SvtFontSubstConfig::~SvtFontSubstConfig()
/*-- 18.01.01 12:08:00---------------------------------------------------
-----------------------------------------------------------------------*/
+void SvtFontSubstConfig::Notify( const com::sun::star::uno::Sequence< rtl::OUString >& )
+{
+}
+
void SvtFontSubstConfig::Commit()
{
Sequence<OUString> aNames(1);
diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index 0ca09c176072..16982a695e11 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
#include <svtools/helpopt.hxx>
#include <unotools/configmgr.hxx>
#include <unotools/configitem.hxx>
diff --git a/svtools/source/config/historyoptions.cxx b/svtools/source/config/historyoptions.cxx
deleted file mode 100644
index 758753df0e4e..000000000000
--- a/svtools/source/config/historyoptions.cxx
+++ /dev/null
@@ -1,748 +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: historyoptions.cxx,v $
- * $Revision: 1.21.234.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/historyoptions.hxx>
-#include "configitems/historyoptions_const.hxx"
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#ifndef __SGI_STL_DEQUE
-#include <deque>
-#endif
-
-#ifndef __SGI_STL_ALGORITHM
-#include <algorithm>
-#endif
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
-#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
-#include <com/sun/star/container/XNameAccess.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
-#include <com/sun/star/container/XNameContainer.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#endif
-
-#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
-#include <comphelper/configurationhelper.hxx>
-#endif
-
-#ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
-#include <unotools/processfactory.hxx>
-#endif
-
-#ifndef _SVT_LOGHELPER_HXX
-#include "loghelper.hxx"
-#endif
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::std ;
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::beans ;
-
-namespace css = ::com::sun::star;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-namespace {
- static const ::sal_Int32 s_nOffsetURL = 0;
- static const ::sal_Int32 s_nOffsetFilter = 1;
- static const ::sal_Int32 s_nOffsetTitle = 2;
- static const ::sal_Int32 s_nOffsetPassword = 3;
-}
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-struct IMPL_THistoryItem
-{
- IMPL_THistoryItem()
- {
- }
-
- IMPL_THistoryItem( const OUString& sNewURL ,
- const OUString& sNewFilter ,
- const OUString& sNewTitle ,
- const OUString& sNewPassword )
- {
- sURL = sNewURL ;
- sFilter = sNewFilter ;
- sTitle = sNewTitle ;
- sPassword = sNewPassword ;
- }
-
- sal_Bool operator==( const OUString& sSearchedURL )
- {
- return( sURL == sSearchedURL );
- }
-
- OUString sURL ;
- OUString sFilter ;
- OUString sTitle ;
- OUString sPassword ;
-};
-
-//*****************************************************************************************************************
-// class SvtHistoryOptions_Impl
-// redesigned
-//*****************************************************************************************************************
-class SvtHistoryOptions_Impl
-{
-public:
- SvtHistoryOptions_Impl();
- ~SvtHistoryOptions_Impl();
-
- sal_uInt32 GetSize( EHistoryType eHistory );
- void SetSize( EHistoryType eHistory, sal_uInt32 nSize );
- void Clear( EHistoryType eHistory );
- Sequence< Sequence< PropertyValue > > GetList( EHistoryType eHistory );
- void AppendItem( EHistoryType eHistory ,
- const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTitle ,
- const OUString& sPassword );
-
-private:
- void impl_truncateList (EHistoryType eHistory, sal_uInt32 nSize);
-
-private:
- css::uno::Reference< css::container::XNameAccess > m_xCfg;
- css::uno::Reference< css::container::XNameAccess > m_xCommonXCU;
-};
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtHistoryOptions_Impl::SvtHistoryOptions_Impl()
-{
- try
- {
- m_xCfg = Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig(
- utl::getProcessServiceFactory(),
- s_sHistories,
- ::comphelper::ConfigurationHelper::E_STANDARD),
- css::uno::UNO_QUERY );
-
- m_xCommonXCU = Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig(
- utl::getProcessServiceFactory(),
- s_sCommonHistory,
- ::comphelper::ConfigurationHelper::E_STANDARD),
- css::uno::UNO_QUERY );
- }
- catch(const css::uno::Exception& ex)
- {
- m_xCfg.clear();
- m_xCommonXCU.clear();
-
- LogHelper::logIt(ex);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtHistoryOptions_Impl::~SvtHistoryOptions_Impl()
-{
-}
-
-//*****************************************************************************************************************
-// public method
-// Attention: We return the max. size of our internal lists - That is the capacity not the size!
-//*****************************************************************************************************************
-sal_uInt32 SvtHistoryOptions_Impl::GetSize( EHistoryType eHistory )
-{
- sal_uInt32 nSize = 0 ;
- css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY);
-
- try
- {
- switch( eHistory )
- {
- case ePICKLIST:
- xListAccess->getPropertyValue(s_sPickListSize) >>= nSize;
- break;
-
- case eHISTORY:
- xListAccess->getPropertyValue(s_sURLHistorySize) >>= nSize;
- break;
-
- case eHELPBOOKMARKS:
- xListAccess->getPropertyValue(s_sHelpBookmarksSize) >>= nSize;
- break;
-
- default:
- break;
- }
- }
- catch(const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-
- return nSize;
-}
-
-//*****************************************************************************************************************
-// public method
-// Attention: We return the max. size of our internal lists - That is the capacity not the size!
-//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::SetSize( EHistoryType eHistory, sal_uInt32 nSize )
-{
- css::uno::Reference< css::beans::XPropertySet > xListAccess(m_xCommonXCU, css::uno::UNO_QUERY);
- if (! xListAccess.is ())
- return;
-
- try
- {
- switch( eHistory )
- {
- case ePICKLIST:
- if(nSize!=GetSize(ePICKLIST))
- {
- xListAccess->setPropertyValue(s_sPickListSize, css::uno::makeAny(nSize));
- ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
- }
- break;
-
- case eHISTORY:
- if(nSize!=GetSize(eHISTORY))
- {
- xListAccess->setPropertyValue(s_sURLHistorySize, css::uno::makeAny(nSize));
- ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
- }
- break;
-
- case eHELPBOOKMARKS:
- if(nSize!=GetSize(eHELPBOOKMARKS))
- {
- xListAccess->setPropertyValue(s_sHelpBookmarksSize, css::uno::makeAny(nSize));
- ::comphelper::ConfigurationHelper::flush(m_xCommonXCU);
- }
- break;
-
- default:
- break;
- }
-
- impl_truncateList (eHistory, nSize);
- }
- catch(const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::impl_truncateList ( EHistoryType eHistory, sal_uInt32 nSize )
-{
- css::uno::Reference< css::container::XNameAccess > xList;
- css::uno::Reference< css::container::XNameContainer > xItemList;
- css::uno::Reference< css::container::XNameContainer > xOrderList;
- css::uno::Reference< css::beans::XPropertySet > xSet;
-
- try
- {
- switch( eHistory )
- {
- case ePICKLIST:
- m_xCfg->getByName(s_sPickList) >>= xList;
- break;
-
- case eHISTORY:
- m_xCfg->getByName(s_sURLHistory) >>= xList;
- break;
-
- case eHELPBOOKMARKS:
- m_xCfg->getByName(s_sHelpBookmarks) >>= xList;
- break;
-
- default:
- break;
- }
-
- // If too much items in current list ...
- // truncate the oldest items BEFORE you set the new one.
- if ( ! xList.is())
- return;
-
- xList->getByName(s_sOrderList) >>= xOrderList;
- xList->getByName(s_sItemList) >>= xItemList;
-
- const sal_uInt32 nLength = xOrderList->getElementNames().getLength();
- if (nSize < nLength)
- {
- for (sal_uInt32 i=nLength-1; i>=nSize; --i)
- {
- ::rtl::OUString sTmp;
- const ::rtl::OUString sRemove = ::rtl::OUString::valueOf((sal_Int32)i);
- xOrderList->getByName(sRemove) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
- xItemList->removeByName(sTmp);
- xOrderList->removeByName(sRemove);
- }
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- }
- catch(const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-//*****************************************************************************************************************
-// public method
-// Clear specified history list
-//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::Clear( EHistoryType eHistory )
-{
- css::uno::Reference< css::container::XNameAccess > xListAccess;
- css::uno::Reference< css::container::XNameContainer > xNode;
- Sequence< ::rtl::OUString > lOrders;
-
- try
- {
- switch( eHistory )
- {
- case ePICKLIST:
- {
- m_xCfg->getByName(s_sPickList) >>= xListAccess;
- break;
- }
-
- case eHISTORY:
- {
- m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
- break;
- }
-
- case eHELPBOOKMARKS:
- {
- m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
- break;
- }
-
- default:
- break;
- }
-
- if (xListAccess.is())
- {
- // clear ItemList
- xListAccess->getByName(s_sItemList) >>= xNode ;
- lOrders = xNode->getElementNames();
- const sal_Int32 nLength = lOrders.getLength();
- for(sal_Int32 i=0; i<nLength; ++i)
- xNode->removeByName(lOrders[i]);
-
- // clear OrderList
- xListAccess->getByName(s_sOrderList) >>= xNode ;
- lOrders = xNode->getElementNames();
- for(sal_Int32 j=0; j<nLength; ++j)
- xNode->removeByName(lOrders[j]);
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- }
- catch(const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-//*****************************************************************************************************************
-// public method
-// get a sequence list from the items
-//*****************************************************************************************************************
-Sequence< Sequence< PropertyValue > > SvtHistoryOptions_Impl::GetList( EHistoryType eHistory )
-{
- impl_truncateList (eHistory, GetSize (eHistory));
-
- Sequence< Sequence< PropertyValue > > seqReturn; // Set default return value.
- Sequence< PropertyValue > seqProperties( 4 );
- Sequence< ::rtl::OUString > lOrders;
-
- css::uno::Reference< css::container::XNameAccess > xListAccess;
- css::uno::Reference< css::container::XNameAccess > xItemList;
- css::uno::Reference< css::container::XNameAccess > xOrderList;
- css::uno::Reference< css::beans::XPropertySet > xSet;
-
- seqProperties[s_nOffsetURL ].Name = HISTORY_PROPERTYNAME_URL;
- seqProperties[s_nOffsetFilter ].Name = HISTORY_PROPERTYNAME_FILTER;
- seqProperties[s_nOffsetTitle ].Name = HISTORY_PROPERTYNAME_TITLE;
- seqProperties[s_nOffsetPassword ].Name = HISTORY_PROPERTYNAME_PASSWORD;
-
- try
- {
- switch( eHistory )
- {
- case ePICKLIST:
- {
- m_xCfg->getByName(s_sPickList) >>= xListAccess;
- break;
- }
-
- case eHISTORY:
- {
- m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
- break;
- }
-
- case eHELPBOOKMARKS:
- {
- m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
- break;
- }
-
- default:
- break;
- }
-
- if (xListAccess.is())
- {
- xListAccess->getByName(s_sItemList) >>= xItemList;
- xListAccess->getByName(s_sOrderList) >>= xOrderList;
-
- const sal_Int32 nLength = xOrderList->getElementNames().getLength();
- Sequence< Sequence< PropertyValue > > aRet(nLength);
-
- for(sal_Int32 nItem=0; nItem<nLength; ++nItem)
- {
- ::rtl::OUString sUrl;
- xOrderList->getByName(::rtl::OUString::valueOf(nItem)) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sUrl;
-
- xItemList->getByName(sUrl) >>= xSet;
- seqProperties[s_nOffsetURL ].Value <<= sUrl;
- xSet->getPropertyValue(s_sFilter) >>= seqProperties[s_nOffsetFilter ].Value;
- xSet->getPropertyValue(s_sTitle) >>= seqProperties[s_nOffsetTitle ].Value;
- xSet->getPropertyValue(s_sPassword) >>= seqProperties[s_nOffsetPassword ].Value;
- aRet[nItem] = seqProperties;
- }
- seqReturn = aRet;
- }
- }
- catch(const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-
- return seqReturn;
-}
-
-//*****************************************************************************************************************
-// public method
-// implements a deque in XML
-//*****************************************************************************************************************
-void SvtHistoryOptions_Impl::AppendItem( EHistoryType eHistory ,
- const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTitle ,
- const OUString& sPassword )
-{
- impl_truncateList (eHistory, GetSize (eHistory));
-
- css::uno::Reference< css::container::XNameAccess > xListAccess;
- sal_Int32 nMaxSize = 0;
-
- switch(eHistory)
- {
- case ePICKLIST:
- {
- m_xCfg->getByName(s_sPickList) >>= xListAccess;
- nMaxSize = GetSize(ePICKLIST);
- }
- break;
- case eHISTORY:
- {
- m_xCfg->getByName(s_sURLHistory) >>= xListAccess;
- nMaxSize = GetSize(eHISTORY);
- }
- break;
- case eHELPBOOKMARKS:
- {
- m_xCfg->getByName(s_sHelpBookmarks) >>= xListAccess;
- nMaxSize = GetSize(eHELPBOOKMARKS);
- }
- break;
- default:
- break;
- }
-
- if (nMaxSize==0)
- return;
-
- css::uno::Reference< css::container::XNameContainer > xItemList;
- css::uno::Reference< css::container::XNameContainer > xOrderList;
- css::uno::Reference< css::beans::XPropertySet > xSet;
-
- try
- {
- xListAccess->getByName(s_sItemList) >>= xItemList;
- xListAccess->getByName(s_sOrderList) >>= xOrderList;
- sal_Int32 nLength = xOrderList->getElementNames().getLength();
-
- // The item to be appended is already existing!
- if (xItemList->hasByName(sURL))
- {
- for (sal_Int32 i=0; i<nLength; ++i)
- {
- ::rtl::OUString sTmp;
- xOrderList->getByName(::rtl::OUString::valueOf(i)) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sTmp;
-
- if(sURL == sTmp)
- {
- ::rtl::OUString sFind;
- xOrderList->getByName( ::rtl::OUString::valueOf(i) ) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sFind;
- for (sal_Int32 j=i-1; j>=0; --j)
- {
- css::uno::Reference< css::beans::XPropertySet > xPrevSet;
- css::uno::Reference< css::beans::XPropertySet > xNextSet;
- xOrderList->getByName( ::rtl::OUString::valueOf(j+1) ) >>= xPrevSet;
- xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xNextSet;
-
- ::rtl::OUString sTemp;
- xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp;
- xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp));
- }
- xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet;
- xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sFind));
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- break;
- }
- }
- }
-
- // The item to be appended is not existing!
- else
- {
- css::uno::Reference< css::lang::XSingleServiceFactory > xFac;
- css::uno::Reference< css::uno::XInterface > xInst;
- css::uno::Reference< css::beans::XPropertySet > xPrevSet;
- css::uno::Reference< css::beans::XPropertySet > xNextSet;
-
- // Append new item to OrderList.
- if ( nLength == nMaxSize )
- {
- ::rtl::OUString sRemove;
- xOrderList->getByName(::rtl::OUString::valueOf(nLength-1)) >>= xSet;
- xSet->getPropertyValue(s_sHistoryItemRef) >>= sRemove;
- xItemList->removeByName(sRemove);
- }
- if ( nLength != nMaxSize )
- {
- xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xOrderList, css::uno::UNO_QUERY);
- xInst = xFac->createInstance();
- ::rtl::OUString sPush = ::rtl::OUString::valueOf(nLength++);
- xOrderList->insertByName(sPush, css::uno::makeAny(xInst));
- }
- for (sal_Int32 j=nLength-1; j>0; --j)
- {
- xOrderList->getByName( ::rtl::OUString::valueOf(j) ) >>= xPrevSet;
- xOrderList->getByName( ::rtl::OUString::valueOf(j-1) ) >>= xNextSet;
- ::rtl::OUString sTemp;
- xNextSet->getPropertyValue(s_sHistoryItemRef) >>= sTemp;
- xPrevSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sTemp));
- }
- xOrderList->getByName( ::rtl::OUString::valueOf((sal_Int32)0) ) >>= xSet;
- xSet->setPropertyValue(s_sHistoryItemRef, css::uno::makeAny(sURL));
-
- // Append the item to ItemList.
- xFac = css::uno::Reference< css::lang::XSingleServiceFactory >(xItemList, css::uno::UNO_QUERY);
- xInst = xFac->createInstance();
- xItemList->insertByName(sURL, css::uno::makeAny(xInst));
- xSet = css::uno::Reference< css::beans::XPropertySet >(xInst, css::uno::UNO_QUERY);
- xSet->setPropertyValue(s_sFilter, css::uno::makeAny(sFilter));
- xSet->setPropertyValue(s_sTitle, css::uno::makeAny(sTitle));
- xSet->setPropertyValue(s_sPassword, css::uno::makeAny(sPassword));
-
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- }
- catch(const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtHistoryOptions_Impl* SvtHistoryOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtHistoryOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtHistoryOptions::SvtHistoryOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtHistoryOptions_Impl::ctor()");
- m_pDataContainer = new SvtHistoryOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_HISTORYOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtHistoryOptions::~SvtHistoryOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_uInt32 SvtHistoryOptions::GetSize( EHistoryType eHistory ) const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetSize( eHistory );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtHistoryOptions::SetSize( EHistoryType eHistory, sal_uInt32 nSize )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetSize( eHistory, nSize );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtHistoryOptions::Clear( EHistoryType eHistory )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->Clear( eHistory );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< Sequence< PropertyValue > > SvtHistoryOptions::GetList( EHistoryType eHistory ) const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetList( eHistory );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtHistoryOptions::AppendItem( EHistoryType eHistory ,
- const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTitle ,
- const OUString& sPassword )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->AppendItem( eHistory, sURL, sFilter, sTitle, sPassword );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtHistoryOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/inetoptions.cxx b/svtools/source/config/inetoptions.cxx
deleted file mode 100644
index 109c2d94ada7..000000000000
--- a/svtools/source/config/inetoptions.cxx
+++ /dev/null
@@ -1,557 +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: inetoptions.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_svtools.hxx"
-#include <svtools/inetoptions.hxx>
-#include "rtl/instance.hxx"
-#include <tools/urlobj.hxx>
-#ifndef _WILDCARD_HXX
-#include <tools/wldcrd.hxx>
-#endif
-
-#include <algorithm>
-#include <map>
-#include <set>
-#include <vector>
-#include <utility>
-#include <com/sun/star/beans/PropertyChangeEvent.hpp>
-#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/system/XProxySettings.hpp>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <osl/mutex.hxx>
-#include <rtl/ustring.h>
-#include <rtl/ustring.hxx>
-#include <sal/types.h>
-#include <unotools/configitem.hxx>
-#include <unotools/processfactory.hxx>
-#include <osl/diagnose.h>
-#include <salhelper/refobj.hxx>
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-using namespace com::sun;
-
-//============================================================================
-//
-// takeAny
-//
-//============================================================================
-
-namespace {
-
-template< typename T > inline T takeAny(star::uno::Any const & rAny)
-{
- T aValue = T();
- rAny >>= aValue;
- return aValue;
-}
-
-}
-
-//============================================================================
-//
-// SvtInetOptions::Impl
-//
-//============================================================================
-
-class SvtInetOptions::Impl: public salhelper::ReferenceObject,
- public utl::ConfigItem
-{
-public:
- enum Index
- {
- INDEX_NO_PROXY,
- INDEX_PROXY_TYPE,
- INDEX_FTP_PROXY_NAME,
- INDEX_FTP_PROXY_PORT,
- INDEX_HTTP_PROXY_NAME,
- INDEX_HTTP_PROXY_PORT
- };
-
- Impl();
-
- star::uno::Any getProperty(Index nIndex);
-
- void
- setProperty(Index nIndex, star::uno::Any const & rValue, bool bFlush);
-
- inline void flush() { Commit(); }
-
- void
- addPropertiesChangeListener(
- star::uno::Sequence< rtl::OUString > const & rPropertyNames,
- star::uno::Reference< star::beans::XPropertiesChangeListener > const &
- rListener);
-
- void
- removePropertiesChangeListener(
- star::uno::Sequence< rtl::OUString > const & rPropertyNames,
- star::uno::Reference< star::beans::XPropertiesChangeListener > const &
- rListener);
-
-private:
- enum { ENTRY_COUNT = INDEX_HTTP_PROXY_PORT + 1 };
-
- struct Entry
- {
- enum State { UNKNOWN, KNOWN, MODIFIED };
-
- inline Entry(): m_eState(UNKNOWN) {}
-
- rtl::OUString m_aName;
- star::uno::Any m_aValue;
- State m_eState;
- };
-
- // MSVC has problems with the below Map type when
- // star::uno::Reference< star::beans::XPropertiesChangeListener > is not
- // wrapped in class Listener:
- class Listener:
- public star::uno::Reference< star::beans::XPropertiesChangeListener >
- {
- public:
- Listener(star::uno::Reference<
- star::beans::XPropertiesChangeListener > const &
- rListener):
- star::uno::Reference< star::beans::XPropertiesChangeListener >(
- rListener)
- {}
- };
-
- typedef std::map< Listener, std::set< rtl::OUString > > Map;
-
- osl::Mutex m_aMutex;
- Entry m_aEntries[ENTRY_COUNT];
- Map m_aListeners;
-
- virtual inline ~Impl() { Commit(); }
-
- virtual void Notify(star::uno::Sequence< rtl::OUString > const & rKeys);
-
- virtual void Commit();
-
- void notifyListeners(star::uno::Sequence< rtl::OUString > const & rKeys);
-};
-
-//============================================================================
-// virtual
-void
-SvtInetOptions::Impl::Notify(star::uno::Sequence< rtl::OUString > const &
- rKeys)
-{
- {
- osl::MutexGuard aGuard(m_aMutex);
- for (sal_Int32 i = 0; i < rKeys.getLength(); ++i)
- for (sal_Int32 j = 0; j < ENTRY_COUNT; ++j)
- if (rKeys[i] == m_aEntries[j].m_aName)
- {
- m_aEntries[j].m_eState = Entry::UNKNOWN;
- break;
- }
- }
- notifyListeners(rKeys);
-}
-
-//============================================================================
-// virtual
-void SvtInetOptions::Impl::Commit()
-{
- star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT);
- star::uno::Sequence< star::uno::Any > aValues(ENTRY_COUNT);
- sal_Int32 nCount = 0;
- {
- osl::MutexGuard aGuard(m_aMutex);
- for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i)
- if (m_aEntries[i].m_eState == Entry::MODIFIED)
- {
- aKeys[nCount] = m_aEntries[i].m_aName;
- aValues[nCount] = m_aEntries[i].m_aValue;
- ++nCount;
- m_aEntries[i].m_eState = Entry::KNOWN;
- }
- }
- if (nCount > 0)
- {
- aKeys.realloc(nCount);
- aValues.realloc(nCount);
- PutProperties(aKeys, aValues);
- }
-}
-
-//============================================================================
-void
-SvtInetOptions::Impl::notifyListeners(
- star::uno::Sequence< rtl::OUString > const & rKeys)
-{
- typedef
- std::vector< std::pair< star::uno::Reference<
- star::beans::XPropertiesChangeListener >,
- star::uno::Sequence<
- star::beans::PropertyChangeEvent > > >
- List;
- List aNotifications;
- {
- osl::MutexGuard aGuard(m_aMutex);
- aNotifications.reserve(m_aListeners.size());
- Map::const_iterator aMapEnd(m_aListeners.end());
- for (Map::const_iterator aIt(m_aListeners.begin()); aIt != aMapEnd;
- ++aIt)
- {
- const Map::mapped_type &rSet = aIt->second;
- Map::mapped_type::const_iterator aSetEnd(rSet.end());
- star::uno::Sequence< star::beans::PropertyChangeEvent >
- aEvents(rKeys.getLength());
- sal_Int32 nCount = 0;
- for (sal_Int32 i = 0; i < rKeys.getLength(); ++i)
- {
- rtl::OUString
- aTheKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "Inet/")));
- aTheKey += rKeys[i];
- if (rSet.find(aTheKey) != aSetEnd)
- {
- aEvents[nCount].PropertyName = aTheKey;
- aEvents[nCount].PropertyHandle = -1;
- ++nCount;
- }
- }
- if (nCount > 0)
- {
- aEvents.realloc(nCount);
- aNotifications.
- push_back(std::make_pair< List::value_type::first_type,
- List::value_type::second_type >(
- aIt->first, aEvents));
- }
- }
- }
- for (List::size_type i = 0; i < aNotifications.size(); ++i)
- if (aNotifications[i].first.is())
- aNotifications[i].first->
- propertiesChange(aNotifications[i].second);
-}
-
-//============================================================================
-SvtInetOptions::Impl::Impl():
- ConfigItem(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Inet/Settings")))
-{
- m_aEntries[INDEX_NO_PROXY].m_aName
- = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetNoProxy"));
- m_aEntries[INDEX_PROXY_TYPE].m_aName
- = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetProxyType"));
- m_aEntries[INDEX_FTP_PROXY_NAME].m_aName
- = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyName"));
- m_aEntries[INDEX_FTP_PROXY_PORT].m_aName
- = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetFTPProxyPort"));
- m_aEntries[INDEX_HTTP_PROXY_NAME].m_aName
- = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyName"));
- m_aEntries[INDEX_HTTP_PROXY_PORT].m_aName
- = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooInetHTTPProxyPort"));
-
- star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT);
- for (sal_Int32 i = 0; i < ENTRY_COUNT; ++i)
- aKeys[i] = m_aEntries[i].m_aName;
- if (!EnableNotification(aKeys))
- OSL_ENSURE(false,
- "SvtInetOptions::Impl::Impl(): Bad EnableNotifications()");
-}
-
-//============================================================================
-star::uno::Any SvtInetOptions::Impl::getProperty(Index nPropIndex)
-{
- for (int nTryCount = 0; nTryCount < 10; ++nTryCount)
- {
- {
- osl::MutexGuard aGuard(m_aMutex);
- if (m_aEntries[nPropIndex].m_eState != Entry::UNKNOWN)
- return m_aEntries[nPropIndex].m_aValue;
- }
- star::uno::Sequence< rtl::OUString > aKeys(ENTRY_COUNT);
- int nIndices[ENTRY_COUNT];
- sal_Int32 nCount = 0;
- {
- osl::MutexGuard aGuard(m_aMutex);
- for (int i = 0; i < ENTRY_COUNT; ++i)
- if (m_aEntries[i].m_eState == Entry::UNKNOWN)
- {
- aKeys[nCount] = m_aEntries[i].m_aName;
- nIndices[nCount] = i;
- ++nCount;
- }
- }
- if (nCount > 0)
- {
- aKeys.realloc(nCount);
- star::uno::Sequence< star::uno::Any >
- aValues(GetProperties(aKeys));
- OSL_ENSURE(aValues.getLength() == nCount,
- "SvtInetOptions::Impl::getProperty():"
- " Bad GetProperties() result");
- nCount = std::min(nCount, aValues.getLength());
- {
- osl::MutexGuard aGuard(m_aMutex);
- for (sal_Int32 i = 0; i < nCount; ++i)
- {
- int nIndex = nIndices[i];
- if (m_aEntries[nIndex].m_eState == Entry::UNKNOWN)
- {
- m_aEntries[nIndices[i]].m_aValue = aValues[i];
- m_aEntries[nIndices[i]].m_eState = Entry::KNOWN;
- }
- }
- }
- }
- }
- OSL_ENSURE(false,
- "SvtInetOptions::Impl::getProperty(): Possible life lock");
- {
- osl::MutexGuard aGuard(m_aMutex);
- return m_aEntries[nPropIndex].m_aValue;
- }
-}
-
-//============================================================================
-void SvtInetOptions::Impl::setProperty(Index nIndex,
- star::uno::Any const & rValue,
- bool bFlush)
-{
- SetModified();
- {
- osl::MutexGuard aGuard(m_aMutex);
- m_aEntries[nIndex].m_aValue = rValue;
- m_aEntries[nIndex].m_eState = bFlush ? Entry::KNOWN : Entry::MODIFIED;
- }
-
- star::uno::Sequence< rtl::OUString > aKeys(1);
- aKeys[0] = m_aEntries[nIndex].m_aName;
- if (bFlush)
- {
- star::uno::Sequence< star::uno::Any > aValues(1);
- aValues[0] = rValue;
- PutProperties(aKeys, aValues);
- }
- else
- notifyListeners(aKeys);
-}
-
-//============================================================================
-void
-SvtInetOptions::Impl::addPropertiesChangeListener(
- star::uno::Sequence< rtl::OUString > const & rPropertyNames,
- star::uno::Reference< star::beans::XPropertiesChangeListener > const &
- rListener)
-{
- osl::MutexGuard aGuard(m_aMutex);
- Map::mapped_type & rEntry = m_aListeners[rListener];
- for (sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i)
- rEntry.insert(rPropertyNames[i]);
-}
-
-//============================================================================
-void
-SvtInetOptions::Impl::removePropertiesChangeListener(
- star::uno::Sequence< rtl::OUString > const & rPropertyNames,
- star::uno::Reference< star::beans::XPropertiesChangeListener > const &
- rListener)
-{
- osl::MutexGuard aGuard(m_aMutex);
- Map::iterator aIt(m_aListeners.find(rListener));
- if (aIt != m_aListeners.end())
- {
- for (sal_Int32 i = 0; i < rPropertyNames.getLength(); ++i)
- aIt->second.erase(rPropertyNames[i]);
- if (aIt->second.empty())
- m_aListeners.erase(aIt);
- }
-}
-
-//============================================================================
-//
-// SvtInetOptions
-//
-//============================================================================
-
-namespace
-{
- class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
- {
- };
-}
-
-// static
-SvtInetOptions::Impl * SvtInetOptions::m_pImpl = 0;
-
-//============================================================================
-SvtInetOptions::SvtInetOptions()
-{
- osl::MutexGuard aGuard(LocalSingleton::get());
- if (!m_pImpl)
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtInetOptions_Impl::ctor()");
- m_pImpl = new Impl;
-
- ItemHolder1::holdConfigItem(E_INETOPTIONS);
- }
- m_pImpl->acquire();
-}
-
-//============================================================================
-SvtInetOptions::~SvtInetOptions()
-{
- osl::MutexGuard aGuard(LocalSingleton::get());
- if (m_pImpl->release() == 0)
- m_pImpl = 0;
-}
-
-//============================================================================
-rtl::OUString SvtInetOptions::GetProxyNoProxy() const
-{
- return takeAny< rtl::OUString >(m_pImpl->
- getProperty(Impl::INDEX_NO_PROXY));
-}
-
-//============================================================================
-sal_Int32 SvtInetOptions::GetProxyType() const
-{
- return takeAny< sal_Int32 >(m_pImpl->
- getProperty(Impl::INDEX_PROXY_TYPE));
-}
-
-//============================================================================
-rtl::OUString SvtInetOptions::GetProxyFtpName() const
-{
- return takeAny< rtl::OUString >(m_pImpl->
- getProperty(
- Impl::INDEX_FTP_PROXY_NAME));
-}
-
-//============================================================================
-sal_Int32 SvtInetOptions::GetProxyFtpPort() const
-{
- return takeAny< sal_Int32 >(m_pImpl->
- getProperty(Impl::INDEX_FTP_PROXY_PORT));
-}
-
-//============================================================================
-rtl::OUString SvtInetOptions::GetProxyHttpName() const
-{
- return takeAny< rtl::OUString >(m_pImpl->
- getProperty(
- Impl::INDEX_HTTP_PROXY_NAME));
-}
-
-//============================================================================
-sal_Int32 SvtInetOptions::GetProxyHttpPort() const
-{
- return takeAny< sal_Int32 >(m_pImpl->
- getProperty(Impl::INDEX_HTTP_PROXY_PORT));
-}
-
-//============================================================================
-void SvtInetOptions::SetProxyNoProxy(rtl::OUString const & rValue,
- bool bFlush)
-{
- m_pImpl->setProperty(Impl::INDEX_NO_PROXY,
- star::uno::makeAny(rValue),
- bFlush);
-}
-
-//============================================================================
-void SvtInetOptions::SetProxyType(ProxyType eValue, bool bFlush)
-{
- m_pImpl->setProperty(Impl::INDEX_PROXY_TYPE,
- star::uno::makeAny(sal_Int32(eValue)),
- bFlush);
-}
-
-//============================================================================
-void SvtInetOptions::SetProxyFtpName(rtl::OUString const & rValue,
- bool bFlush)
-{
- m_pImpl->setProperty(Impl::INDEX_FTP_PROXY_NAME,
- star::uno::makeAny(rValue),
- bFlush);
-}
-
-//============================================================================
-void SvtInetOptions::SetProxyFtpPort(sal_Int32 nValue, bool bFlush)
-{
- m_pImpl->setProperty(Impl::INDEX_FTP_PROXY_PORT,
- star::uno::makeAny(nValue),
- bFlush);
-}
-
-//============================================================================
-void SvtInetOptions::SetProxyHttpName(rtl::OUString const & rValue,
- bool bFlush)
-{
- m_pImpl->setProperty(Impl::INDEX_HTTP_PROXY_NAME,
- star::uno::makeAny(rValue),
- bFlush);
-}
-
-//============================================================================
-void SvtInetOptions::SetProxyHttpPort(sal_Int32 nValue, bool bFlush)
-{
- m_pImpl->setProperty(Impl::INDEX_HTTP_PROXY_PORT,
- star::uno::makeAny(nValue),
- bFlush);
-}
-
-//============================================================================
-void SvtInetOptions::flush()
-{
- m_pImpl->flush();
-}
-
-//============================================================================
-void
-SvtInetOptions::addPropertiesChangeListener(
- star::uno::Sequence< rtl::OUString > const & rPropertyNames,
- star::uno::Reference< star::beans::XPropertiesChangeListener > const &
- rListener)
-{
- m_pImpl->addPropertiesChangeListener(rPropertyNames, rListener);
-}
-
-//============================================================================
-void
-SvtInetOptions::removePropertiesChangeListener(
- star::uno::Sequence< rtl::OUString > const & rPropertyNames,
- star::uno::Reference< star::beans::XPropertiesChangeListener > const &
- rListener)
-{
- m_pImpl->removePropertiesChangeListener(rPropertyNames, rListener);
-}
diff --git a/svtools/source/config/internaloptions.cxx b/svtools/source/config/internaloptions.cxx
deleted file mode 100644
index dc8cc7c34772..000000000000
--- a/svtools/source/config/internaloptions.cxx
+++ /dev/null
@@ -1,631 +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: internaloptions.cxx,v $
- * $Revision: 1.21 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <deque>
-
-#include <svtools/internaloptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::std ;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::beans ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_INTERNAL OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Internal" ))
-#define DEFAULT_SLOTCFG sal_False
-#define DEFAULT_SENDCRASHMAIL sal_False
-#define DEFAULT_USEMAILUI sal_True
-#define DEFAULT_CURRENTTEMPURL OUString(RTL_CONSTASCII_USTRINGPARAM(""))
-
-#define FIXPROPERTYNAME_SLOTCFG OUString(RTL_CONSTASCII_USTRINGPARAM("Slot" ))
-#define FIXPROPERTYNAME_SENDCRASHMAIL OUString(RTL_CONSTASCII_USTRINGPARAM("SendCrashMail" ))
-#define FIXPROPERTYNAME_USEMAILUI OUString(RTL_CONSTASCII_USTRINGPARAM("UseMailUI" ))
-#define FIXPROPERTYNAME_CURRENTTEMPURL OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentTempURL" ))
-//#define FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryClose"))
-//#define FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryBackToWebtop"))
-//#define FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryNewWebtop"))
-//#define FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveMenuEntryLogout"))
-
-#define FIXPROPERTYHANDLE_SLOTCFG 0
-#define FIXPROPERTYHANDLE_SENDCRASHMAIL 1
-#define FIXPROPERTYHANDLE_USEMAILUI 2
-#define FIXPROPERTYHANDLE_CURRENTTEMPURL 3
-//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE 3
-//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP 4
-//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP 5
-//#define FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT 6
-
-#define FIXPROPERTYCOUNT 4
-/*
-#define PROPERTYNAME_RECOVERYLIST OUString(RTL_CONSTASCII_USTRINGPARAM("RecoveryList" ))
-#define PROPERTYNAME_URL OUString(RTL_CONSTASCII_USTRINGPARAM("OrgURL" ))
-#define PROPERTYNAME_FILTER OUString(RTL_CONSTASCII_USTRINGPARAM("FilterName" ))
-#define PROPERTYNAME_TEMPNAME OUString(RTL_CONSTASCII_USTRINGPARAM("TempURL" ))
-
-#define OFFSET_URL 0
-#define OFFSET_FILTER 1
-#define OFFSET_TEMPNAME 2
-*/
-#define PATHDELIMITER OUString(RTL_CONSTASCII_USTRINGPARAM("/" ))
-#define FIXR OUString(RTL_CONSTASCII_USTRINGPARAM("r" ))
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-/*
-struct tIMPL_RecoveryEntry
-{
- OUString sURL ;
- OUString sFilter ;
- OUString sTempName ;
-
- tIMPL_RecoveryEntry()
- {
- sURL = OUString();
- sFilter = OUString();
- sTempName = OUString();
- }
-
- tIMPL_RecoveryEntry( const OUString& sNewURL ,
- const OUString& sNewFilter ,
- const OUString& sNewTempName )
- {
- sURL = sNewURL ;
- sFilter = sNewFilter ;
- sTempName = sNewTempName ;
- }
-};
-
-typedef deque< tIMPL_RecoveryEntry > tIMPL_RecoveryStack;
-*/
-class SvtInternalOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- sal_Bool m_bRemoveMenuEntryClose;
- sal_Bool m_bRemoveMenuEntryBackToWebtop;
- sal_Bool m_bRemoveMenuEntryNewWebtop;
- sal_Bool m_bRemoveMenuEntryLogout;
- sal_Bool m_bSlotCFG ; /// cache "Slot" of Internal section
- sal_Bool m_bSendCrashMail ; /// cache "SendCrashMail" of Internal section
- sal_Bool m_bUseMailUI;
- OUString m_aCurrentTempURL ;
- // tIMPL_RecoveryStack m_aRecoveryList ; /// cache "RecoveryList" of Internal section
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtInternalOptions_Impl();
- ~SvtInternalOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& )
- {
- DBG_ASSERT( sal_False, "SvtInternalOptions::Notify()\nNot used yet ... but called!?\n" );
- }
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These method give us a chance to regulate acces to ouer internal values.
- It's not used in the moment - but it's possible for the feature!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_Bool IsRemoveMenuEntryClose() const { return m_bRemoveMenuEntryClose; }
- sal_Bool IsRemoveMenuEntryBackToWebtop() const { return m_bRemoveMenuEntryBackToWebtop; }
- sal_Bool IsRemoveMenuEntryNewWebtop() const { return m_bRemoveMenuEntryNewWebtop; }
- sal_Bool IsRemoveMenuEntryLogout() const { return m_bRemoveMenuEntryLogout; }
- sal_Bool SlotCFGEnabled () const { return m_bSlotCFG; }
- sal_Bool CrashMailEnabled () const { return m_bSendCrashMail; }
- sal_Bool MailUIEnabled () const { return m_bUseMailUI; }
-
- OUString GetCurrentTempURL() const { return m_aCurrentTempURL; }
- void SetCurrentTempURL( const OUString& aNewCurrentTempURL );
-/*
- void PushRecoveryItem ( const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTempName );
- void PopRecoveryItem ( OUString& sURL ,
- OUString& sFilter ,
- OUString& sTempName );
- sal_Bool IsRecoveryListEmpty ( ) const;
-*/
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of fix key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management. We return well known key names only - because the "UserData" node
- is handled in a special way!
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< OUString > impl_GetPropertyNames();
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtInternalOptions_Impl::SvtInternalOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_INTERNAL, CONFIG_MODE_IMMEDIATE_UPDATE )
- // Init member then.
- , m_bRemoveMenuEntryClose ( sal_False )
- , m_bRemoveMenuEntryBackToWebtop ( sal_False )
- , m_bRemoveMenuEntryNewWebtop ( sal_False )
- , m_bRemoveMenuEntryLogout ( sal_False )
- , m_bSlotCFG ( DEFAULT_SLOTCFG )
- , m_bSendCrashMail ( DEFAULT_SENDCRASHMAIL )
- , m_bUseMailUI ( DEFAULT_USEMAILUI )
- , m_aCurrentTempURL ( DEFAULT_CURRENTTEMPURL )
-{
- // Use our list of configuration keys to get his values.
- // structure of internal section: (first 2 entries are fixed - all other are member of a set!)
- // "Slot"
- // "SendCrashMail"
- // "RecoveryList/r1/URL"
- // "RecoveryList/r1/Filter"
- // "RecoveryList/r1/TempName"
- // "RecoveryList/r2/URL"
- // "RecoveryList/r2/Filter"
- // "RecoveryList/r2/TempName"
- // "RecoveryList/.."
- Sequence< OUString > seqNames = impl_GetPropertyNames() ;
- Sequence< Any > seqValues = GetProperties( seqNames ) ;
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Read fixed values first!
- DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SLOTCFG].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\Slot\"?" );
- DBG_ASSERT(!(seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL].getValueTypeClass()!=TypeClass_BOOLEAN) , "SvtInternalOptions_Impl::SvtInternalOptions_Impl()\nWho has changed the value type of \"Office.Common\\Internal\\SendCrashMail\"?" );
- seqValues[FIXPROPERTYHANDLE_SLOTCFG ] >>= m_bSlotCFG ;
- seqValues[FIXPROPERTYHANDLE_SENDCRASHMAIL ] >>= m_bSendCrashMail ;
- seqValues[FIXPROPERTYHANDLE_USEMAILUI ] >>= m_bUseMailUI ;
- seqValues[FIXPROPERTYHANDLE_CURRENTTEMPURL ] >>= m_aCurrentTempURL ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] >>= m_bRemoveMenuEntryClose ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] >>= m_bRemoveMenuEntryBackToWebtop ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] >>= m_bRemoveMenuEntryNewWebtop ;
-// seqValues[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] >>= m_bRemoveMenuEntryLogout ;
-/*
- // Read dynamical set "RecoveryList" then.
- // 3 subkeys for every item!
- // Attention: Start at next element after last fixed entry! We must ignore "Slot" and "SendCrashMail" ...
- tIMPL_RecoveryEntry aEntry;
- sal_uInt32 nCount = seqValues.getLength() ;
- sal_uInt32 nPosition = FIXPROPERTYCOUNT ;
-
- while( nPosition<nCount )
- {
- seqValues[nPosition] >>= aEntry.sURL ;
- ++nPosition;
- seqValues[nPosition] >>= aEntry.sFilter ;
- ++nPosition;
- seqValues[nPosition] >>= aEntry.sTempName ;
- ++nPosition;
- m_aRecoveryList.push_front( aEntry );
- }
-*/
- // We don't need any notifications here.
- // "Slot" and "SendCrashMail" are readonly(!) and our recovery list should not modified during runtime - it's used
- // by our crash guard only ... otherwise we have a big problem.
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtInternalOptions_Impl::~SvtInternalOptions_Impl()
-{
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtInternalOptions_Impl::Commit()
-{
- // We have to write our current temp URL
- Sequence< OUString > aNames( 1 );
- OUString* pNames = aNames.getArray();
- Sequence< Any > aValues( 1 );
- Any* pValues = aValues.getArray();
-
- pNames[0] = FIXPROPERTYNAME_CURRENTTEMPURL;
- pValues[0] <<= m_aCurrentTempURL;
-
- PutProperties( aNames, aValues );
-
-/*
- // Write set of dynamic properties then.
- ClearNodeSet( PROPERTYNAME_RECOVERYLIST );
-
- tIMPL_RecoveryEntry aItem ;
- OUString sNode ;
- Sequence< PropertyValue > seqPropertyValues( 3 ) ; // Every node in set has 3 sub-nodes!( url, filter, tempname )
-
- // Copy list entries to save-list and write it to configuration.
-
- sal_uInt32 nCount = m_aRecoveryList.size();
- for( sal_uInt32 nItem=0; nItem<nCount; ++nItem )
- {
- aItem = m_aRecoveryList.top();
- m_aRecoveryList.pop();
- sNode = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + FIXR + OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
- seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_URL ;
- seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_FILTER ;
- seqPropertyValues[OFFSET_TEMPNAME ].Name = sNode + PROPERTYNAME_TEMPNAME ;
- seqPropertyValues[OFFSET_URL ].Value <<= aItem.sURL ;
- seqPropertyValues[OFFSET_FILTER ].Value <<= aItem.sFilter ;
- seqPropertyValues[OFFSET_TEMPNAME ].Value <<= aItem.sTempName ;
-
- SetSetProperties( PROPERTYNAME_RECOVERYLIST, seqPropertyValues );
- }
-
- tIMPL_RecoveryStack::iterator iRecovery = m_aRecoveryList.begin();
- for ( sal_uInt32 nItem=0; iRecovery != m_aRecoveryList.end(); ++nItem, ++iRecovery)
- {
- aItem = *iRecovery;
- sNode = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + FIXR +
- OUString::valueOf( (sal_Int32)nItem ) + PATHDELIMITER;
- seqPropertyValues[OFFSET_URL ].Name = sNode + PROPERTYNAME_URL ;
- seqPropertyValues[OFFSET_FILTER ].Name = sNode + PROPERTYNAME_FILTER ;
- seqPropertyValues[OFFSET_TEMPNAME ].Name = sNode + PROPERTYNAME_TEMPNAME ;
- seqPropertyValues[OFFSET_URL ].Value <<= iRecovery->sURL ;
- seqPropertyValues[OFFSET_FILTER ].Value <<= iRecovery->sFilter ;
- seqPropertyValues[OFFSET_TEMPNAME ].Value <<= iRecovery->sTempName ;
- SetSetProperties( PROPERTYNAME_RECOVERYLIST, seqPropertyValues );
- }
-
- */
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtInternalOptions_Impl::SetCurrentTempURL( const OUString& aNewCurrentTempURL )
-{
- m_aCurrentTempURL = aNewCurrentTempURL;
- SetModified();
- Commit();
-}
-
-#if 0
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtInternalOptions_Impl::PushRecoveryItem( const OUString& sURL ,
- const OUString& sFilter ,
- const OUString& sTempName )
-{
- tIMPL_RecoveryEntry aEntry( sURL, sFilter, sTempName );
- m_aRecoveryList.push_front( aEntry );
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtInternalOptions_Impl::PopRecoveryItem( OUString& sURL ,
- OUString& sFilter ,
- OUString& sTempName )
-{
- tIMPL_RecoveryEntry aEntry = m_aRecoveryList.front();
- m_aRecoveryList.pop_front();
- SetModified(); // Don't forget it - we delete an entry here!
- sURL = aEntry.sURL ;
- sFilter = aEntry.sFilter ;
- sTempName = aEntry.sTempName ;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtInternalOptions_Impl::IsRecoveryListEmpty() const
-{
- return ( m_aRecoveryList.empty() );
-}
-#endif
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtInternalOptions_Impl::impl_GetPropertyNames()
-{
- /*
- // First get ALL names of current existing list items in configuration!
- Sequence< OUString > seqRecoveryItems = GetNodeNames( PROPERTYNAME_RECOVERYLIST );
- // Get information about list counts ...
- sal_Int32 nRecoveryCount = seqRecoveryItems.getLength();
- // ... and create a property list with right size! (+2...for fix properties!) (*3 ... = sub nodes for every set node!)
- Sequence< OUString > seqProperties( FIXPROPERTYCOUNT + (nRecoveryCount*3) );
- */
- Sequence< OUString > seqProperties(4);
-
- // Add names of fix properties to list.
- seqProperties[FIXPROPERTYHANDLE_SLOTCFG ] = FIXPROPERTYNAME_SLOTCFG ;
- seqProperties[FIXPROPERTYHANDLE_SENDCRASHMAIL ] = FIXPROPERTYNAME_SENDCRASHMAIL ;
- seqProperties[FIXPROPERTYHANDLE_USEMAILUI ] = FIXPROPERTYNAME_USEMAILUI ;
- seqProperties[FIXPROPERTYHANDLE_CURRENTTEMPURL ] = FIXPROPERTYNAME_CURRENTTEMPURL ;
-// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYCLOSE ] = FIXPROPERTYNAME_REMOVEMENUENTRYCLOSE;
-// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYBACKTOWEBTOP ] = FIXPROPERTYNAME_REMOVEMENUENTRYBACKTOWEBTOP;
-// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYNEWWEBTOP ] = FIXPROPERTYNAME_REMOVEMENUENTRYNEWWEBTOP;
-// seqProperties[FIXPROPERTYHANDLE_REMOVEMENUENTRYLOGOUT ] = FIXPROPERTYNAME_REMOVEMENUENTRYLOGOUT;
-/*
- sal_uInt32 nPosition = FIXPROPERTYCOUNT;
- // Add names for recovery list to list.
- // 3 subkeys for every item!
- // nPosition is the start point of an list item, nItem an index into right list of node names!
- for( sal_Int32 nItem=0; nItem<nRecoveryCount; ++nItem )
- {
- seqProperties[nPosition] = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + seqRecoveryItems[nItem] + PATHDELIMITER + PROPERTYNAME_URL ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + seqRecoveryItems[nItem] + PATHDELIMITER + PROPERTYNAME_FILTER ;
- ++nPosition;
- seqProperties[nPosition] = PROPERTYNAME_RECOVERYLIST + PATHDELIMITER + seqRecoveryItems[nItem] + PATHDELIMITER + PROPERTYNAME_TEMPNAME ;
- ++nPosition;
- }
-*/
- // Return result.
- return seqProperties;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtInternalOptions_Impl* SvtInternalOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtInternalOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtInternalOptions::SvtInternalOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtInternalOptions_Impl::ctor()");
- m_pDataContainer = new SvtInternalOptions_Impl();
-
- ItemHolder1::holdConfigItem(E_INTERNALOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtInternalOptions::~SvtInternalOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtInternalOptions::SlotCFGEnabled() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->SlotCFGEnabled();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtInternalOptions::CrashMailEnabled() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->CrashMailEnabled();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtInternalOptions::MailUIEnabled() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->MailUIEnabled();
-}
-
-//*****************************************************************************************************************
-// public methods
-//*****************************************************************************************************************
-sal_Bool SvtInternalOptions::IsRemoveMenuEntryClose() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsRemoveMenuEntryClose();
-}
-
-sal_Bool SvtInternalOptions::IsRemoveMenuEntryBackToWebtop() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsRemoveMenuEntryBackToWebtop();
-}
-
-sal_Bool SvtInternalOptions::IsRemoveMenuEntryNewWebtop() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsRemoveMenuEntryNewWebtop();
-}
-
-sal_Bool SvtInternalOptions::IsRemoveMenuEntryLogout() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsRemoveMenuEntryLogout();
-}
-
-OUString SvtInternalOptions::GetCurrentTempURL() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetCurrentTempURL();
-}
-
-void SvtInternalOptions::SetCurrentTempURL( const OUString& aNewCurrentTempURL )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetCurrentTempURL( aNewCurrentTempURL );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtInternalOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/itemholder1.cxx b/svtools/source/config/itemholder1.cxx
deleted file mode 100644
index 37a57259c807..000000000000
--- a/svtools/source/config/itemholder1.cxx
+++ /dev/null
@@ -1,325 +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: itemholder1.cxx,v $
- * $Revision: 1.13 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include "itemholder1.hxx"
-
-//-----------------------------------------------
-// includes
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <svtools/accelcfg.hxx>
-#include <svtools/addxmltostorageoptions.hxx>
-#include <cacheoptions.hxx>
-#include <svtools/cmdoptions.hxx>
-#include <svtools/compatibility.hxx>
-#include <svtools/defaultoptions.hxx>
-#include <svtools/dynamicmenuoptions.hxx>
-#include <eventcfg.hxx>
-#include <svtools/extendedsecurityoptions.hxx>
-#include <fltrcfg.hxx>
-#include <svtools/fontoptions.hxx>
-#include <svtools/historyoptions.hxx>
-#include <svtools/inetoptions.hxx>
-#include <svtools/internaloptions.hxx>
-#include <javaoptions.hxx>
-#include <svtools/lingucfg.hxx>
-#include <svtools/localisationoptions.hxx>
-#include <svtools/menuoptions.hxx>
-#include <svtools/moduleoptions.hxx>
-#include <svtools/pathoptions.hxx>
-#include <svtools/printwarningoptions.hxx>
-#include <regoptions.hxx>
-#include <svtools/optionsdlg.hxx>
-#include <svtools/saveopt.hxx>
-#include <searchopt.hxx>
-#include <svtools/securityoptions.hxx>
-#include <svtools/sourceviewconfig.hxx>
-#include <svtools/startoptions.hxx>
-#include <svtools/viewoptions.hxx>
-#include <svtools/workingsetoptions.hxx>
-#include <xmlaccelcfg.hxx>
-#include <svtools/options.hxx>
-
-//-----------------------------------------------
-// namespaces
-
-namespace css = ::com::sun::star;
-
-//-----------------------------------------------
-// declarations
-
-//-----------------------------------------------
-ItemHolder1::ItemHolder1()
- : ItemHolderMutexBase()
-{
- try
- {
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
- css::uno::Reference< css::lang::XComponent > xCfg(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
- css::uno::UNO_QUERY);
- if (xCfg.is())
- xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
- }
-// #i37892 got errorhandling from ConfigManager::GetConfigurationProvider()
-#ifdef DBG_UTIL
- catch(css::uno::Exception& rEx)
- {
- static sal_Bool bMessage = sal_True;
- if(bMessage)
- {
- bMessage = sal_False;
- ::rtl::OString sMsg("CreateInstance with arguments exception: ");
- sMsg += ::rtl::OString(rEx.Message.getStr(),
- rEx.Message.getLength(),
- RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(sal_False, sMsg.getStr());
- }
- }
-#else
- catch(css::uno::Exception&){}
-#endif
-}
-
-//-----------------------------------------------
-ItemHolder1::~ItemHolder1()
-{
- impl_releaseAllItems();
-}
-
-//-----------------------------------------------
-void ItemHolder1::holdConfigItem(EItem eItem)
-{
- static ItemHolder1* pHolder = new ItemHolder1();
- pHolder->impl_addItem(eItem);
-}
-
-//-----------------------------------------------
-void SAL_CALL ItemHolder1::disposing(const css::lang::EventObject&)
- throw(css::uno::RuntimeException)
-{
- css::uno::Reference< css::uno::XInterface > xSelfHold(static_cast< css::lang::XEventListener* >(this), css::uno::UNO_QUERY);
- impl_releaseAllItems();
-}
-
-//-----------------------------------------------
-void ItemHolder1::impl_addItem(EItem eItem)
-{
- ::osl::ResettableMutexGuard aLock(m_aLock);
-
- TItems::const_iterator pIt;
- for ( pIt = m_lItems.begin();
- pIt != m_lItems.end() ;
- ++pIt )
- {
- const TItemInfo& rInfo = *pIt;
- if (rInfo.eItem == eItem)
- return;
- }
-
- TItemInfo aNewItem;
- aNewItem.eItem = eItem;
- impl_newItem(aNewItem);
- if (aNewItem.pItem)
- m_lItems.push_back(aNewItem);
-}
-
-//-----------------------------------------------
-void ItemHolder1::impl_releaseAllItems()
-{
- ::osl::ResettableMutexGuard aLock(m_aLock);
-
- TItems::iterator pIt;
- for ( pIt = m_lItems.begin();
- pIt != m_lItems.end() ;
- ++pIt )
- {
- TItemInfo& rInfo = *pIt;
- impl_deleteItem(rInfo);
- }
- m_lItems.clear();
-}
-
-//-----------------------------------------------
-void ItemHolder1::impl_newItem(TItemInfo& rItem)
-{
- switch(rItem.eItem)
- {
- case E_ACCELCFG :
- rItem.pItem = new SvtAcceleratorConfiguration();
- break;
-
- case E_ADDXMLTOSTORAGEOPTIONS :
- rItem.pItem = new SvtAddXMLToStorageOptions();
- break;
-
- case E_CMDOPTIONS :
- rItem.pItem = new SvtCommandOptions();
- break;
-
- case E_COMPATIBILITY :
- rItem.pItem = new SvtCompatibilityOptions();
- break;
-
- case E_DEFAULTOPTIONS :
- rItem.pItem = new SvtDefaultOptions();
- break;
-
- case E_DYNAMICMENUOPTIONS :
- rItem.pItem = new SvtDynamicMenuOptions();
- break;
-
- case E_EVENTCFG :
- //rItem.pItem = new GlobalEventConfig();
- break;
-
- case E_EXTENDEDSECURITYOPTIONS :
- rItem.pItem = new SvtExtendedSecurityOptions();
- break;
-
- case E_FLTRCFG :
-// no ref count rItem.pItem = new SvtFilterOptions();
- break;
-
- case E_FONTOPTIONS :
- rItem.pItem = new SvtFontOptions();
- break;
-
- case E_HISTORYOPTIONS :
- rItem.pItem = new SvtHistoryOptions();
- break;
-
- case E_INETOPTIONS :
- rItem.pItem = new SvtInetOptions();
- break;
-
- case E_INTERNALOPTIONS :
- rItem.pItem = new SvtInternalOptions();
- break;
-
- case E_JAVAOPTIONS :
-// no ref count rItem.pItem = new SvtJavaOptions();
- break;
-
- case E_LINGUCFG :
- rItem.pItem = new SvtLinguConfig();
- break;
-
- case E_LOCALISATIONOPTIONS :
- rItem.pItem = new SvtLocalisationOptions();
- break;
-
- case E_MENUOPTIONS :
- rItem.pItem = new SvtMenuOptions();
- break;
-
- case E_MODULEOPTIONS :
- rItem.pItem = new SvtModuleOptions();
- break;
-
- case E_OPTIONSDLGOPTIONS :
- rItem.pItem = new SvtOptionsDialogOptions();
- break;
-
- case E_PATHOPTIONS :
- rItem.pItem = new SvtPathOptions();
- break;
-
- case E_PRINTWARNINGOPTIONS :
- rItem.pItem = new SvtPrintWarningOptions();
- break;
-
- case E_REGOPTIONS :
-// no ref count rItem.pItem = new ::svt::RegOptions();
- break;
-
- case E_SAVEOPTIONS :
- rItem.pItem = new SvtSaveOptions();
- break;
-
- case E_SEARCHOPT :
-// no ref count rItem.pItem = new SvtSearchOptions();
- break;
-
- case E_SECURITYOPTIONS :
- rItem.pItem = new SvtSecurityOptions();
- break;
-
- case E_SOURCEVIEWCONFIG :
- rItem.pItem = new ::svt::SourceViewConfig();
- break;
-
- case E_STARTOPTIONS :
- rItem.pItem = new SvtStartOptions();
- break;
-
- case E_VIEWOPTIONS_DIALOG :
- rItem.pItem = new SvtViewOptions(E_DIALOG, ::rtl::OUString());
- break;
-
- case E_VIEWOPTIONS_TABDIALOG :
- rItem.pItem = new SvtViewOptions(E_TABDIALOG, ::rtl::OUString());
- break;
-
- case E_VIEWOPTIONS_TABPAGE :
- rItem.pItem = new SvtViewOptions(E_TABPAGE, ::rtl::OUString());
- break;
-
- case E_VIEWOPTIONS_WINDOW :
- rItem.pItem = new SvtViewOptions(E_WINDOW, ::rtl::OUString());
- break;
-
- case E_WORKINGSETOPTIONS :
- rItem.pItem = new SvtWorkingSetOptions();
- break;
-
- case E_XMLACCELCFG :
- // ??? TODO
- break;
- default:
- OSL_ASSERT( "unknown item type" );
- break;
- }
-}
-
-//-----------------------------------------------
-void ItemHolder1::impl_deleteItem(TItemInfo& rItem)
-{
- if (rItem.pItem)
- {
- delete rItem.pItem;
- rItem.pItem = 0;
- }
-}
-
diff --git a/svtools/source/config/itemholder1.hxx b/svtools/source/config/itemholder1.hxx
deleted file mode 100644
index b040292ab5c6..000000000000
--- a/svtools/source/config/itemholder1.hxx
+++ /dev/null
@@ -1,92 +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: itemholder1.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_SVTOOLS_ITEMHOLDER1_HXX_
-#define INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_
-
-//-----------------------------------------------
-// includes
-
-#include "itemholderbase.hxx"
-#include <cppuhelper/implbase1.hxx>
-#include <com/sun/star/lang/XEventListener.hpp>
-
-//-----------------------------------------------
-// namespaces
-
-#ifdef css
-#error "Cant use css as namespace alias."
-#else
-#define css ::com::sun::star
-#endif
-
-//-----------------------------------------------
-// definitions
-
-class ItemHolder1 : private ItemHolderMutexBase
- , public ::cppu::WeakImplHelper1< css::lang::XEventListener >
-{
- //...........................................
- // member
- private:
-
- TItems m_lItems;
-
- //...........................................
- // c++ interface
- public:
-
- ItemHolder1();
- virtual ~ItemHolder1();
- static void holdConfigItem(EItem eItem);
-
- //...........................................
- // uno interface
- public:
-
- virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
- throw(css::uno::RuntimeException);
-
- //...........................................
- // helper
- private:
-
- void impl_addItem(EItem eItem);
- void impl_releaseAllItems();
- void impl_newItem(TItemInfo& rItem);
- void impl_deleteItem(TItemInfo& rItem);
-};
-
-//-----------------------------------------------
-// namespaces
-
-#undef css
-
-#endif // INCLUDED_SVTOOLS_ITEMHOLDER1_HXX_
diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx
index 590e0f85ade1..759fabbee686 100644
--- a/svtools/source/config/itemholder2.cxx
+++ b/svtools/source/config/itemholder2.cxx
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
#include "itemholder2.hxx"
//-----------------------------------------------
@@ -45,18 +40,12 @@
#include <svtools/accessibilityoptions.hxx>
#include <apearcfg.hxx>
-#include <svtools/cjkoptions.hxx>
+#include <svtools/menuoptions.hxx>
#include <svtools/colorcfg.hxx>
-#include <svtools/ctloptions.hxx>
#include <fontsubstconfig.hxx>
#include <svtools/helpopt.hxx>
-#include <svtools/languageoptions.hxx>
-#include <misccfg.hxx>
#include <svtools/printoptions.hxx>
-#include <svtools/syslocaleoptions.hxx>
-#include <svtools/undoopt.hxx>
-#include <svtools/useroptions.hxx>
-#include <svtools/options.hxx>
+#include <unotools/options.hxx>
#include <svtools/miscopt.hxx>
@@ -178,18 +167,10 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem)
// no ref count rItem.pItem = new SvtTabAppearanceCfg();
break;
- case E_CJKOPTIONS :
- rItem.pItem = new SvtCJKOptions();
- break;
-
case E_COLORCFG :
rItem.pItem = new ::svtools::ColorConfig();
break;
- case E_CTLOPTIONS :
- rItem.pItem = new SvtCTLOptions();
- break;
-
case E_FONTSUBSTCONFIG :
// no ref count rItem.pItem = new SvtFontSubstConfig();
break;
@@ -198,12 +179,8 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem)
rItem.pItem = new SvtHelpOptions();
break;
- case E_LANGUAGEOPTIONS :
-// capsulate CTL and CJL options ! rItem.pItem = new SvtLanguageOptions();
- break;
-
- case E_MISCCFG :
-// no ref count rItem.pItem = new SfxMiscCfg();
+ case E_MENUOPTIONS :
+ rItem.pItem = new SvtMenuOptions();
break;
case E_PRINTOPTIONS :
@@ -214,17 +191,6 @@ void ItemHolder2::impl_newItem(TItemInfo& rItem)
rItem.pItem = new SvtPrintFileOptions();
break;
- case E_SYSLOCALEOPTIONS :
- rItem.pItem = new SvtSysLocaleOptions();
- break;
-
- case E_UNDOOPTIONS :
- rItem.pItem = new SvtUndoOptions();
- break;
-
- case E_USEROPTIONS :
- rItem.pItem = new SvtUserOptions();
- break;
case E_MISCOPTIONS :
rItem.pItem = new SvtMiscOptions();
break;
diff --git a/svtools/source/config/itemholder2.hxx b/svtools/source/config/itemholder2.hxx
index d32eee1fc093..192df8f746c9 100644
--- a/svtools/source/config/itemholder2.hxx
+++ b/svtools/source/config/itemholder2.hxx
@@ -34,7 +34,7 @@
//-----------------------------------------------
// includes
-#include "itemholderbase.hxx"
+#include <unotools/itemholderbase.hxx>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XEventListener.hpp>
diff --git a/svtools/source/config/itemholderbase.hxx b/svtools/source/config/itemholderbase.hxx
deleted file mode 100644
index b5c1dd5d57d0..000000000000
--- a/svtools/source/config/itemholderbase.hxx
+++ /dev/null
@@ -1,131 +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: itemholderbase.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 INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_
-#define INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_
-
-//-----------------------------------------------
-// includes
-
-#include <vector>
-#include <osl/mutex.hxx>
-
-namespace svt { namespace detail { class Options; } }
-
-//-----------------------------------------------
-// definitions
-
-struct ItemHolderMutexBase
-{
- ::osl::Mutex m_aLock;
-};
-
-enum EItem
-{
- E_ACCELCFG , //
- E_ACCESSIBILITYOPTIONS , // 2
- E_ADDXMLTOSTORAGEOPTIONS , //
- E_APEARCFG , // 2
-
- E_CJKOPTIONS , // 2
- E_CMDOPTIONS , //
- E_COLORCFG , // 2
- E_COMPATIBILITY , //
- E_CTLOPTIONS , // 2
-
- E_DEFAULTOPTIONS , //
- E_DYNAMICMENUOPTIONS , //
-
- E_EVENTCFG , //
- E_EXTENDEDSECURITYOPTIONS , //
-
- E_FLTRCFG , //
- E_FONTOPTIONS , //
- E_FONTSUBSTCONFIG , // 2
-
- E_HELPOPTIONS , // 2
- E_HISTORYOPTIONS , //
-
- E_INETOPTIONS , //
- E_INTERNALOPTIONS , //
-
- E_JAVAOPTIONS , //
-
- E_LANGUAGEOPTIONS , // 2
- E_LINGUCFG , //
- E_LOCALISATIONOPTIONS , //
-
- E_MENUOPTIONS , //
- E_MISCCFG , // 2
- E_MISCOPTIONS , //
- E_MODULEOPTIONS , //
-
- E_OPTIONSDLGOPTIONS , //
-
- E_PATHOPTIONS , //
- E_PRINTOPTIONS , // 2
- E_PRINTFILEOPTIONS , // 2
- E_PRINTWARNINGOPTIONS , //
-
- E_REGOPTIONS , //
-
- E_SAVEOPTIONS , //
- E_SEARCHOPT , //
- E_SECURITYOPTIONS , //
- E_SOURCEVIEWCONFIG , //
- E_STARTOPTIONS , //
- E_SYSLOCALEOPTIONS , // 2
-
- E_UNDOOPTIONS , // 2
- E_USEROPTIONS , // 2
-
- E_VIEWOPTIONS_DIALOG , //
- E_VIEWOPTIONS_TABDIALOG , //
- E_VIEWOPTIONS_TABPAGE , //
- E_VIEWOPTIONS_WINDOW , //
-
- E_WORKINGSETOPTIONS , //
-
- E_XMLACCELCFG //
-};
-
-struct TItemInfo
-{
- TItemInfo()
- : pItem(0)
- {}
-
- svt::detail::Options * pItem;
- EItem eItem;
-};
-
-typedef ::std::vector< TItemInfo > TItems;
-
-#endif // INCLUDED_SVTOOLS_ITEMHOLDERBASE_HXX_
diff --git a/svtools/source/config/javaoptions.cxx b/svtools/source/config/javaoptions.cxx
deleted file mode 100644
index 7915f0042614..000000000000
--- a/svtools/source/config/javaoptions.cxx
+++ /dev/null
@@ -1,367 +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: javaoptions.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-
-#ifndef _SVTOOLS_JAVAPTIONS_HXX
-#include <javaoptions.hxx>
-#endif
-#include <com/sun/star/uno/Any.h>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/logfile.hxx>
-
-
-using namespace ::com::sun::star::uno;
-using namespace ::rtl;
-
-#define C2U(cChar) OUString::createFromAscii(cChar)
-#define CFG_READONLY_DEFAULT sal_False
-/* -----------------------------10.04.01 12:39--------------------------------
-
- ---------------------------------------------------------------------------*/
-class SvtExecAppletsItem_Impl : public utl::ConfigItem
-{
- sal_Bool bExecute;
- sal_Bool bRO;
-public:
- SvtExecAppletsItem_Impl();
-
- virtual void Commit();
-
- sal_Bool IsExecuteApplets() const {return bExecute;}
- void SetExecuteApplets(sal_Bool bSet);
- sal_Bool IsReadOnly() const {return bRO;}
-};
-/* -----------------------------10.02.2003 07:46------------------------------
-
- ---------------------------------------------------------------------------*/
-void SvtExecAppletsItem_Impl::SetExecuteApplets(sal_Bool bSet)
-{
- OSL_ENSURE(!bRO, "SvtExecAppletsItem_Impl::SetExecuteApplets()\nYou tried to write on a readonly value!\n");
- if (!bRO)
- {
- bExecute = bSet;
- SetModified();
- }
-}
-/* -----------------------------18.05.01 14:44--------------------------------
-
- ---------------------------------------------------------------------------*/
-SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl() :
- utl::ConfigItem(C2U("Office.Common/Java/Applet")),
- bExecute (sal_False ),
- bRO (CFG_READONLY_DEFAULT )
-{
- RTL_LOGFILE_CONTEXT(aLog, "svtools SvtExecAppletsItem_Impl::SvtExecAppletsItem_Impl()");
-
- Sequence< OUString > aNames(1);
- aNames.getArray()[0] = C2U("Enable");
- Sequence< Any > aValues = GetProperties(aNames);
- Sequence< sal_Bool > aROStates = GetReadOnlyStates(aNames);
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- if(aValues.getLength() && aROStates.getLength() && pValues[0].hasValue())
- {
- bExecute = *(sal_Bool*)pValues[0].getValue();
- bRO = pROStates[0];
- }
-}
-void SvtExecAppletsItem_Impl::Commit()
-{
- if (bRO)
- return;
-
- Sequence< OUString > aNames(1);
- aNames.getArray()[0] = C2U("Enable");
- Sequence< Any > aValues(1);
- aValues.getArray()[0].setValue(&bExecute, ::getBooleanCppuType());
- PutProperties(aNames, aValues);
-}
-
-
-struct SvtJavaOptions_Impl
-{
- SvtExecAppletsItem_Impl aExecItem;
- Sequence<OUString> aPropertyNames;
- sal_Bool bEnabled;
- sal_Bool bSecurity;
- sal_Int32 nNetAccess;
- rtl::OUString sUserClassPath;
-
- sal_Bool bROEnabled;
- sal_Bool bROSecurity;
- sal_Bool bRONetAccess;
- sal_Bool bROUserClassPath;
-
- SvtJavaOptions_Impl() :
- aPropertyNames(4),
- bEnabled (sal_False),
- bSecurity (sal_False),
- nNetAccess (0),
- bROEnabled (CFG_READONLY_DEFAULT),
- bROSecurity (CFG_READONLY_DEFAULT),
- bRONetAccess (CFG_READONLY_DEFAULT),
- bROUserClassPath (CFG_READONLY_DEFAULT)
- {
- OUString* pNames = aPropertyNames.getArray();
- pNames[0] = C2U("Enable");
- pNames[1] = C2U("Security");
- pNames[2] = C2U("NetAccess");
- pNames[3] = C2U("UserClassPath");
- }
-};
-/* -----------------------------18.05.01 13:28--------------------------------
-
- ---------------------------------------------------------------------------*/
-SvtJavaOptions::SvtJavaOptions() :
- utl::ConfigItem(C2U("Office.Java/VirtualMachine")),
- pImpl(new SvtJavaOptions_Impl)
-{
- RTL_LOGFILE_CONTEXT(aLog, "svtools SvtJavaOptions::SvtJavaOptions()");
-
- Sequence< Any > aValues = GetProperties(pImpl->aPropertyNames);
- Sequence< sal_Bool > aROStates = GetReadOnlyStates(pImpl->aPropertyNames);
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- if ( aValues.getLength() == pImpl->aPropertyNames.getLength() && aROStates.getLength() == pImpl->aPropertyNames.getLength() )
- {
- for ( int nProp = 0; nProp < pImpl->aPropertyNames.getLength(); nProp++ )
- {
- if( pValues[nProp].hasValue() )
- {
- switch ( nProp )
- {
- case 0: pImpl->bEnabled = *(sal_Bool*)pValues[nProp].getValue(); break;
- case 1: pImpl->bSecurity = *(sal_Bool*)pValues[nProp].getValue();break;
- case 2: pValues[nProp] >>= pImpl->nNetAccess; break;
- case 3: pValues[nProp] >>= pImpl->sUserClassPath; break;
- }
- }
- }
- pImpl->bROEnabled = pROStates[0];
- pImpl->bROSecurity = pROStates[1];
- pImpl->bRONetAccess = pROStates[2];
- pImpl->bROUserClassPath = pROStates[3];
- }
-}
-/* -----------------------------18.05.01 13:28--------------------------------
-
- ---------------------------------------------------------------------------*/
-SvtJavaOptions::~SvtJavaOptions()
-{
- delete pImpl;
-}
-/*-- 18.05.01 13:28:35---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtJavaOptions::Commit()
-{
- pImpl->aExecItem.Commit();
-
- sal_Int32 nOrgCount = pImpl->aPropertyNames.getLength();
- Sequence< OUString > aNames(nOrgCount);
- Sequence< Any > aValues(nOrgCount);
- sal_Int32 nRealCount = 0;
-
- const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < nOrgCount; nProp++)
- {
- switch(nProp)
- {
- case 0:
- {
- if (!pImpl->bROEnabled)
- {
- aValues[nRealCount].setValue(&pImpl->bEnabled, rType);
- aNames[nRealCount] = pImpl->aPropertyNames[nProp];
- ++nRealCount;
- }
- }
- break;
- case 1:
- {
- if (!pImpl->bROSecurity)
- {
- aValues[nRealCount].setValue(&pImpl->bSecurity, rType);
- aNames[nRealCount] = pImpl->aPropertyNames[nProp];
- ++nRealCount;
- }
- }
- break;
- case 2:
- {
- if (!pImpl->bRONetAccess)
- {
- aValues[nRealCount] <<= pImpl->nNetAccess;
- aNames[nRealCount] = pImpl->aPropertyNames[nProp];
- ++nRealCount;
- }
- }
- break;
- case 3:
- {
- if (!pImpl->bROUserClassPath)
- {
- aValues[nRealCount] <<= pImpl->sUserClassPath;
- aNames[nRealCount] = pImpl->aPropertyNames[nProp];
- ++nRealCount;
- }
- }
- break;
- }
- }
- aValues.realloc(nRealCount);
- aNames.realloc(nRealCount);
- PutProperties(aNames,aValues);
-}
-/*-- 18.05.01 13:28:35---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtJavaOptions::IsEnabled() const
-{
- return pImpl->bEnabled;
-}
-/*-- 18.05.01 13:28:35---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtJavaOptions::IsSecurity()const
-{
- return pImpl->bSecurity;
-}
-/*-- 18.05.01 13:28:35---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Int32 SvtJavaOptions::GetNetAccess() const
-{
- return pImpl->nNetAccess;
-}
-/*-- 18.05.01 13:28:36---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-rtl::OUString& SvtJavaOptions::GetUserClassPath()const
-{
- return pImpl->sUserClassPath;
-}
-/*-- 18.05.01 13:28:37---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtJavaOptions::SetEnabled(sal_Bool bSet)
-{
- OSL_ENSURE(!pImpl->bROEnabled, "SvtJavaOptions::SetEnabled()\nYou tried to write on a readonly value!\n");
- if(!pImpl->bROEnabled && pImpl->bEnabled != bSet)
- {
- pImpl->bEnabled = bSet;
- SetModified();
- }
-}
-/*-- 18.05.01 13:28:38---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtJavaOptions::SetSecurity(sal_Bool bSet)
-{
- OSL_ENSURE(!pImpl->bROSecurity, "SvtJavaOptions::SetSecurity()\nYou tried to write on a readonly value!\n");
- if(!pImpl->bROSecurity && pImpl->bSecurity != bSet)
- {
- pImpl->bSecurity = bSet;
- SetModified();
- }
-}
-/*-- 18.05.01 13:28:38---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtJavaOptions::SetNetAccess(sal_Int32 nSet)
-{
- OSL_ENSURE(!pImpl->bRONetAccess, "SvtJavaOptions::SetNetAccess()\nYou tried to write on a readonly value!\n");
- if(!pImpl->bRONetAccess && pImpl->nNetAccess != nSet)
- {
- pImpl->nNetAccess = nSet;
- SetModified();
- }
-}
-/*-- 18.05.01 13:28:38---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtJavaOptions::SetUserClassPath(const rtl::OUString& rSet)
-{
- OSL_ENSURE(!pImpl->bROUserClassPath, "SvtJavaOptions::SetUserClassPath()\nYou tried to write on a readonly value!\n");
- if(!pImpl->bROUserClassPath && pImpl->sUserClassPath != rSet)
- {
- pImpl->sUserClassPath = rSet;
- SetModified();
- }
-}
-
-/*-- 18.05.01 14:34:32---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtJavaOptions::IsExecuteApplets() const
-{
- return pImpl->aExecItem.IsExecuteApplets();
-}
-/*-- 18.05.01 14:34:32---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtJavaOptions::SetExecuteApplets(sal_Bool bSet)
-{
- if(!pImpl->aExecItem.IsReadOnly() && pImpl->aExecItem.IsExecuteApplets() != bSet)
- {
- pImpl->aExecItem.SetExecuteApplets(bSet);
- SetModified();
- }
-}
-/*--10.02.2003 08:40---------------------------------------------------
-
------------------------------------------------------------------------*/
-sal_Bool SvtJavaOptions::IsReadOnly( EOption eOption ) const
-{
- sal_Bool bRO = sal_True;
- switch(eOption)
- {
- case E_ENABLED :
- bRO = pImpl->bROEnabled;
- break;
- case E_SECURITY :
- bRO = pImpl->bROSecurity;
- break;
- case E_NETACCESS :
- bRO = pImpl->bRONetAccess;
- break;
- case E_USERCLASSPATH :
- bRO = pImpl->bROUserClassPath;
- break;
- case E_EXECUTEAPPLETS :
- bRO = pImpl->aExecItem.IsReadOnly();
- break;
- }
- return bRO;
-}
diff --git a/svtools/source/config/languageoptions.cxx b/svtools/source/config/languageoptions.cxx
deleted file mode 100644
index 0dffafee86d2..000000000000
--- a/svtools/source/config/languageoptions.cxx
+++ /dev/null
@@ -1,283 +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: languageoptions.cxx,v $
- * $Revision: 1.21 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include <svtools/languageoptions.hxx>
-#include <svtools/cjkoptions.hxx>
-#include <svtools/ctloptions.hxx>
-#include <vcl/svapp.hxx>
-#include <i18npool/mslangid.hxx>
-#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/instance.hxx>
-#include <com/sun/star/i18n/ScriptType.hpp>
-
-using namespace ::com::sun::star;
-// global ----------------------------------------------------------------------
-
-namespace { struct ALMutex : public rtl::Static< ::osl::Mutex, ALMutex > {}; }
-
-// class SvtLanguageOptions ----------------------------------------------------
-
-SvtLanguageOptions::SvtLanguageOptions( sal_Bool _bDontLoad )
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( ALMutex::get() );
-
- m_pCJKOptions = new SvtCJKOptions( _bDontLoad );
- m_pCTLOptions = new SvtCTLOptions( _bDontLoad );
- StartListening(*m_pCTLOptions);
-}
-//------------------------------------------------------------------------------
-SvtLanguageOptions::~SvtLanguageOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( ALMutex::get() );
-
- delete m_pCJKOptions;
- delete m_pCTLOptions;
-}
-//------------------------------------------------------------------------------
-// CJK options -----------------------------------------------------------------
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsCJKFontEnabled() const
-{
- return m_pCJKOptions->IsCJKFontEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsVerticalTextEnabled() const
-{
- return m_pCJKOptions->IsVerticalTextEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsAsianTypographyEnabled() const
-{
- return m_pCJKOptions->IsAsianTypographyEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsJapaneseFindEnabled() const
-{
- return m_pCJKOptions->IsJapaneseFindEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsRubyEnabled() const
-{
- return m_pCJKOptions->IsRubyEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsChangeCaseMapEnabled() const
-{
- return m_pCJKOptions->IsChangeCaseMapEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsDoubleLinesEnabled() const
-{
- return m_pCJKOptions->IsDoubleLinesEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsEmphasisMarksEnabled() const
-{
- return m_pCJKOptions->IsEmphasisMarksEnabled();
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsVerticalCallOutEnabled() const
-{
- return m_pCJKOptions->IsVerticalCallOutEnabled();
-}
-//------------------------------------------------------------------------------
-void SvtLanguageOptions::SetAll( sal_Bool _bSet )
-{
- m_pCJKOptions->SetAll( _bSet );
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsAnyEnabled() const
-{
- return m_pCJKOptions->IsAnyEnabled();
-}
-//------------------------------------------------------------------------------
-// CTL options -----------------------------------------------------------------
-//------------------------------------------------------------------------------
-void SvtLanguageOptions::SetCTLFontEnabled( sal_Bool _bEnabled )
-{
- m_pCTLOptions->SetCTLFontEnabled( _bEnabled );
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsCTLFontEnabled() const
-{
- return m_pCTLOptions->IsCTLFontEnabled();
-}
-//------------------------------------------------------------------------------
-void SvtLanguageOptions::SetCTLSequenceChecking( sal_Bool _bEnabled )
-{
- m_pCTLOptions->SetCTLSequenceChecking( _bEnabled );
-}
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsCTLSequenceChecking() const
-{
- return m_pCTLOptions->IsCTLSequenceChecking();
-}
-/*-- 26.09.2005 15:48:23---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtLanguageOptions::SetCTLSequenceCheckingRestricted( sal_Bool _bEnable )
-{
- m_pCTLOptions->SetCTLSequenceCheckingRestricted( _bEnable );
-}
-/*-- 26.09.2005 15:48:23---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtLanguageOptions::IsCTLSequenceCheckingRestricted( void ) const
-{
- return m_pCTLOptions->IsCTLSequenceCheckingRestricted();
-}
-/*-- 26.09.2005 15:48:23---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtLanguageOptions::SetCTLSequenceCheckingTypeAndReplace( sal_Bool _bEnable )
-{
- m_pCTLOptions->SetCTLSequenceCheckingTypeAndReplace( _bEnable );
-}
-/*-- 26.09.2005 15:48:24---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtLanguageOptions::IsCTLSequenceCheckingTypeAndReplace() const
-{
- return m_pCTLOptions->IsCTLSequenceCheckingTypeAndReplace();
-}
-
-//------------------------------------------------------------------------------
-sal_Bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) const
-{
- sal_Bool bReadOnly = sal_False;
- switch(eOption)
- {
- // cjk options
- case SvtLanguageOptions::E_CJKFONT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_CJKFONT ); break;
- case SvtLanguageOptions::E_VERTICALTEXT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_VERTICALTEXT ); break;
- case SvtLanguageOptions::E_ASIANTYPOGRAPHY : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_ASIANTYPOGRAPHY); break;
- case SvtLanguageOptions::E_JAPANESEFIND : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_JAPANESEFIND ); break;
- case SvtLanguageOptions::E_RUBY : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_RUBY ); break;
- case SvtLanguageOptions::E_CHANGECASEMAP : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_CHANGECASEMAP ); break;
- case SvtLanguageOptions::E_DOUBLELINES : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_DOUBLELINES ); break;
- case SvtLanguageOptions::E_EMPHASISMARKS : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_EMPHASISMARKS ); break;
- case SvtLanguageOptions::E_VERTICALCALLOUT : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_VERTICALCALLOUT); break;
- case SvtLanguageOptions::E_ALLCJK : bReadOnly = m_pCJKOptions->IsReadOnly(SvtCJKOptions::E_ALL ); break;
- // ctl options
- case SvtLanguageOptions::E_CTLFONT : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLFONT ); break;
- case SvtLanguageOptions::E_CTLSEQUENCECHECKING : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLSEQUENCECHECKING); break;
- case SvtLanguageOptions::E_CTLCURSORMOVEMENT : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLCURSORMOVEMENT ); break;
- case SvtLanguageOptions::E_CTLTEXTNUMERALS : bReadOnly = m_pCTLOptions->IsReadOnly(SvtCTLOptions::E_CTLTEXTNUMERALS ); break;
- }
- return bReadOnly;
-}
-/* -----------------30.04.2003 11:03-----------------
-
- --------------------------------------------------*/
-void SvtLanguageOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
- Broadcast( rHint );
-}
-
-// -----------------------------------------------------------------------------
-// returns for a language the scripttype
-sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang )
-{
- if( LANGUAGE_DONTKNOW == nLang )
- nLang = LANGUAGE_ENGLISH_US;
- else if( LANGUAGE_SYSTEM == nLang )
- nLang = Application::GetSettings().GetLanguage();
-
- sal_Int16 nScriptType = MsLangId::getScriptType( nLang );
- USHORT nScript;
- switch (nScriptType)
- {
- case ::com::sun::star::i18n::ScriptType::ASIAN:
- nScript = SCRIPTTYPE_ASIAN;
- break;
- case ::com::sun::star::i18n::ScriptType::COMPLEX:
- nScript = SCRIPTTYPE_COMPLEX;
- break;
- default:
- nScript = SCRIPTTYPE_LATIN;
- }
- return nScript;
-}
-// -----------------------------------------------------------------------------
-
-
-/*-- 27.10.2005 08:18:01---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SvtSystemLanguageOptions::SvtSystemLanguageOptions() :
- utl::ConfigItem( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("System/L10N") ))
-{
- uno::Sequence< rtl::OUString > aPropertyNames(1);
- rtl::OUString* pNames = aPropertyNames.getArray();
- pNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SystemLocale"));
- uno::Sequence< uno::Any > aValues = GetProperties( aPropertyNames );
-
- if ( aValues.getLength() )
- {
- aValues[0]>>= m_sWin16SystemLocale;
- }
-}
-/*-- 27.10.2005 08:18:01---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SvtSystemLanguageOptions::~SvtSystemLanguageOptions()
-{
-}
-/*-- 27.10.2005 08:18:02---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtSystemLanguageOptions::Commit()
-{
- //does nothing
-}
-/*-- 27.10.2005 08:36:14---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-LanguageType SvtSystemLanguageOptions::GetWin16SystemLanguage()
-{
- if( m_sWin16SystemLocale.getLength() == 0 )
- return LANGUAGE_NONE;
- return MsLangId::convertIsoStringToLanguage( m_sWin16SystemLocale );
-}
-
-
diff --git a/svtools/source/config/lingucfg.cxx b/svtools/source/config/lingucfg.cxx
deleted file mode 100644
index 2b4e4d482c3f..000000000000
--- a/svtools/source/config/lingucfg.cxx
+++ /dev/null
@@ -1,1452 +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: lingucfg.cxx,v $
- * $Revision: 1.14 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-
-#include <com/sun/star/lang/Locale.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XNameReplace.hpp>
-#include "com/sun/star/util/XMacroExpander.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
-#include <rtl/uri.hxx>
-#include <vos/mutex.hxx>
-#include <i18npool/mslangid.hxx>
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-#include <svtools/lingucfg.hxx>
-#include <linguprops.hxx>
-
-#include <comphelper/processfactory.hxx>
-
-#include <itemholder1.hxx>
-
-using namespace rtl;
-using namespace com::sun::star;
-
-#define A2OU(x) ::rtl::OUString::createFromAscii( x )
-#define EXPAND_PROTOCOL "vnd.sun.star.expand:"
-#define FILE_PROTOCOL "file:///"
-
-///////////////////////////////////////////////////////////////////////////
-
-
-static osl::Mutex & GetOwnMutex()
-{
- static osl::Mutex aMutex;
- return aMutex;
-}
-
-
-///////////////////////////////////////////////////////////////////////////
-
-
-static BOOL lcl_SetLocale( INT16 &rLanguage, const uno::Any &rVal )
-{
- BOOL bSucc = FALSE;
-
- lang::Locale aNew;
- if (rVal >>= aNew) // conversion successful?
- {
- INT16 nNew = MsLangId::convertLocaleToLanguage( aNew );
- if (nNew != rLanguage)
- {
- rLanguage = nNew;
- bSucc = TRUE;
- }
- }
- return bSucc;
-}
-
-
-static inline const OUString lcl_LanguageToCfgLocaleStr( INT16 nLanguage )
-{
- OUString aRes;
- if (LANGUAGE_SYSTEM != nLanguage)
- aRes = MsLangId::convertLanguageToIsoString( nLanguage );
- return aRes;
-}
-
-
-static INT16 lcl_CfgAnyToLanguage( const uno::Any &rVal )
-{
- OUString aTmp;
- rVal >>= aTmp;
- return (aTmp.getLength() == 0) ? LANGUAGE_SYSTEM : MsLangId::convertIsoStringToLanguage( aTmp );
-}
-
-
-//////////////////////////////////////////////////////////////////////
-
-SvtLinguOptions::SvtLinguOptions()
-{
- nDefaultLanguage = LANGUAGE_NONE;
- nDefaultLanguage_CJK = LANGUAGE_NONE;
- nDefaultLanguage_CTL = LANGUAGE_NONE;
-
- // general options
- bIsUseDictionaryList =
- bIsIgnoreControlCharacters = TRUE;
-
- // spelling options
- bIsSpellCapitalization =
- bIsSpellSpecial = TRUE;
- bIsSpellAuto =
- bIsSpellReverse =
- bIsSpellWithDigits =
- bIsSpellUpperCase = FALSE;
-
- // text conversion options
- bIsIgnorePostPositionalWord = TRUE;
- bIsAutoCloseDialog =
- bIsShowEntriesRecentlyUsedFirst =
- bIsAutoReplaceUniqueEntries = FALSE;
- bIsDirectionToSimplified = TRUE;
- bIsUseCharacterVariants =
- bIsTranslateCommonTerms =
- bIsReverseMapping = FALSE;
-
- bROIsDirectionToSimplified =
- bROIsUseCharacterVariants =
- bROIsTranslateCommonTerms =
- bROIsReverseMapping = FALSE;
-
- // hyphenation options
- bIsHyphSpecial = TRUE;
- bIsHyphAuto = FALSE;
- nHyphMinLeading =
- nHyphMinTrailing = 2;
- nHyphMinWordLength = 0;
-
- nDataFilesChangedCheckValue = 0;
-
- //grammar options
- bIsGrammarAuto = sal_False,
- bIsGrammarInteractive = sal_False;
-
-}
-
-
-//////////////////////////////////////////////////////////////////////
-
-
-class SvtLinguConfigItem : public utl::ConfigItem
-{
- SvtLinguOptions aOpt;
-
- // disallow copy-constructor and assignment-operator for now
- SvtLinguConfigItem( const SvtLinguConfigItem & );
- SvtLinguConfigItem & operator = ( const SvtLinguConfigItem & );
-
- static BOOL GetHdlByName( INT32 &rnHdl, const OUString &rPropertyName, sal_Bool bFullPropName = sal_False );
- static const uno::Sequence< OUString > & GetPropertyNames();
- BOOL LoadOptions( const uno::Sequence< OUString > &rProperyNames );
- BOOL SaveOptions( const uno::Sequence< OUString > &rProperyNames );
-
-public:
- SvtLinguConfigItem();
- virtual ~SvtLinguConfigItem();
-
- // utl::ConfigItem
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString > &rPropertyNames );
- virtual void Commit();
-
- // make some protected functions of utl::ConfigItem public
- using utl::ConfigItem::GetNodeNames;
- using utl::ConfigItem::GetProperties;
- //using utl::ConfigItem::PutProperties;
- //using utl::ConfigItem::SetSetProperties;
- using utl::ConfigItem::ReplaceSetProperties;
- //using utl::ConfigItem::GetReadOnlyStates;
-
-
- com::sun::star::uno::Any
- GetProperty( const rtl::OUString &rPropertyName ) const;
- com::sun::star::uno::Any
- GetProperty( INT32 nPropertyHandle ) const;
-
- BOOL SetProperty( const rtl::OUString &rPropertyName,
- const com::sun::star::uno::Any &rValue );
- BOOL SetProperty( INT32 nPropertyHandle,
- const com::sun::star::uno::Any &rValue );
-
- BOOL GetOptions( SvtLinguOptions &rOptions ) const;
- BOOL SetOptions( const SvtLinguOptions &rOptions );
-
- BOOL IsReadOnly( const rtl::OUString &rPropertyName ) const;
- BOOL IsReadOnly( INT32 nPropertyHandle ) const;
-};
-
-
-SvtLinguConfigItem::SvtLinguConfigItem() :
- utl::ConfigItem( String::CreateFromAscii( "Office.Linguistic" ) )
-{
- LoadOptions( GetPropertyNames() );
- ClearModified();
-
- // request notify events when properties change
- EnableNotification( GetPropertyNames() );
-}
-
-
-SvtLinguConfigItem::~SvtLinguConfigItem()
-{
- //! Commit (SaveOptions) will be called by the d-tor of the base called !
-}
-
-
-void SvtLinguConfigItem::Notify( const uno::Sequence< OUString > &rPropertyNames )
-{
- LoadOptions( rPropertyNames );
-}
-
-
-void SvtLinguConfigItem::Commit()
-{
- SaveOptions( GetPropertyNames() );
-}
-
-
-static struct NamesToHdl
-{
- const char *pFullPropName; // full qualified name as used in configuration
- const char *pPropName; // property name only (atom) of above
- INT32 nHdl; // numeric handle representing the property
-}aNamesToHdl[] =
-{
-{/* 0 */ "General/DefaultLocale", UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE},
-{/* 1 */ "General/DictionaryList/ActiveDictionaries", UPN_ACTIVE_DICTIONARIES, UPH_ACTIVE_DICTIONARIES},
-{/* 2 */ "General/DictionaryList/IsUseDictionaryList", UPN_IS_USE_DICTIONARY_LIST, UPH_IS_USE_DICTIONARY_LIST},
-{/* 3 */ "General/IsIgnoreControlCharacters", UPN_IS_IGNORE_CONTROL_CHARACTERS, UPH_IS_IGNORE_CONTROL_CHARACTERS},
-{/* 5 */ "General/DefaultLocale_CJK", UPN_DEFAULT_LOCALE_CJK, UPH_DEFAULT_LOCALE_CJK},
-{/* 6 */ "General/DefaultLocale_CTL", UPN_DEFAULT_LOCALE_CTL, UPH_DEFAULT_LOCALE_CTL},
-
-{/* 7 */ "SpellChecking/IsSpellUpperCase", UPN_IS_SPELL_UPPER_CASE, UPH_IS_SPELL_UPPER_CASE},
-{/* 8 */ "SpellChecking/IsSpellWithDigits", UPN_IS_SPELL_WITH_DIGITS, UPH_IS_SPELL_WITH_DIGITS},
-{/* 9 */ "SpellChecking/IsSpellCapitalization", UPN_IS_SPELL_CAPITALIZATION, UPH_IS_SPELL_CAPITALIZATION},
-{/* 10 */ "SpellChecking/IsSpellAuto", UPN_IS_SPELL_AUTO, UPH_IS_SPELL_AUTO},
-{/* 11 */ "SpellChecking/IsSpellSpecial", UPN_IS_SPELL_SPECIAL, UPH_IS_SPELL_SPECIAL},
-{/* 14 */ "SpellChecking/IsReverseDirection", UPN_IS_WRAP_REVERSE, UPH_IS_WRAP_REVERSE},
-
-{/* 15 */ "Hyphenation/MinLeading", UPN_HYPH_MIN_LEADING, UPH_HYPH_MIN_LEADING},
-{/* 16 */ "Hyphenation/MinTrailing", UPN_HYPH_MIN_TRAILING, UPH_HYPH_MIN_TRAILING},
-{/* 17 */ "Hyphenation/MinWordLength", UPN_HYPH_MIN_WORD_LENGTH, UPH_HYPH_MIN_WORD_LENGTH},
-{/* 18 */ "Hyphenation/IsHyphSpecial", UPN_IS_HYPH_SPECIAL, UPH_IS_HYPH_SPECIAL},
-{/* 19 */ "Hyphenation/IsHyphAuto", UPN_IS_HYPH_AUTO, UPH_IS_HYPH_AUTO},
-
-{/* 20 */ "TextConversion/ActiveConversionDictionaries", UPN_ACTIVE_CONVERSION_DICTIONARIES, UPH_ACTIVE_CONVERSION_DICTIONARIES},
-{/* 21 */ "TextConversion/IsIgnorePostPositionalWord", UPN_IS_IGNORE_POST_POSITIONAL_WORD, UPH_IS_IGNORE_POST_POSITIONAL_WORD},
-{/* 22 */ "TextConversion/IsAutoCloseDialog", UPN_IS_AUTO_CLOSE_DIALOG, UPH_IS_AUTO_CLOSE_DIALOG},
-{/* 23 */ "TextConversion/IsShowEntriesRecentlyUsedFirst", UPN_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST, UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST},
-{/* 24 */ "TextConversion/IsAutoReplaceUniqueEntries", UPN_IS_AUTO_REPLACE_UNIQUE_ENTRIES, UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES},
-{/* 25 */ "TextConversion/IsDirectionToSimplified", UPN_IS_DIRECTION_TO_SIMPLIFIED, UPH_IS_DIRECTION_TO_SIMPLIFIED},
-{/* 26 */ "TextConversion/IsUseCharacterVariants", UPN_IS_USE_CHARACTER_VARIANTS, UPH_IS_USE_CHARACTER_VARIANTS},
-{/* 27 */ "TextConversion/IsTranslateCommonTerms", UPN_IS_TRANSLATE_COMMON_TERMS, UPH_IS_TRANSLATE_COMMON_TERMS},
-{/* 28 */ "TextConversion/IsReverseMapping", UPN_IS_REVERSE_MAPPING, UPH_IS_REVERSE_MAPPING},
-
-{/* 29 */ "ServiceManager/DataFilesChangedCheckValue", UPN_DATA_FILES_CHANGED_CHECK_VALUE, UPH_DATA_FILES_CHANGED_CHECK_VALUE},
-
-{/* 30 */ "GrammarChecking/IsAutoCheck", UPN_IS_GRAMMAR_AUTO, UPH_IS_GRAMMAR_AUTO},
-{/* 31 */ "GrammarChecking/IsInteractiveCheck", UPN_IS_GRAMMAR_INTERACTIVE, UPH_IS_GRAMMAR_INTERACTIVE},
-
- /* similar to entry 0 (thus no own configuration entry) but with different property name and type */
-{ NULL, UPN_DEFAULT_LANGUAGE, UPH_DEFAULT_LANGUAGE},
-
-{ NULL, NULL, -1}
-};
-
-
-const uno::Sequence< OUString > & SvtLinguConfigItem::GetPropertyNames()
-{
- static uno::Sequence< OUString > aNames;
- static sal_Bool bInitialized = sal_False;
-
- if (!bInitialized)
- {
- INT32 nMax = sizeof(aNamesToHdl) / sizeof(aNamesToHdl[0]);
-
- aNames.realloc( nMax );
- OUString *pNames = aNames.getArray();
- INT32 nIdx = 0;
- for (INT32 i = 0; i < nMax; ++i)
- {
- const sal_Char *pFullPropName = aNamesToHdl[i].pFullPropName;
- if (pFullPropName)
- pNames[ nIdx++ ] = A2OU( pFullPropName );
- }
- aNames.realloc( nIdx );
- bInitialized = sal_True;
- }
- return aNames;
-}
-
-
-BOOL SvtLinguConfigItem::GetHdlByName(
- INT32 &rnHdl,
- const OUString &rPropertyName,
- sal_Bool bFullPropName )
-{
- NamesToHdl *pEntry = &aNamesToHdl[0];
-
- if (bFullPropName)
- {
- while (pEntry && pEntry->pFullPropName != NULL)
- {
- if (0 == rPropertyName.compareToAscii( pEntry->pFullPropName ))
- {
- rnHdl = pEntry->nHdl;
- break;
- }
- ++pEntry;
- }
- return pEntry && pEntry->pFullPropName != NULL;
- }
- else
- {
- while (pEntry && pEntry->pPropName != NULL)
- {
- if (0 == rPropertyName.compareToAscii( pEntry->pPropName ))
- {
- rnHdl = pEntry->nHdl;
- break;
- }
- ++pEntry;
- }
- return pEntry && pEntry->pPropName != NULL;
- }
-}
-
-
-uno::Any SvtLinguConfigItem::GetProperty( const OUString &rPropertyName ) const
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- INT32 nHdl;
- return GetHdlByName( nHdl, rPropertyName ) ? GetProperty( nHdl ) : uno::Any();
-}
-
-
-uno::Any SvtLinguConfigItem::GetProperty( INT32 nPropertyHandle ) const
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- uno::Any aRes;
-
- const INT16 *pnVal = 0;
- const BOOL *pbVal = 0;
- const INT32 *pnInt32Val = 0;
-
- const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt;
- switch (nPropertyHandle)
- {
- case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break;
- case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break;
- case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break;
- case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break;
- case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break;
- case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break;
- case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break;
- case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break;
- case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break;
- case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break;
- case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break;
- case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break;
- case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break;
- case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break;
- case UPH_ACTIVE_DICTIONARIES :
- {
- aRes <<= rOpt.aActiveDics;
- break;
- }
- case UPH_ACTIVE_CONVERSION_DICTIONARIES :
- {
- aRes <<= rOpt.aActiveConvDics;
- break;
- }
- case UPH_DEFAULT_LOCALE :
- {
- lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage, false ) );
- aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
- break;
- }
- case UPH_DEFAULT_LOCALE_CJK :
- {
- lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CJK, false ) );
- aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
- break;
- }
- case UPH_DEFAULT_LOCALE_CTL :
- {
- lang::Locale aLocale( MsLangId::convertLanguageToLocale( rOpt.nDefaultLanguage_CTL, false ) );
- aRes.setValue( &aLocale, ::getCppuType((lang::Locale*)0 ));
- break;
- }
- case UPH_IS_IGNORE_POST_POSITIONAL_WORD : pbVal = &rOpt.bIsIgnorePostPositionalWord; break;
- case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break;
- case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : pbVal = &rOpt.bIsShowEntriesRecentlyUsedFirst; break;
- case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : pbVal = &rOpt.bIsAutoReplaceUniqueEntries; break;
-
- case UPH_IS_DIRECTION_TO_SIMPLIFIED: pbVal = &rOpt.bIsDirectionToSimplified; break;
- case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break;
- case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break;
- case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break;
-
- case UPH_DATA_FILES_CHANGED_CHECK_VALUE : pnInt32Val = &rOpt.nDataFilesChangedCheckValue; break;
- case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break;
- case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break;
- default :
- DBG_ASSERT( 0, "unexpected property handle" );
- }
-
- if (pbVal)
- aRes <<= *pbVal;
- else if (pnVal)
- aRes <<= *pnVal;
- else if (pnInt32Val)
- aRes <<= *pnInt32Val;
-
- return aRes;
-}
-
-
-BOOL SvtLinguConfigItem::SetProperty( const OUString &rPropertyName, const uno::Any &rValue )
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- BOOL bSucc = FALSE;
- INT32 nHdl;
- if (GetHdlByName( nHdl, rPropertyName ))
- bSucc = SetProperty( nHdl, rValue );
- return bSucc;
-}
-
-
-BOOL SvtLinguConfigItem::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue )
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- BOOL bSucc = FALSE;
- if (!rValue.hasValue())
- return bSucc;
-
- BOOL bMod = FALSE;
-
- INT16 *pnVal = 0;
- BOOL *pbVal = 0;
- INT32 *pnInt32Val = 0;
-
- SvtLinguOptions &rOpt = aOpt;
- switch (nPropertyHandle)
- {
- case UPH_IS_USE_DICTIONARY_LIST : pbVal = &rOpt.bIsUseDictionaryList; break;
- case UPH_IS_IGNORE_CONTROL_CHARACTERS : pbVal = &rOpt.bIsIgnoreControlCharacters; break;
- case UPH_IS_HYPH_AUTO : pbVal = &rOpt.bIsHyphAuto; break;
- case UPH_IS_HYPH_SPECIAL : pbVal = &rOpt.bIsHyphSpecial; break;
- case UPH_IS_SPELL_AUTO : pbVal = &rOpt.bIsSpellAuto; break;
- case UPH_IS_SPELL_SPECIAL : pbVal = &rOpt.bIsSpellSpecial; break;
- case UPH_IS_WRAP_REVERSE : pbVal = &rOpt.bIsSpellReverse; break;
- case UPH_DEFAULT_LANGUAGE : pnVal = &rOpt.nDefaultLanguage; break;
- case UPH_IS_SPELL_CAPITALIZATION : pbVal = &rOpt.bIsSpellCapitalization; break;
- case UPH_IS_SPELL_WITH_DIGITS : pbVal = &rOpt.bIsSpellWithDigits; break;
- case UPH_IS_SPELL_UPPER_CASE : pbVal = &rOpt.bIsSpellUpperCase; break;
- case UPH_HYPH_MIN_LEADING : pnVal = &rOpt.nHyphMinLeading; break;
- case UPH_HYPH_MIN_TRAILING : pnVal = &rOpt.nHyphMinTrailing; break;
- case UPH_HYPH_MIN_WORD_LENGTH : pnVal = &rOpt.nHyphMinWordLength; break;
- case UPH_ACTIVE_DICTIONARIES :
- {
- rValue >>= rOpt.aActiveDics;
- bMod = TRUE;
- break;
- }
- case UPH_ACTIVE_CONVERSION_DICTIONARIES :
- {
- rValue >>= rOpt.aActiveConvDics;
- bMod = TRUE;
- break;
- }
- case UPH_DEFAULT_LOCALE :
- {
- bSucc = lcl_SetLocale( rOpt.nDefaultLanguage, rValue );
- bMod = bSucc;
- break;
- }
- case UPH_DEFAULT_LOCALE_CJK :
- {
- bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CJK, rValue );
- bMod = bSucc;
- break;
- }
- case UPH_DEFAULT_LOCALE_CTL :
- {
- bSucc = lcl_SetLocale( rOpt.nDefaultLanguage_CTL, rValue );
- bMod = bSucc;
- break;
- }
- case UPH_IS_IGNORE_POST_POSITIONAL_WORD : pbVal = &rOpt.bIsIgnorePostPositionalWord; break;
- case UPH_IS_AUTO_CLOSE_DIALOG : pbVal = &rOpt.bIsAutoCloseDialog; break;
- case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : pbVal = &rOpt.bIsShowEntriesRecentlyUsedFirst; break;
- case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : pbVal = &rOpt.bIsAutoReplaceUniqueEntries; break;
-
- case UPH_IS_DIRECTION_TO_SIMPLIFIED : pbVal = &rOpt.bIsDirectionToSimplified; break;
- case UPH_IS_USE_CHARACTER_VARIANTS : pbVal = &rOpt.bIsUseCharacterVariants; break;
- case UPH_IS_TRANSLATE_COMMON_TERMS : pbVal = &rOpt.bIsTranslateCommonTerms; break;
- case UPH_IS_REVERSE_MAPPING : pbVal = &rOpt.bIsReverseMapping; break;
-
- case UPH_DATA_FILES_CHANGED_CHECK_VALUE : pnInt32Val = &rOpt.nDataFilesChangedCheckValue; break;
- case UPH_IS_GRAMMAR_AUTO: pbVal = &rOpt.bIsGrammarAuto; break;
- case UPH_IS_GRAMMAR_INTERACTIVE: pbVal = &rOpt.bIsGrammarInteractive; break;
- default :
- DBG_ASSERT( 0, "unexpected property handle" );
- }
-
- if (pbVal)
- {
- BOOL bNew = BOOL();
- if (rValue >>= bNew)
- {
- if (bNew != *pbVal)
- {
- *pbVal = bNew;
- bMod = TRUE;
- }
- bSucc = TRUE;
- }
- }
- else if (pnVal)
- {
- INT16 nNew = INT16();
- if (rValue >>= nNew)
- {
- if (nNew != *pnVal)
- {
- *pnVal = nNew;
- bMod = TRUE;
- }
- bSucc = TRUE;
- }
- }
- else if (pnInt32Val)
- {
- INT32 nNew = INT32();
- if (rValue >>= nNew)
- {
- if (nNew != *pnInt32Val)
- {
- *pnInt32Val = nNew;
- bMod = TRUE;
- }
- bSucc = TRUE;
- }
- }
-
- if (bMod)
- SetModified();
-
- return bSucc;
-}
-
-
-BOOL SvtLinguConfigItem::GetOptions( SvtLinguOptions &rOptions ) const
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- rOptions = aOpt;
- return TRUE;
-}
-
-
-BOOL SvtLinguConfigItem::SetOptions( const SvtLinguOptions &rOptions )
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- aOpt = rOptions;
- SetModified();
- return TRUE;
-}
-
-
-BOOL SvtLinguConfigItem::LoadOptions( const uno::Sequence< OUString > &rProperyNames )
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- BOOL bRes = FALSE;
-
- const OUString *pProperyNames = rProperyNames.getConstArray();
- INT32 nProps = rProperyNames.getLength();
-
- const uno::Sequence< uno::Any > aValues = GetProperties( rProperyNames );
- const uno::Sequence< sal_Bool > aROStates = GetReadOnlyStates( rProperyNames );
-
- if (nProps && aValues.getLength() == nProps && aROStates.getLength() == nProps)
- {
- SvtLinguOptions &rOpt = aOpt;
-
- const uno::Any *pValue = aValues.getConstArray();
- const sal_Bool *pROStates = aROStates.getConstArray();
- for (INT32 i = 0; i < nProps; ++i)
- {
- const uno::Any &rVal = pValue[i];
- INT32 nPropertyHandle;
- GetHdlByName( nPropertyHandle, pProperyNames[i], sal_True );
- switch ( nPropertyHandle )
- {
- case UPH_DEFAULT_LOCALE :
- { rOpt.bRODefaultLanguage = pROStates[i]; rOpt.nDefaultLanguage = lcl_CfgAnyToLanguage( rVal ); } break;
- case UPH_ACTIVE_DICTIONARIES :
- { rOpt.bROActiveDics = pROStates[i]; rVal >>= rOpt.aActiveDics; } break;
- case UPH_IS_USE_DICTIONARY_LIST :
- { rOpt.bROIsUseDictionaryList = pROStates[i]; rVal >>= rOpt.bIsUseDictionaryList; } break;
- case UPH_IS_IGNORE_CONTROL_CHARACTERS :
- { rOpt.bROIsIgnoreControlCharacters = pROStates[i]; rVal >>= rOpt.bIsIgnoreControlCharacters; } break;
- case UPH_DEFAULT_LOCALE_CJK :
- { rOpt.bRODefaultLanguage_CJK = pROStates[i]; rOpt.nDefaultLanguage_CJK = lcl_CfgAnyToLanguage( rVal ); } break;
- case UPH_DEFAULT_LOCALE_CTL :
- { rOpt.bRODefaultLanguage_CTL = pROStates[i]; rOpt.nDefaultLanguage_CTL = lcl_CfgAnyToLanguage( rVal ); } break;
-
- case UPH_IS_SPELL_UPPER_CASE :
- { rOpt.bROIsSpellUpperCase = pROStates[i]; rVal >>= rOpt.bIsSpellUpperCase; } break;
- case UPH_IS_SPELL_WITH_DIGITS :
- { rOpt.bROIsSpellWithDigits = pROStates[i]; rVal >>= rOpt.bIsSpellWithDigits; } break;
- case UPH_IS_SPELL_CAPITALIZATION :
- { rOpt.bROIsSpellCapitalization = pROStates[i]; rVal >>= rOpt.bIsSpellCapitalization; } break;
- case UPH_IS_SPELL_AUTO :
- { rOpt.bROIsSpellAuto = pROStates[i]; rVal >>= rOpt.bIsSpellAuto; } break;
- case UPH_IS_SPELL_SPECIAL :
- { rOpt.bROIsSpellSpecial = pROStates[i]; rVal >>= rOpt.bIsSpellSpecial; } break;
- case UPH_IS_WRAP_REVERSE :
- { rOpt.bROIsSpellReverse = pROStates[i]; rVal >>= rOpt.bIsSpellReverse; } break;
-
- case UPH_HYPH_MIN_LEADING :
- { rOpt.bROHyphMinLeading = pROStates[i]; rVal >>= rOpt.nHyphMinLeading; } break;
- case UPH_HYPH_MIN_TRAILING :
- { rOpt.bROHyphMinTrailing = pROStates[i]; rVal >>= rOpt.nHyphMinTrailing; } break;
- case UPH_HYPH_MIN_WORD_LENGTH :
- { rOpt.bROHyphMinWordLength = pROStates[i]; rVal >>= rOpt.nHyphMinWordLength; } break;
- case UPH_IS_HYPH_SPECIAL :
- { rOpt.bROIsHyphSpecial = pROStates[i]; rVal >>= rOpt.bIsHyphSpecial; } break;
- case UPH_IS_HYPH_AUTO :
- { rOpt.bROIsHyphAuto = pROStates[i]; rVal >>= rOpt.bIsHyphAuto; } break;
-
- case UPH_ACTIVE_CONVERSION_DICTIONARIES : { rOpt.bROActiveConvDics = pROStates[i]; rVal >>= rOpt.aActiveConvDics; } break;
-
- case UPH_IS_IGNORE_POST_POSITIONAL_WORD :
- { rOpt.bROIsIgnorePostPositionalWord = pROStates[i]; rVal >>= rOpt.bIsIgnorePostPositionalWord; } break;
- case UPH_IS_AUTO_CLOSE_DIALOG :
- { rOpt.bROIsAutoCloseDialog = pROStates[i]; rVal >>= rOpt.bIsAutoCloseDialog; } break;
- case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST :
- { rOpt.bROIsShowEntriesRecentlyUsedFirst = pROStates[i]; rVal >>= rOpt.bIsShowEntriesRecentlyUsedFirst; } break;
- case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES :
- { rOpt.bROIsAutoReplaceUniqueEntries = pROStates[i]; rVal >>= rOpt.bIsAutoReplaceUniqueEntries; } break;
-
- case UPH_IS_DIRECTION_TO_SIMPLIFIED :
- { rOpt.bROIsDirectionToSimplified = pROStates[i];
- if( ! (rVal >>= rOpt.bIsDirectionToSimplified) )
- {
- //default is locale dependent:
- if( rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_HONGKONG
- || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_MACAU
- || rOpt.nDefaultLanguage_CJK == LANGUAGE_CHINESE_TRADITIONAL )
- {
- rOpt.bIsDirectionToSimplified = FALSE;
- }
- else
- {
- rOpt.bIsDirectionToSimplified = TRUE;
- }
- }
- } break;
- case UPH_IS_USE_CHARACTER_VARIANTS :
- { rOpt.bROIsUseCharacterVariants = pROStates[i]; rVal >>= rOpt.bIsUseCharacterVariants; } break;
- case UPH_IS_TRANSLATE_COMMON_TERMS :
- { rOpt.bROIsTranslateCommonTerms = pROStates[i]; rVal >>= rOpt.bIsTranslateCommonTerms; } break;
- case UPH_IS_REVERSE_MAPPING :
- { rOpt.bROIsReverseMapping = pROStates[i]; rVal >>= rOpt.bIsReverseMapping; } break;
-
- case UPH_DATA_FILES_CHANGED_CHECK_VALUE :
- { rOpt.bRODataFilesChangedCheckValue = pROStates[i]; rVal >>= rOpt.nDataFilesChangedCheckValue; } break;
-
- case UPH_IS_GRAMMAR_AUTO:
- { rOpt.bROIsGrammarAuto = pROStates[i]; rVal >>= rOpt.bIsGrammarAuto; }
- break;
- case UPH_IS_GRAMMAR_INTERACTIVE:
- { rOpt.bROIsGrammarInteractive = pROStates[i]; rVal >>= rOpt.bIsGrammarInteractive; }
- break;
-
- default:
- DBG_ASSERT( 0, "unexpected case" );
- }
- }
-
- bRes = TRUE;
- }
- DBG_ASSERT( bRes, "LoadOptions failed" );
-
- return bRes;
-}
-
-
-BOOL SvtLinguConfigItem::SaveOptions( const uno::Sequence< OUString > &rProperyNames )
-{
- if (!IsModified())
- return TRUE;
-
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- BOOL bRet = FALSE;
- const uno::Type &rBOOL = ::getBooleanCppuType();
- const uno::Type &rINT16 = ::getCppuType( (INT16 *) NULL );
- const uno::Type &rINT32 = ::getCppuType( (INT32 *) NULL );
-
- INT32 nProps = rProperyNames.getLength();
- uno::Sequence< uno::Any > aValues( nProps );
- uno::Any *pValue = aValues.getArray();
-
- if (nProps && aValues.getLength() == nProps)
- {
- const SvtLinguOptions &rOpt = aOpt;
-
- OUString aTmp( lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage ) );
- *pValue++ = uno::makeAny( aTmp ); // 0
- *pValue++ = uno::makeAny( rOpt.aActiveDics ); // 1
- pValue++->setValue( &rOpt.bIsUseDictionaryList, rBOOL ); // 2
- pValue++->setValue( &rOpt.bIsIgnoreControlCharacters, rBOOL ); // 3
- aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CJK );
- *pValue++ = uno::makeAny( aTmp ); // 5
- aTmp = lcl_LanguageToCfgLocaleStr( rOpt.nDefaultLanguage_CTL );
- *pValue++ = uno::makeAny( aTmp ); // 6
-
- pValue++->setValue( &rOpt.bIsSpellUpperCase, rBOOL ); // 7
- pValue++->setValue( &rOpt.bIsSpellWithDigits, rBOOL ); // 8
- pValue++->setValue( &rOpt.bIsSpellCapitalization, rBOOL ); // 9
- pValue++->setValue( &rOpt.bIsSpellAuto, rBOOL ); // 10
- pValue++->setValue( &rOpt.bIsSpellSpecial, rBOOL ); // 11
- pValue++->setValue( &rOpt.bIsSpellReverse, rBOOL ); // 14
-
- pValue++->setValue( &rOpt.nHyphMinLeading, rINT16 ); // 15
- pValue++->setValue( &rOpt.nHyphMinTrailing, rINT16 ); // 16
- pValue++->setValue( &rOpt.nHyphMinWordLength, rINT16 ); // 17
- pValue++->setValue( &rOpt.bIsHyphSpecial, rBOOL ); // 18
- pValue++->setValue( &rOpt.bIsHyphAuto, rBOOL ); // 19
-
- *pValue++ = uno::makeAny( rOpt.aActiveConvDics ); // 20
-
- pValue++->setValue( &rOpt.bIsIgnorePostPositionalWord, rBOOL ); // 21
- pValue++->setValue( &rOpt.bIsAutoCloseDialog, rBOOL ); // 22
- pValue++->setValue( &rOpt.bIsShowEntriesRecentlyUsedFirst, rBOOL ); // 23
- pValue++->setValue( &rOpt.bIsAutoReplaceUniqueEntries, rBOOL ); // 24
-
- pValue++->setValue( &rOpt.bIsDirectionToSimplified, rBOOL ); // 25
- pValue++->setValue( &rOpt.bIsUseCharacterVariants, rBOOL ); // 26
- pValue++->setValue( &rOpt.bIsTranslateCommonTerms, rBOOL ); // 27
- pValue++->setValue( &rOpt.bIsReverseMapping, rBOOL ); // 28
-
- pValue++->setValue( &rOpt.nDataFilesChangedCheckValue, rINT32 ); // 29
- pValue++->setValue( &rOpt.bIsGrammarAuto, rBOOL ); // 30
- pValue++->setValue( &rOpt.bIsGrammarInteractive, rBOOL ); // 31
-
- bRet |= PutProperties( rProperyNames, aValues );
- }
-
- if (bRet)
- ClearModified();
-
- return bRet;
-}
-
-BOOL SvtLinguConfigItem::IsReadOnly( const rtl::OUString &rPropertyName ) const
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- BOOL bReadOnly = FALSE;
- INT32 nHdl;
- if (GetHdlByName( nHdl, rPropertyName ))
- bReadOnly = IsReadOnly( nHdl );
- return bReadOnly;
-}
-
-BOOL SvtLinguConfigItem::IsReadOnly( INT32 nPropertyHandle ) const
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- BOOL bReadOnly = FALSE;
-
- const SvtLinguOptions &rOpt = const_cast< SvtLinguConfigItem * >(this)->aOpt;
- switch(nPropertyHandle)
- {
- case UPH_IS_USE_DICTIONARY_LIST : bReadOnly = rOpt.bROIsUseDictionaryList ; break;
- case UPH_IS_IGNORE_CONTROL_CHARACTERS : bReadOnly = rOpt.bROIsIgnoreControlCharacters; break;
- case UPH_IS_HYPH_AUTO : bReadOnly = rOpt.bROIsHyphAuto ; break;
- case UPH_IS_HYPH_SPECIAL : bReadOnly = rOpt.bROIsHyphSpecial ; break;
- case UPH_IS_SPELL_AUTO : bReadOnly = rOpt.bROIsSpellAuto ; break;
- case UPH_IS_SPELL_SPECIAL : bReadOnly = rOpt.bROIsSpellSpecial ; break;
- case UPH_IS_WRAP_REVERSE : bReadOnly = rOpt.bROIsSpellReverse ; break;
- case UPH_DEFAULT_LANGUAGE : bReadOnly = rOpt.bRODefaultLanguage ; break;
- case UPH_IS_SPELL_CAPITALIZATION : bReadOnly = rOpt.bROIsSpellCapitalization ; break;
- case UPH_IS_SPELL_WITH_DIGITS : bReadOnly = rOpt.bROIsSpellWithDigits ; break;
- case UPH_IS_SPELL_UPPER_CASE : bReadOnly = rOpt.bROIsSpellUpperCase ; break;
- case UPH_HYPH_MIN_LEADING : bReadOnly = rOpt.bROHyphMinLeading ; break;
- case UPH_HYPH_MIN_TRAILING : bReadOnly = rOpt.bROHyphMinTrailing ; break;
- case UPH_HYPH_MIN_WORD_LENGTH : bReadOnly = rOpt.bROHyphMinWordLength ; break;
- case UPH_ACTIVE_DICTIONARIES : bReadOnly = rOpt.bROActiveDics ; break;
- case UPH_ACTIVE_CONVERSION_DICTIONARIES : bReadOnly = rOpt.bROActiveConvDics ; break;
- case UPH_DEFAULT_LOCALE : bReadOnly = rOpt.bRODefaultLanguage ; break;
- case UPH_DEFAULT_LOCALE_CJK : bReadOnly = rOpt.bRODefaultLanguage_CJK ; break;
- case UPH_DEFAULT_LOCALE_CTL : bReadOnly = rOpt.bRODefaultLanguage_CTL ; break;
- case UPH_IS_IGNORE_POST_POSITIONAL_WORD : bReadOnly = rOpt.bROIsIgnorePostPositionalWord; break;
- case UPH_IS_AUTO_CLOSE_DIALOG : bReadOnly = rOpt.bROIsAutoCloseDialog; break;
- case UPH_IS_SHOW_ENTRIES_RECENTLY_USED_FIRST : bReadOnly = rOpt.bROIsShowEntriesRecentlyUsedFirst; break;
- case UPH_IS_AUTO_REPLACE_UNIQUE_ENTRIES : bReadOnly = rOpt.bROIsAutoReplaceUniqueEntries; break;
- case UPH_IS_DIRECTION_TO_SIMPLIFIED : bReadOnly = rOpt.bROIsDirectionToSimplified; break;
- case UPH_IS_USE_CHARACTER_VARIANTS : bReadOnly = rOpt.bROIsUseCharacterVariants; break;
- case UPH_IS_TRANSLATE_COMMON_TERMS : bReadOnly = rOpt.bROIsTranslateCommonTerms; break;
- case UPH_IS_REVERSE_MAPPING : bReadOnly = rOpt.bROIsReverseMapping; break;
- case UPH_DATA_FILES_CHANGED_CHECK_VALUE : bReadOnly = rOpt.bRODataFilesChangedCheckValue; break;
- case UPH_IS_GRAMMAR_AUTO: bReadOnly = rOpt.bROIsGrammarAuto; break;
- case UPH_IS_GRAMMAR_INTERACTIVE: bReadOnly = rOpt.bROIsGrammarInteractive; break;
- default :
- DBG_ASSERT( 0, "unexpected property handle" );
- }
- return bReadOnly;
-}
-
-//////////////////////////////////////////////////////////////////////
-
-static SvtLinguConfigItem *pCfgItem = 0;
-static sal_Int32 nCfgItemRefCount = 0;
-
-static const rtl::OUString aG_SupportedDictionaryFormats( A2OU("SupportedDictionaryFormats") );
-static const rtl::OUString aG_Dictionaries( A2OU("Dictionaries") );
-static const rtl::OUString aG_Locations( A2OU("Locations") );
-static const rtl::OUString aG_Format( A2OU("Format") );
-static const rtl::OUString aG_Locales( A2OU("Locales") );
-static const rtl::OUString aG_DisabledDictionaries( A2OU("DisabledDictionaries") );
-static const rtl::OUString aG_LastActiveDictionaries( A2OU("LastActiveDictionaries") );
-
-SvtLinguConfig::SvtLinguConfig()
-{
- // Global access, must be guarded (multithreading)
- osl::MutexGuard aGuard( GetOwnMutex() );
- ++nCfgItemRefCount;
-}
-
-
-SvtLinguConfig::~SvtLinguConfig()
-{
- osl::MutexGuard aGuard( GetOwnMutex() );
-
- if (pCfgItem && pCfgItem->IsModified())
- pCfgItem->Commit();
-
- if (--nCfgItemRefCount <= 0)
- {
- if (pCfgItem)
- delete pCfgItem;
- pCfgItem = 0;
- }
-}
-
-
-SvtLinguConfigItem & SvtLinguConfig::GetConfigItem()
-{
- // Global access, must be guarded (multithreading)
- osl::MutexGuard aGuard( GetOwnMutex() );
- if (!pCfgItem)
- {
- pCfgItem = new SvtLinguConfigItem;
- ItemHolder1::holdConfigItem(E_LINGUCFG);
- }
- return *pCfgItem;
-}
-
-
-uno::Sequence< OUString > SvtLinguConfig::GetNodeNames( const OUString &rNode )
-{
- return GetConfigItem().GetNodeNames( rNode );
-}
-
-
-uno::Sequence< uno::Any > SvtLinguConfig::GetProperties( const uno::Sequence< OUString > &rNames )
-{
- return GetConfigItem().GetProperties(rNames);
-}
-
-
-sal_Bool SvtLinguConfig::ReplaceSetProperties(
- const OUString &rNode, uno::Sequence< beans::PropertyValue > rValues )
-{
- return GetConfigItem().ReplaceSetProperties( rNode, rValues );
-}
-
-
-uno::Any SvtLinguConfig::GetProperty( const OUString &rPropertyName ) const
-{
- return GetConfigItem().GetProperty( rPropertyName );
-}
-
-
-uno::Any SvtLinguConfig::GetProperty( INT32 nPropertyHandle ) const
-{
- return GetConfigItem().GetProperty( nPropertyHandle );
-}
-
-
-BOOL SvtLinguConfig::SetProperty( const OUString &rPropertyName, const uno::Any &rValue )
-{
- return GetConfigItem().SetProperty( rPropertyName, rValue );
-}
-
-
-BOOL SvtLinguConfig::SetProperty( INT32 nPropertyHandle, const uno::Any &rValue )
-{
- return GetConfigItem().SetProperty( nPropertyHandle, rValue );
-}
-
-
-BOOL SvtLinguConfig::GetOptions( SvtLinguOptions &rOptions ) const
-{
- return GetConfigItem().GetOptions( rOptions );
-}
-
-
-BOOL SvtLinguConfig::SetOptions( const SvtLinguOptions &rOptions )
-{
- return GetConfigItem().SetOptions( rOptions );
-}
-
-
-BOOL SvtLinguConfig::IsReadOnly( const rtl::OUString &rPropertyName ) const
-{
- return GetConfigItem().IsReadOnly( rPropertyName );
-}
-
-BOOL SvtLinguConfig::IsReadOnly( INT32 nPropertyHandle ) const
-{
- return GetConfigItem().IsReadOnly( nPropertyHandle );
-}
-
-BOOL SvtLinguConfig::GetElementNamesFor(
- const rtl::OUString &rNodeName,
- uno::Sequence< rtl::OUString > &rElementNames ) const
-{
- bool bSuccess = false;
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW );
- rElementNames = xNA->getElementNames();
- bSuccess = true;
- }
- catch (uno::Exception &)
- {
- }
- return bSuccess;
-}
-
-static uno::Reference< container::XNameAccess > GetOrCreateSetEntry_Impl(
- const uno::Reference< container::XNameAccess > &rxSetNameAccess,
- const rtl::OUString &rEntryName )
-{
- uno::Reference< container::XNameAccess > xResult;
- try
- {
- if (!rxSetNameAccess->hasByName( rEntryName ))
- {
- uno::Reference< lang::XSingleServiceFactory > xFactory( rxSetNameAccess, uno::UNO_QUERY_THROW);
- uno::Reference< uno::XInterface > xNewEntry( xFactory->createInstance() );
- uno::Reference< container::XNameContainer > xNC( rxSetNameAccess, uno::UNO_QUERY_THROW );
- xNC->insertByName( rEntryName, makeAny( xNewEntry ) );
- }
- xResult.set( rxSetNameAccess->getByName( rEntryName ), uno::UNO_QUERY_THROW );
- }
- catch (uno::Exception &)
- {
- }
- return xResult;
-}
-
-BOOL SvtLinguConfig::GetSupportedDictionaryFormatsFor(
- const rtl::OUString &rSetName,
- const rtl::OUString &rSetEntry,
- uno::Sequence< rtl::OUString > &rFormatList ) const
-{
- if (rSetName.getLength() == 0 || rSetEntry.getLength() == 0)
- return sal_False;
- bool bSuccess = false;
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rSetEntry ), uno::UNO_QUERY_THROW );
- if (xNA->getByName( aG_SupportedDictionaryFormats ) >>= rFormatList)
- bSuccess = true;
- DBG_ASSERT( rFormatList.getLength(), "supported dictionary format list is empty" );
- }
- catch (uno::Exception &)
- {
- }
- return bSuccess;
-}
-
-void SvtLinguConfig::SetOrCreateSupportedDictionaryFormatsFor(
- const rtl::OUString &rSetName,
- const rtl::OUString &rSetEntry,
- const uno::Sequence< rtl::OUString > &rFormatList ) const
-{
- if (rSetName.getLength() == 0 || rSetEntry.getLength() == 0)
- return;
- try
- {
- DBG_ASSERT( rFormatList.getLength(), "applying empty format list. Really??" );
-
- uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() );
- uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rSetName ), uno::UNO_QUERY_THROW );
- xNA = GetOrCreateSetEntry_Impl( xNA, rSetEntry );
-
- uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW );
- xNR->replaceByName( aG_SupportedDictionaryFormats, uno::makeAny( rFormatList ) );
-
- xUpdateAccess->commitChanges();
- }
- catch (uno::Exception &)
- {
- }
-}
-
-
-static uno::WeakReference< util::XMacroExpander > aG_xMacroExpander;
-
-static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander()
-{
- uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander );
- if ( !xMacroExpander.is() )
- {
- vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
-
- if ( !xMacroExpander.is() )
- {
- uno::Reference< uno::XComponentContext > xContext;
- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= xContext;
- if ( xContext.is() )
- {
- aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
- uno::UNO_QUERY );
- xMacroExpander = aG_xMacroExpander;
- }
- }
- }
-
- return xMacroExpander;
-}
-
-
-static bool lcl_GetFileUrlFromOrigin(
- OUString /*out*/ &rFileUrl,
- const OUString &rOrigin,
- uno::Reference< util::XMacroExpander > &rxMacroExpander )
-{
- bool bSuccess = false;
- if (rOrigin.getLength() > 0 && rxMacroExpander.is())
- {
- rtl::OUString aURL( rOrigin );
- if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) &&
- rxMacroExpander.is() )
- {
- // cut protocol
- OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
- // decode uric class chars
- aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- // expand macro string
- aURL = rxMacroExpander->expandMacros( aMacro );
-
- bool bIsFileUrl = aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( FILE_PROTOCOL )) == 0;
- if (bIsFileUrl)
- {
- rFileUrl = aURL;
- bSuccess = true;
- }
- else
- {
- DBG_ASSERT( bIsFileUrl, "not a file URL");
- }
- }
- else
- {
- DBG_ASSERT( 0, "failed to get file URL" );
- }
- }
- return bSuccess;
-}
-
-
-BOOL SvtLinguConfig::GetDictionaryEntry(
- const rtl::OUString &rNodeName,
- SvtLinguConfigDictionaryEntry &rDicEntry ) const
-{
- if (rNodeName.getLength() == 0)
- return sal_False;
- bool bSuccess = false;
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rNodeName ), uno::UNO_QUERY_THROW );
-
- // read group data...
- uno::Sequence< rtl::OUString > aLocations;
- rtl::OUString aFormatName;
- uno::Sequence< rtl::OUString > aLocaleNames;
- bSuccess = (xNA->getByName( aG_Locations ) >>= aLocations) &&
- (xNA->getByName( aG_Format ) >>= aFormatName) &&
- (xNA->getByName( aG_Locales ) >>= aLocaleNames);
- DBG_ASSERT( aLocations.getLength(), "Dictionary locations not set" );
- DBG_ASSERT( aFormatName.getLength(), "Dictionary format name not set" );
- DBG_ASSERT( aLocaleNames.getLength(), "No locales set for the dictionary" );
-
- // if sucessful continue
- if (bSuccess)
- {
- // get file URL's for the locations
- uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() );
- for (sal_Int32 i = 0; i < aLocations.getLength(); ++i)
- {
- rtl::OUString &rLocation = aLocations[i];
- if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation, xMacroExpander ))
- bSuccess = false;
- }
-
- // if everything was fine return the result
- if (bSuccess)
- {
- rDicEntry.aLocations = aLocations;
- rDicEntry.aFormatName = aFormatName;
- rDicEntry.aLocaleNames = aLocaleNames;
- }
- }
- }
- catch (uno::Exception &)
- {
- }
- return bSuccess;
-}
-
-void SvtLinguConfig::SetOrCreateDictionaryEntry(
- const rtl::OUString &rNodeName,
- const SvtLinguConfigDictionaryEntry &rDicEntry ) const
-{
- if (rNodeName.getLength() == 0)
- return;
- try
- {
- uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() );
- uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( aG_Dictionaries ), uno::UNO_QUERY_THROW );
- xNA = GetOrCreateSetEntry_Impl( xNA, rNodeName );
-
- DBG_ASSERT( rDicEntry.aLocations.getLength(), "Applying empty dictionary locations. Really correct??" );
- DBG_ASSERT( rDicEntry.aFormatName.getLength(), "Applying empty dictionary format name. Really correct??" );
- DBG_ASSERT( rDicEntry.aLocaleNames.getLength(), "Applying empty list of locales for the dictionary. Really correct??" );
-
- uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW );
- xNR->replaceByName( aG_Locations, uno::makeAny( rDicEntry.aLocations ) );
- xNR->replaceByName( aG_Format, uno::makeAny( rDicEntry.aFormatName ) );
- xNR->replaceByName( aG_Locales, uno::makeAny( rDicEntry.aLocaleNames ) );
-
- xUpdateAccess->commitChanges();
- }
- catch (uno::Exception &)
- {
- }
-}
-
-uno::Sequence< rtl::OUString > SvtLinguConfig::GetDisabledDictionaries() const
-{
- uno::Sequence< rtl::OUString > aResult;
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA->getByName( aG_DisabledDictionaries ) >>= aResult;
- }
- catch (uno::Exception &)
- {
- }
- return aResult;
-}
-
-void SvtLinguConfig::SetDisabledDictionaries(
- const uno::Sequence< rtl::OUString > &rDictionaries ) const
-{
- try
- {
- uno::Reference< util::XChangesBatch > xUpdateAccess( GetMainUpdateAccess() );
- uno::Reference< container::XNameAccess > xNA( xUpdateAccess, uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- if (xNA->hasByName( aG_DisabledDictionaries ))
- {
- uno::Reference< container::XNameReplace > xNR( xNA, uno::UNO_QUERY_THROW );
- xNR->replaceByName( aG_DisabledDictionaries, makeAny( rDictionaries ) );
- }
- else
- {
- uno::Reference< container::XNameContainer > xNC( xNA, uno::UNO_QUERY_THROW );
- xNC->insertByName( aG_DisabledDictionaries, makeAny( rDictionaries ) );
- }
-
- xUpdateAccess->commitChanges();
- }
- catch (uno::Exception &)
- {
- }
-}
-
-std::vector< SvtLinguConfigDictionaryEntry > SvtLinguConfig::GetActiveDictionariesByFormat(
- const rtl::OUString &rFormatName )
-{
- std::vector< SvtLinguConfigDictionaryEntry > aRes;
- if (rFormatName.getLength() == 0)
- return aRes;
-
- try
- {
- uno::Sequence< rtl::OUString > aElementNames;
- GetElementNamesFor( aG_Dictionaries, aElementNames );
- sal_Int32 nLen = aElementNames.getLength();
- const rtl::OUString *pElementNames = aElementNames.getConstArray();
-
- SvtLinguConfigDictionaryEntry aDicEntry;
- for (sal_Int32 i = 0; i < nLen; ++i)
- {
- // does dictionary match the format we are looking for?
- if (GetDictionaryEntry( pElementNames[i], aDicEntry ) &&
- aDicEntry.aFormatName == rFormatName)
- {
- // check if it is active or not
- bool bDicIsActive = true;
- const uno::Sequence< rtl::OUString > aDisabledDics( GetDisabledDictionaries() );
- for (sal_Int32 k = 0; bDicIsActive && k < aDisabledDics.getLength(); ++k)
- {
- if (aDisabledDics[k] == pElementNames[i])
- bDicIsActive = false;
- }
-
- if (bDicIsActive)
- {
- DBG_ASSERT( aDicEntry.aFormatName.getLength(),
- "FormatName not set" );
- DBG_ASSERT( aDicEntry.aLocations.getLength(),
- "Locations not set" );
- DBG_ASSERT( aDicEntry.aLocaleNames.getLength(),
- "Locales not set" );
- aRes.push_back( aDicEntry );
- }
- }
- }
- }
- catch (uno::Exception &)
- {
- }
-
- return aRes;
-}
-
-
-uno::Reference< util::XChangesBatch > SvtLinguConfig::GetMainUpdateAccess() const
-{
- if (!m_xMainUpdateAccess.is())
- {
- try
- {
- // get configuration provider
- uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider;
- uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
- if (xMgr.is())
- {
- xConfigurationProvider = uno::Reference< lang::XMultiServiceFactory > (
- xMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ) ) ),
- uno::UNO_QUERY_THROW ) ;
- }
-
- // get configuration update access
- beans::PropertyValue aValue;
- aValue.Name = A2OU( "nodepath" );
- aValue.Value = uno::makeAny( A2OU("org.openoffice.Office.Linguistic") );
- uno::Sequence< uno::Any > aProps(1);
- aProps[0] <<= aValue;
- m_xMainUpdateAccess = uno::Reference< util::XChangesBatch >(
- xConfigurationProvider->createInstanceWithArguments(
- A2OU( "com.sun.star.configuration.ConfigurationUpdateAccess" ), aProps ),
- uno::UNO_QUERY_THROW );
- }
- catch (uno::Exception &)
- {
- }
- }
-
- return m_xMainUpdateAccess;
-}
-
-
-rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl(
- const rtl::OUString &rServiceImplName,
- const rtl::OUString &rImageName ) const
-{
- rtl::OUString aRes;
- try
- {
- uno::Reference< container::XNameAccess > xImagesNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xImagesNA.set( xImagesNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
-
- uno::Reference< container::XNameAccess > xNA( xImagesNA->getByName( A2OU("ServiceNameEntries") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( rServiceImplName ), uno::UNO_QUERY_THROW );
- uno::Any aAny( xNA->getByName( A2OU("VendorImagesNode") ) );
- rtl::OUString aVendorImagesNode;
- if (aAny >>= aVendorImagesNode)
- {
- xNA = xImagesNA;
- xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( aVendorImagesNode ), uno::UNO_QUERY_THROW );
- aAny = xNA->getByName( rImageName );
- rtl::OUString aTmp;
- if (aAny >>= aTmp)
- {
- uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() );
- if (lcl_GetFileUrlFromOrigin( aTmp, aTmp, xMacroExpander ))
- aRes = aTmp;
- }
- }
- }
- catch (uno::Exception &)
- {
- DBG_ASSERT( 0, "exception caught. GetVendorImageUrl_Impl failed" );
- }
- return aRes;
-}
-
-
-rtl::OUString SvtLinguConfig::GetSpellAndGrammarDialogImage(
- const rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
-{
- rtl::OUString aRes;
- if (rServiceImplName.getLength() > 0)
- {
- rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarDialogImage_HC" : "SpellAndGrammarDialogImage" ));
- rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
- aRes = aPath;
- }
- return aRes;
-}
-
-
-rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextSuggestionImage(
- const rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
-{
- rtl::OUString aRes;
- if (rServiceImplName.getLength() > 0)
- {
- rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuSuggestionImage_HC" : "SpellAndGrammarContextMenuSuggestionImage" ));
- rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
- aRes = aPath;
- }
- return aRes;
-}
-
-
-rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage(
- const rtl::OUString &rServiceImplName,
- bool bHighContrast ) const
-{
- rtl::OUString aRes;
- if (rServiceImplName.getLength() > 0)
- {
- rtl::OUString aImageName( A2OU( bHighContrast ? "SpellAndGrammarContextMenuDictionaryImage_HC" : "SpellAndGrammarContextMenuDictionaryImage" ));
- rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
- aRes = aPath;
- }
- return aRes;
-}
-
-
-bool SvtLinguConfig::HasAnyVendorImages() const
-{
- bool bRes = false;
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW );
-
- uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
- bRes = aElementNames.getLength() > 0;
- }
- catch (uno::Exception &)
- {
- DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" );
- }
- return bRes;
-}
-
-
-bool SvtLinguConfig::HasGrammarChecker() const
-{
- bool bRes = false;
-
- try
- {
- uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("ServiceManager") ), uno::UNO_QUERY_THROW );
- xNA.set( xNA->getByName( A2OU("GrammarCheckerList") ), uno::UNO_QUERY_THROW );
-
- uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() );
- bRes = aElementNames.getLength() > 0;
- }
- catch (uno::Exception &)
- {
- }
-
- return bRes;
-}
-
-//////////////////////////////////////////////////////////////////////
-
diff --git a/svtools/source/config/localisationoptions.cxx b/svtools/source/config/localisationoptions.cxx
deleted file mode 100644
index aab7ab17b1ea..000000000000
--- a/svtools/source/config/localisationoptions.cxx
+++ /dev/null
@@ -1,459 +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: localisationoptions.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/localisationoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_LOCALISATION OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/View/Localisation"))
-#define DEFAULT_AUTOMNEMONIC sal_False
-#define DEFAULT_DIALOGSCALE 0
-
-#define PROPERTYNAME_AUTOMNEMONIC OUString(RTL_CONSTASCII_USTRINGPARAM("AutoMnemonic" ))
-#define PROPERTYNAME_DIALOGSCALE OUString(RTL_CONSTASCII_USTRINGPARAM("DialogScale" ))
-
-#define PROPERTYHANDLE_AUTOMNEMONIC 0
-#define PROPERTYHANDLE_DIALOGSCALE 1
-
-#define PROPERTYCOUNT 2
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-class SvtLocalisationOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtLocalisationOptions_Impl();
- ~SvtLocalisationOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These method give us a chance to regulate acces to ouer internal values.
- It's not used in the moment - but it's possible for the feature!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_Bool IsAutoMnemonic ( ) const ;
- void SetAutoMnemonic ( sal_Bool bState ) ;
- sal_Int32 GetDialogScale ( ) const ;
- void SetDialogScale ( sal_Int32 nScale ) ;
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management.
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- static Sequence< OUString > GetPropertyNames();
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- sal_Bool m_bAutoMnemonic ;
- sal_Int32 m_nDialogScale ;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_LOCALISATION )
- // Init member then.
- , m_bAutoMnemonic ( DEFAULT_AUTOMNEMONIC )
- , m_nDialogScale ( DEFAULT_DIALOGSCALE )
-{
- // Use our static list of configuration keys to get his values.
- Sequence< OUString > seqNames = GetPropertyNames ( );
- Sequence< Any > seqValues = GetProperties ( seqNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- // Safe impossible cases.
- // Check any for valid value.
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nInvalid property value detected!\n" );
- switch( nProperty )
- {
- case PROPERTYHANDLE_AUTOMNEMONIC : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\AutoMnemonic\"?" );
- seqValues[nProperty] >>= m_bAutoMnemonic;
- }
- break;
-
- case PROPERTYHANDLE_DIALOGSCALE : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\DialogScale\"?" );
- seqValues[nProperty] >>= m_nDialogScale;
- }
- break;
- }
- }
-
- // Enable notification mechanism of ouer baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys!
- EnableNotification( seqNames );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtLocalisationOptions_Impl::~SvtLocalisationOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtLocalisationOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
-{
- // Use given list of updated properties to get his values from configuration directly!
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- // Safe impossible cases.
- // We need values from ALL notified configuration keys.
- DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtLocalisationOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
- // Step over list of property names and get right value from coreesponding value list to set it on internal members!
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- if( seqPropertyNames[nProperty] == PROPERTYNAME_AUTOMNEMONIC )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\AutoMnemonic\"?" );
- seqValues[nProperty] >>= m_bAutoMnemonic;
- }
- else
- if( seqPropertyNames[nProperty] == PROPERTYNAME_DIALOGSCALE )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtLocalisationOptions_Impl::SvtLocalisationOptions_Impl()\nWho has changed the value type of \"Office.Common\\View\\Localisation\\DialogScale\"?" );
- seqValues[nProperty] >>= m_nDialogScale;
- }
- #if OSL_DEBUG_LEVEL > 1
- else DBG_ASSERT( sal_False, "SvtLocalisationOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" );
- #endif
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtLocalisationOptions_Impl::Commit()
-{
- // Get names of supported properties, create a list for values and copy current values to it.
- Sequence< OUString > seqNames = GetPropertyNames ();
- sal_Int32 nCount = seqNames.getLength();
- Sequence< Any > seqValues ( nCount );
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_AUTOMNEMONIC : {
- seqValues[nProperty] <<= m_bAutoMnemonic;
- }
- break;
-
- case PROPERTYHANDLE_DIALOGSCALE : {
- seqValues[nProperty] <<= m_nDialogScale;
- }
- break;
- }
- }
- // Set properties in configuration.
- PutProperties( seqNames, seqValues );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtLocalisationOptions_Impl::IsAutoMnemonic() const
-{
- return m_bAutoMnemonic;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtLocalisationOptions_Impl::SetAutoMnemonic( sal_Bool bState )
-{
- m_bAutoMnemonic = bState;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtLocalisationOptions_Impl::GetDialogScale() const
-{
- return m_nDialogScale;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtLocalisationOptions_Impl::SetDialogScale( sal_Int32 nScale )
-{
- m_nDialogScale = nScale;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtLocalisationOptions_Impl::GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_AUTOMNEMONIC ,
- PROPERTYNAME_DIALOGSCALE ,
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtLocalisationOptions_Impl* SvtLocalisationOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtLocalisationOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtLocalisationOptions::SvtLocalisationOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtLocalisationOptions_Impl::ctor()");
- m_pDataContainer = new SvtLocalisationOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_LOCALISATIONOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtLocalisationOptions::~SvtLocalisationOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtLocalisationOptions::IsAutoMnemonic() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsAutoMnemonic();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtLocalisationOptions::SetAutoMnemonic( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetAutoMnemonic( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtLocalisationOptions::GetDialogScale() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetDialogScale();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtLocalisationOptions::SetDialogScale( sal_Int32 nScale )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetDialogScale( nScale );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtLocalisationOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/loghelper.hxx b/svtools/source/config/loghelper.hxx
deleted file mode 100644
index 22efd5cff46d..000000000000
--- a/svtools/source/config/loghelper.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: loghelper.hxx,v $
- *
- * $Revision: 1.1.4.2 $
- *
- * last change: $Author: as $ $Date: 2008/03/19 11:20:29 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-#ifndef _SVT_LOGHELPER_HXX
-#define _SVT_LOGHELPER_HXX
-
-namespace css = ::com::sun::star;
-
-class LogHelper
-{
-public:
- LogHelper();
- ~LogHelper();
-
- static void logIt(const css::uno::Exception&){}
-};
-
-inline void logIt(const css::uno::Exception& ex)
-{
- ::rtl::OUStringBuffer sMsg(256);
- sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" );
- sMsg.append(ex.Message);
- sMsg.appendAscii("\"");
- OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr());
-}
-
-#endif
-
diff --git a/svtools/source/config/makefile.mk b/svtools/source/config/makefile.mk
index 9c0985329eb3..9de32bd9e43d 100644
--- a/svtools/source/config/makefile.mk
+++ b/svtools/source/config/makefile.mk
@@ -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
@@ -32,80 +32,28 @@ PRJ=..$/..
PRJNAME=svtools
TARGET=config
-TARGET1=heavyconfig
-LIBTARGET=NO
ENABLE_EXCEPTIONS := TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
+.INCLUDE : $(PRJ)$/util$/svt.pmk
# --- Files --------------------------------------------------------
-SLOFILES = $(LIB1OBJFILES) $(LIB2OBJFILES)
-
-# --- config.lib Files --------------------------------------------------------
-LIB1TARGET= $(SLB)$/$(TARGET).lib
-
-LIB1OBJFILES= \
- $(SLO)$/accelcfg.obj \
- $(SLO)$/fltrcfg.obj \
- $(SLO)$/xmlaccelcfg.obj \
- $(SLO)$/moduleoptions.obj \
- $(SLO)$/pathoptions.obj \
- $(SLO)$/saveopt.obj \
- $(SLO)$/lingucfg.obj \
- $(SLO)$/javaoptions.obj \
- $(SLO)$/securityoptions.obj \
- $(SLO)$/localisationoptions.obj \
- $(SLO)$/workingsetoptions.obj \
- $(SLO)$/viewoptions.obj \
- $(SLO)$/internaloptions.obj \
- $(SLO)$/startoptions.obj \
- $(SLO)$/historyoptions.obj \
- $(SLO)$/inetoptions.obj \
- $(SLO)$/menuoptions.obj \
- $(SLO)$/dynamicmenuoptions.obj \
- $(SLO)$/optionsdrawinglayer.obj \
- $(SLO)$/fontoptions.obj \
- $(SLO)$/addxmltostorageoptions.obj \
- $(SLO)$/defaultoptions.obj \
- $(SLO)$/searchopt.obj \
- $(SLO)$/printwarningoptions.obj \
- $(SLO)$/cacheoptions.obj \
- $(SLO)$/regoptions.obj \
- $(SLO)$/cmdoptions.obj \
- $(SLO)$/extendedsecurityoptions.obj \
- $(SLO)$/sourceviewconfig.obj \
- $(SLO)$/compatibility.obj \
- $(SLO)$/eventcfg.obj \
- $(SLO)$/optionsdlg.obj \
- $(SLO)$/itemholder1.obj \
- $(SLO)$/options.obj
-
-# $(SLO)$/miscopt.obj \
-# --- heavyconfig.lib Files --------------------------------------------------------
-LIB2TARGET= $(SLB)$/$(TARGET1).lib
-
-LIB2OBJFILES= \
- $(SLO)$/accessibilityoptions.obj \
- $(SLO)$/fontsubstconfig.obj \
- $(SLO)$/misccfg.obj \
- $(SLO)$/apearcfg.obj \
- $(SLO)$/helpopt.obj \
- $(SLO)$/printoptions.obj \
- $(SLO)$/languageoptions.obj \
- $(SLO)$/ctloptions.obj \
- $(SLO)$/cjkoptions.obj \
- $(SLO)$/colorcfg.obj \
- $(SLO)$/extcolorcfg.obj \
- $(SLO)$/undoopt.obj \
- $(SLO)$/useroptions.obj \
- $(SLO)$/syslocaleoptions.obj \
- $(SLO)$/itemholder2.obj \
- $(SLO)$/miscopt.obj
+SLOFILES= \
+ $(SLO)$/accessibilityoptions.obj \
+ $(SLO)$/apearcfg.obj \
+ $(SLO)$/colorcfg.obj \
+ $(SLO)$/extcolorcfg.obj \
+ $(SLO)$/fontsubstconfig.obj \
+ $(SLO)$/helpopt.obj \
+ $(SLO)$/itemholder2.obj \
+ $(SLO)$/menuoptions.obj \
+ $(SLO)$/miscopt.obj \
+ $(SLO)$/optionsdrawinglayer.obj \
+ $(SLO)$/printoptions.obj
# --- Targets ------------------------------------------------------
diff --git a/svtools/source/config/menuoptions.cxx b/svtools/source/config/menuoptions.cxx
index 2d0e8d905ad9..8c00d7165ba5 100644
--- a/svtools/source/config/menuoptions.cxx
+++ b/svtools/source/config/menuoptions.cxx
@@ -46,7 +46,7 @@
#include <vcl/svapp.hxx>
#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
+#include "itemholder2.hxx"
//_________________________________________________________________________________________________________________
// namespaces
@@ -111,8 +111,8 @@ class SvtMenuOptions_Impl : public ConfigItem
SvtMenuOptions_Impl();
~SvtMenuOptions_Impl();
- void AddListener( const Link& rLink );
- void RemoveListener( const Link& rLink );
+ void AddListenerLink( const Link& rLink );
+ void RemoveListenerLink( const Link& rLink );
//---------------------------------------------------------------------------------------------------------
// overloaded methods of baseclass
@@ -412,12 +412,12 @@ Sequence< OUString > SvtMenuOptions_Impl::impl_GetPropertyNames()
return seqPropertyNames;
}
-void SvtMenuOptions_Impl::AddListener( const Link& rLink )
+void SvtMenuOptions_Impl::AddListenerLink( const Link& rLink )
{
aList.Insert( new Link( rLink ) );
}
-void SvtMenuOptions_Impl::RemoveListener( const Link& rLink )
+void SvtMenuOptions_Impl::RemoveListenerLink( const Link& rLink )
{
for ( USHORT n=0; n<aList.Count(); n++ )
{
@@ -452,7 +452,7 @@ SvtMenuOptions::SvtMenuOptions()
RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtMenuOptions_Impl::ctor()");
m_pDataContainer = new SvtMenuOptions_Impl();
- ItemHolder1::holdConfigItem(E_MENUOPTIONS);
+ ItemHolder2::holdConfigItem(E_MENUOPTIONS);
}
}
@@ -553,12 +553,12 @@ Mutex& SvtMenuOptions::GetOwnStaticMutex()
return *pMutex;
}
-void SvtMenuOptions::AddListener( const Link& rLink )
+void SvtMenuOptions::AddListenerLink( const Link& rLink )
{
- m_pDataContainer->AddListener( rLink );
+ m_pDataContainer->AddListenerLink( rLink );
}
-void SvtMenuOptions::RemoveListener( const Link& rLink )
+void SvtMenuOptions::RemoveListenerLink( const Link& rLink )
{
- m_pDataContainer->RemoveListener( rLink );
+ m_pDataContainer->RemoveListenerLink( rLink );
}
diff --git a/svtools/source/config/misccfg.cxx b/svtools/source/config/misccfg.cxx
deleted file mode 100644
index 06cc9b7446c0..000000000000
--- a/svtools/source/config/misccfg.cxx
+++ /dev/null
@@ -1,195 +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: misccfg.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include "misccfg.hxx"
-#include <svtools/zforlist.hxx>
-#include <tools/debug.hxx>
-
-#include <rtl/logfile.hxx>
-
-
-#define DEFAULT_TAB 2000
-
-#define DEF_INCH 2540L
-#define DEF_RELTWIP 1440L
-
-using namespace rtl;
-using namespace com::sun::star::uno;
-
-#define C2U(cChar) OUString::createFromAscii(cChar)
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-SfxMiscCfg::SfxMiscCfg() :
- ConfigItem(C2U("Office.Common") ),
- bPaperSize(FALSE),
- bPaperOrientation (FALSE),
- bNotFound (FALSE),
- nYear2000( SvNumberFormatter::GetYear2000Default() )
-{
- RTL_LOGFILE_CONTEXT(aLog, "svtools SfxMiscCfg::SfxMiscCfg()");
-
- Load();
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-SfxMiscCfg::~SfxMiscCfg()
-{
-}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-void SfxMiscCfg::SetNotFoundWarning( BOOL bSet)
-{
- if(bNotFound != bSet)
- SetModified();
- bNotFound = bSet;
-}
-
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-void SfxMiscCfg::SetPaperSizeWarning( BOOL bSet)
-{
- if(bPaperSize != bSet)
- SetModified();
- bPaperSize = bSet;
-}
-
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-void SfxMiscCfg::SetPaperOrientationWarning( BOOL bSet)
-{
- if(bPaperOrientation != bSet)
- SetModified();
- bPaperOrientation = bSet;
-}
-/*--------------------------------------------------------------------
- Beschreibung:
- --------------------------------------------------------------------*/
-
-void SfxMiscCfg::SetYear2000( sal_Int32 nSet )
-{
- if(nYear2000 != nSet)
- SetModified();
- nYear2000 = nSet;
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-const Sequence<OUString>& SfxMiscCfg::GetPropertyNames()
-{
- static Sequence<OUString> aNames;
- if(!aNames.getLength())
- {
- static const char* aPropNames[] =
- {
- "Print/Warning/PaperSize", // 0
- "Print/Warning/PaperOrientation", // 1
- "Print/Warning/NotFound", // 2
- "DateFormat/TwoDigitYear", // 3
- };
- const int nCount = 4;
- aNames.realloc(nCount);
- OUString* pNames = aNames.getArray();
- for(int i = 0; i < nCount; i++)
- pNames[i] = OUString::createFromAscii(aPropNames[i]);
- }
- return aNames;
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxMiscCfg::Load()
-{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues = GetProperties(aNames);
- EnableNotification(aNames);
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed");
- if(aValues.getLength() == aNames.getLength())
- {
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- if(pValues[nProp].hasValue())
- {
- switch(nProp)
- {
- case 0: bPaperSize = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperSize",
- case 1: bPaperOrientation = *(sal_Bool*)pValues[nProp].getValue(); break; //"Print/Warning/PaperOrientation",
- case 2: bNotFound = *(sal_Bool*)pValues[nProp].getValue() ; break; //"Print/Warning/NotFound",
- case 3: pValues[nProp] >>= nYear2000;break; //"DateFormat/TwoDigitYear",
- }
- }
- }
- }
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxMiscCfg::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
-{
- Load();
-}
-/* -----------------------------02.03.01 15:31--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxMiscCfg::Commit()
-{
- const Sequence<OUString>& aNames = GetPropertyNames();
- Sequence<Any> aValues(aNames.getLength());
- Any* pValues = aValues.getArray();
-
- const Type& rType = ::getBooleanCppuType();
- for(int nProp = 0; nProp < aNames.getLength(); nProp++)
- {
- switch(nProp)
- {
- case 0: pValues[nProp].setValue(&bPaperSize, rType);break; //"Print/Warning/PaperSize",
- case 1: pValues[nProp].setValue(&bPaperOrientation, rType);break; //"Print/Warning/PaperOrientation",
- case 2: pValues[nProp].setValue(&bNotFound, rType);break; //"Print/Warning/NotFound",
- case 3: pValues[nProp] <<= nYear2000;break; //"DateFormat/TwoDigitYear",
- }
- }
- PutProperties(aNames, aValues);
-}
-
diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx
index 7a6dc4281da6..af6861a5104f 100644
--- a/svtools/source/config/miscopt.cxx
+++ b/svtools/source/config/miscopt.cxx
@@ -33,10 +33,6 @@
//_________________________________________________________________________________________________________________
// includes
//_________________________________________________________________________________________________________________
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
#include <svtools/miscopt.hxx>
#include <unotools/configmgr.hxx>
@@ -231,8 +227,8 @@ class SvtMiscOptions_Impl : public ConfigItem
inline sal_Bool IsUseSystemPrintDialogReadOnly() const
{ return m_bIsUseSystemPrintDialogRO; }
- void AddListener( const Link& rLink );
- void RemoveListener( const Link& rLink );
+ void AddListenerLink( const Link& rLink );
+ void RemoveListenerLink( const Link& rLink );
void CallListeners();
//-------------------------------------------------------------------------------------------------------------
@@ -260,42 +256,6 @@ class SvtMiscOptions_Impl : public ConfigItem
void ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName );
};
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-static sal_Int16 implSymbolsStyleFromVCL( ULONG nStyle )
-{
- switch ( nStyle )
- {
- case STYLE_SYMBOLS_AUTO: return SFX_SYMBOLS_STYLE_AUTO;
- case STYLE_SYMBOLS_DEFAULT: return SFX_SYMBOLS_STYLE_DEFAULT;
- case STYLE_SYMBOLS_HICONTRAST: return SFX_SYMBOLS_STYLE_HICONTRAST;
- case STYLE_SYMBOLS_INDUSTRIAL: return SFX_SYMBOLS_STYLE_INDUSTRIAL;
- case STYLE_SYMBOLS_CRYSTAL: return SFX_SYMBOLS_STYLE_CRYSTAL;
- case STYLE_SYMBOLS_TANGO: return SFX_SYMBOLS_STYLE_TANGO;
- case STYLE_SYMBOLS_CLASSIC: return SFX_SYMBOLS_STYLE_CLASSIC;
- }
-
- return SFX_SYMBOLS_STYLE_AUTO;
-}
-
-static ULONG implSymbolsStyleToVCL( sal_Int16 nStyle )
-{
- switch ( nStyle )
- {
- case SFX_SYMBOLS_STYLE_AUTO: return STYLE_SYMBOLS_AUTO;
- case SFX_SYMBOLS_STYLE_DEFAULT: return STYLE_SYMBOLS_DEFAULT;
- case SFX_SYMBOLS_STYLE_HICONTRAST: return STYLE_SYMBOLS_HICONTRAST;
- case SFX_SYMBOLS_STYLE_INDUSTRIAL: return STYLE_SYMBOLS_INDUSTRIAL;
- case SFX_SYMBOLS_STYLE_CRYSTAL: return STYLE_SYMBOLS_CRYSTAL;
- case SFX_SYMBOLS_STYLE_TANGO: return STYLE_SYMBOLS_TANGO;
- case SFX_SYMBOLS_STYLE_CLASSIC: return STYLE_SYMBOLS_CLASSIC;
- }
-
- return STYLE_SYMBOLS_AUTO;
-}
-
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
@@ -503,12 +463,12 @@ void SvtMiscOptions_Impl::Load( const Sequence< OUString >& rPropertyNames )
}
}
-void SvtMiscOptions_Impl::AddListener( const Link& rLink )
+void SvtMiscOptions_Impl::AddListenerLink( const Link& rLink )
{
aList.Insert( new Link( rLink ) );
}
-void SvtMiscOptions_Impl::RemoveListener( const Link& rLink )
+void SvtMiscOptions_Impl::RemoveListenerLink( const Link& rLink )
{
for ( USHORT n=0; n<aList.Count(); n++ )
{
@@ -543,7 +503,7 @@ void SvtMiscOptions_Impl::SetSymbolsSize( sal_Int16 nSet )
sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const
{
- return implSymbolsStyleFromVCL( Application::GetSettings().GetStyleSettings().GetSymbolsStyle() );
+ return (sal_Int16)Application::GetSettings().GetStyleSettings().GetSymbolsStyle();
}
::rtl::OUString SvtMiscOptions_Impl::GetSymbolsStyleName() const
@@ -553,7 +513,7 @@ sal_Int16 SvtMiscOptions_Impl::GetSymbolsStyle() const
sal_Int16 SvtMiscOptions_Impl::GetCurrentSymbolsStyle() const
{
- return implSymbolsStyleFromVCL( Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle() );
+ return (sal_Int16)Application::GetSettings().GetStyleSettings().GetCurrentSymbolsStyle();
}
void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, const ::rtl::OUString &rName )
@@ -565,7 +525,7 @@ void SvtMiscOptions_Impl::ImplSetSymbolsStyle( bool bValue, sal_Int16 nSet, cons
StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
if ( bValue )
- aStyleSettings.SetSymbolsStyle( implSymbolsStyleToVCL( nSet ) );
+ aStyleSettings.SetSymbolsStyle( nSet );
else
aStyleSettings.SetSymbolsStyleName( rName );
@@ -863,12 +823,12 @@ Mutex & SvtMiscOptions::GetInitMutex()
return *pMutex;
}
-void SvtMiscOptions::AddListener( const Link& rLink )
+void SvtMiscOptions::AddListenerLink( const Link& rLink )
{
- m_pDataContainer->AddListener( rLink );
+ m_pDataContainer->AddListenerLink( rLink );
}
-void SvtMiscOptions::RemoveListener( const Link& rLink )
+void SvtMiscOptions::RemoveListenerLink( const Link& rLink )
{
- m_pDataContainer->RemoveListener( rLink );
+ m_pDataContainer->RemoveListenerLink( rLink );
}
diff --git a/svtools/source/config/moduleoptions.cxx b/svtools/source/config/moduleoptions.cxx
deleted file mode 100644
index fda0967d65ed..000000000000
--- a/svtools/source/config/moduleoptions.cxx
+++ /dev/null
@@ -1,1600 +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: moduleoptions.cxx,v $
- * $Revision: 1.36 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/moduleoptions.hxx>
-#include <comphelper/sequenceashashmap.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <unotools/processfactory.hxx>
-#include <osl/diagnose.h>
-#include <rtl/ustrbuf.hxx>
-
-#include <rtl/logfile.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/document/XTypeDetection.hpp>
-#include <com/sun/star/util/XStringSubstitution.hpp>
-
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-#ifndef css
-namespace css = ::com::sun::star;
-#endif
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-/*-************************************************************************************************************//**
- @descr These values are used to define neccessary keys from our configuration management to support
- all functionality of these implementation.
- It's a fast way to make changes if some keys change his name or location!
-
- Property handle are neccessary to specify right position in return list of configuration
- for asked values. We ask it with a list of properties to get his values. The returned list
- has the same order like our given name list!
- e.g.:
- NAMELIST[ PROPERTYHANDLE_xxx ] => VALUELIST[ PROPERTYHANDLE_xxx ]
-*//*-*************************************************************************************************************/
-#define ROOTNODE_FACTORIES ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/Office/Factories" ))
-#define PATHSEPERATOR ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/" ))
-
-// Attention: The property "ooSetupFactoryEmptyDocumentURL" is read from configuration but not used! There is
-// special code that uses hard coded strings to return them.
-#define PROPERTYNAME_SHORTNAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" ))
-#define PROPERTYNAME_TEMPLATEFILE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryTemplateFile" ))
-#define PROPERTYNAME_WINDOWATTRIBUTES ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryWindowAttributes"))
-#define PROPERTYNAME_EMPTYDOCUMENTURL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryEmptyDocumentURL"))
-#define PROPERTYNAME_DEFAULTFILTER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryDefaultFilter" ))
-#define PROPERTYNAME_ICON ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryIcon" ))
-
-#define PROPERTYHANDLE_SHORTNAME 0
-#define PROPERTYHANDLE_TEMPLATEFILE 1
-#define PROPERTYHANDLE_WINDOWATTRIBUTES 2
-#define PROPERTYHANDLE_EMPTYDOCUMENTURL 3
-#define PROPERTYHANDLE_DEFAULTFILTER 4
-#define PROPERTYHANDLE_ICON 5
-
-#define PROPERTYCOUNT 6
-
-#define FACTORYNAME_WRITER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextDocument" ))
-#define FACTORYNAME_WRITERWEB ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.WebDocument" ))
-#define FACTORYNAME_WRITERGLOBAL ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.GlobalDocument" ))
-#define FACTORYNAME_CALC ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SpreadsheetDocument" ))
-#define FACTORYNAME_DRAW ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DrawingDocument" ))
-#define FACTORYNAME_IMPRESS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument"))
-#define FACTORYNAME_MATH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.formula.FormulaProperties" ))
-#define FACTORYNAME_CHART ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument" ))
-#define FACTORYNAME_DATABASE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sdb.OfficeDatabaseDocument" ))
-#define FACTORYNAME_STARTMODULE ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule" ))
-
-#define FACTORYCOUNT 10
-
-/*-************************************************************************************************************//**
- @descr This struct hold information about one factory. We declare a complete array which can hold infos
- for all well known factories. Values of enum "EFactory" (see header!) are directly used as index!
- So we can support a fast access on these informations.
-*//*-*************************************************************************************************************/
-struct FactoryInfo
-{
- public:
- //---------------------------------------------------------------------------------------------------------
- // initialize empty struct
- FactoryInfo()
- {
- free();
- // @@@ should be supplied from outside!
- xSMgr = ::utl::getProcessServiceFactory();
- }
-
- //---------------------------------------------------------------------------------------------------------
- // easy way to reset struct member!
- void free()
- {
- bInstalled = sal_False ;
- sFactory = ::rtl::OUString() ;
- sShortName = ::rtl::OUString() ;
- sTemplateFile = ::rtl::OUString() ;
- sWindowAttributes = ::rtl::OUString() ;
- sEmptyDocumentURL = ::rtl::OUString() ;
- sDefaultFilter = ::rtl::OUString() ;
- nIcon = 0 ;
- bChangedTemplateFile = sal_False ;
- bChangedWindowAttributes = sal_False ;
- bChangedEmptyDocumentURL = sal_False ;
- bChangedDefaultFilter = sal_False ;
- bChangedIcon = sal_False ;
- bDefaultFilterReadonly = sal_False ;
- }
-
- //---------------------------------------------------------------------------------------------------------
- // returns list of properties, which has changed only!
- // We use given value of sNodeBase to build full qualified pathes ...
- // Last sign of it must be "/". Beacuse we use it directly, without any additional things!
- css::uno::Sequence< css::beans::PropertyValue > getChangedProperties( const ::rtl::OUString& sNodeBase )
- {
- // a) reserve memory for max. count of changed properties
- // b) add names and values of changed ones only and count it
- // c) resize return list by using count
- css::uno::Sequence< css::beans::PropertyValue > lProperties ( 4 );
- sal_Int8 nRealyChanged = 0 ;
-
- if( bChangedTemplateFile == sal_True )
- {
- lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_TEMPLATEFILE;
-
- if ( sTemplateFile.getLength() > 0 )
- {
- lProperties[nRealyChanged].Value
- <<= getStringSubstitution()
- ->reSubstituteVariables( sTemplateFile );
- }
- else
- {
- lProperties[nRealyChanged].Value <<= sTemplateFile;
- }
-
- ++nRealyChanged;
- }
- if( bChangedWindowAttributes == sal_True )
- {
- lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_WINDOWATTRIBUTES;
- lProperties[nRealyChanged].Value <<= sWindowAttributes;
- ++nRealyChanged;
- }
- if( bChangedEmptyDocumentURL == sal_True )
- {
- lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_EMPTYDOCUMENTURL;
- lProperties[nRealyChanged].Value <<= sEmptyDocumentURL;
- ++nRealyChanged;
- }
- if( bChangedDefaultFilter == sal_True )
- {
- lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_DEFAULTFILTER;
- lProperties[nRealyChanged].Value <<= sDefaultFilter;
- ++nRealyChanged;
- }
- if( bChangedIcon == sal_True )
- {
- lProperties[nRealyChanged].Name = sNodeBase + PROPERTYNAME_ICON;
- lProperties[nRealyChanged].Value <<= nIcon;
- ++nRealyChanged;
- }
-
- // Don't forget to reset changed flags! Otherwise we save it again and again and ...
- bChangedTemplateFile = sal_False ;
- bChangedWindowAttributes = sal_False ;
- bChangedEmptyDocumentURL = sal_False ;
- bChangedDefaultFilter = sal_False ;
- bChangedIcon = sal_False ;
-
- lProperties.realloc( nRealyChanged );
- return lProperties;
- }
-
- //---------------------------------------------------------------------------------------------------------
- // We must support setting AND marking of changed values.
- // That's why we can't make our member public. We must use get/set/init methods
- // to control access on it!
- sal_Bool getInstalled () const { return bInstalled; };
- ::rtl::OUString getFactory () const { return sFactory; };
- ::rtl::OUString getShortName () const { return sShortName; };
- ::rtl::OUString getTemplateFile () const { return sTemplateFile; };
- ::rtl::OUString getWindowAttributes () const { return sWindowAttributes; };
- ::rtl::OUString getEmptyDocumentURL () const { return sEmptyDocumentURL; };
- ::rtl::OUString getDefaultFilter () const { return sDefaultFilter; };
- sal_Bool isDefaultFilterReadonly() const { return bDefaultFilterReadonly; }
- sal_Int32 getIcon () const { return nIcon; };
-
- //---------------------------------------------------------------------------------------------------------
- // If you call set-methods - we check for changes of valkues and mark it.
- // But if you whish to set it without that ... you must initialize it!
- void initInstalled ( sal_Bool bNewInstalled ) { bInstalled = bNewInstalled ; }
- void initFactory ( const ::rtl::OUString& sNewFactory ) { sFactory = sNewFactory ; }
- void initShortName ( const ::rtl::OUString& sNewShortName ) { sShortName = sNewShortName ; }
- void initWindowAttributes ( const ::rtl::OUString& sNewWindowAttributes ) { sWindowAttributes = sNewWindowAttributes ; }
- void initEmptyDocumentURL ( const ::rtl::OUString& sNewEmptyDocumentURL ) { sEmptyDocumentURL = sNewEmptyDocumentURL ; }
- void initDefaultFilter ( const ::rtl::OUString& sNewDefaultFilter ) { sDefaultFilter = sNewDefaultFilter ; }
- void setDefaultFilterReadonly( const sal_Bool bVal){bDefaultFilterReadonly = bVal;}
- void initIcon ( sal_Int32 nNewIcon ) { nIcon = nNewIcon ; }
-
- //---------------------------------------------------------------------------------------------------------
- void initTemplateFile( const ::rtl::OUString& sNewTemplateFile )
- {
- if ( sNewTemplateFile.getLength() > 0 )
- {
- sTemplateFile
- = getStringSubstitution()
- ->substituteVariables( sNewTemplateFile, sal_False );
- }
- else
- {
- sTemplateFile = sNewTemplateFile;
- }
- }
-
- //---------------------------------------------------------------------------------------------------------
- void setInstalled( sal_Bool bNewInstalled )
- {
- bInstalled = bNewInstalled;
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setFactory( const ::rtl::OUString& sNewFactory )
- {
- sFactory = sNewFactory;
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setShortName( const ::rtl::OUString& sNewShortName )
- {
- sShortName = sNewShortName;
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setTemplateFile( const ::rtl::OUString& sNewTemplateFile )
- {
- if( sTemplateFile != sNewTemplateFile )
- {
- sTemplateFile = sNewTemplateFile;
- bChangedTemplateFile = sal_True ;
- }
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setWindowAttributes( const ::rtl::OUString& sNewWindowAttributes )
- {
- if( sWindowAttributes != sNewWindowAttributes )
- {
- sWindowAttributes = sNewWindowAttributes;
- bChangedWindowAttributes = sal_True ;
- }
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setEmptyDocumentURL( const ::rtl::OUString& sNewEmptyDocumentURL )
- {
- if( sEmptyDocumentURL != sNewEmptyDocumentURL )
- {
- sEmptyDocumentURL = sNewEmptyDocumentURL;
- bChangedEmptyDocumentURL = sal_True ;
- }
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setDefaultFilter( const ::rtl::OUString& sNewDefaultFilter )
- {
- if( sDefaultFilter != sNewDefaultFilter )
- {
- sDefaultFilter = sNewDefaultFilter;
- bChangedDefaultFilter = sal_True ;
- }
- };
-
- //---------------------------------------------------------------------------------------------------------
- void setIcon( sal_Int32 nNewIcon )
- {
- if( nNewIcon != nNewIcon )
- {
- nNewIcon = nNewIcon;
- bChangedIcon = sal_True;
- }
- };
-
- private:
- css::uno::Reference< css::util::XStringSubstitution > getStringSubstitution()
- {
- if ( !xSubstVars.is() )
- {
- xSubstVars
- = css::uno::Reference< css::util::XStringSubstitution >(
- xSMgr->createInstance(
- ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.PathSubstitution" ) ) ),
- css::uno::UNO_QUERY );
- if ( !xSubstVars.is() )
- throw css::uno::RuntimeException(
- ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "Cannot instanciate service "
- "com.sun.star.util.PathSubstitution" ) ),
- css::uno::Reference< css::uno::XInterface >() );
- }
- return xSubstVars;
- }
-
- sal_Bool bInstalled ;
- ::rtl::OUString sFactory ;
- ::rtl::OUString sShortName ;
- ::rtl::OUString sTemplateFile ;
- ::rtl::OUString sWindowAttributes ;
- ::rtl::OUString sEmptyDocumentURL ;
- ::rtl::OUString sDefaultFilter ;
- sal_Int32 nIcon ;
-
- sal_Bool bChangedTemplateFile :1 ;
- sal_Bool bChangedWindowAttributes :1 ;
- sal_Bool bChangedEmptyDocumentURL :1 ;
- sal_Bool bChangedDefaultFilter :1 ;
- sal_Bool bChangedIcon :1 ;
- sal_Bool bDefaultFilterReadonly :1 ;
-
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMgr;
- css::uno::Reference< css::util::XStringSubstitution > xSubstVars;
-};
-
-typedef FactoryInfo FactoryInfoList[FACTORYCOUNT];
-
-/*-************************************************************************************************************//**
- @short IMPL data container for wrapper class SvtModulOptions!
- @descr These class is used as a static data container of class SvtModuleOptions. The hold it by using
- a refcount and make it threadsafe by using an osl mutex. So we don't must do anything for that.
- We can implement pure functionality to read/write configuration data only.
-
- @implements -
- @base ConfigItem
-
- @devstatus ready to use
- @threadsafe no
-*//*-*************************************************************************************************************/
-class SvtModuleOptions_Impl : public ::utl::ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
- public:
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
- SvtModuleOptions_Impl(SvtModuleOptions* pOutsideClass);
- ~SvtModuleOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
- virtual void Notify( const css::uno::Sequence< ::rtl::OUString >& lPropertyNames );
- virtual void Commit( );
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
- sal_Bool IsModuleInstalled ( SvtModuleOptions::EModule eModule ) const;
- ::com::sun::star::uno::Sequence < ::rtl::OUString > GetAllServiceNames();
- ::rtl::OUString GetFactoryName ( SvtModuleOptions::EFactory eFactory ) const;
- ::rtl::OUString GetFactoryShortName ( SvtModuleOptions::EFactory eFactory ) const;
- ::rtl::OUString GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const;
- ::rtl::OUString GetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory ) const;
- ::rtl::OUString GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory eFactory ) const;
- ::rtl::OUString GetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory ) const;
- sal_Bool IsDefaultFilterReadonly( SvtModuleOptions::EFactory eFactory ) const;
- sal_Int32 GetFactoryIcon ( SvtModuleOptions::EFactory eFactory ) const;
- static sal_Bool ClassifyFactoryByName ( const ::rtl::OUString& sName ,
- SvtModuleOptions::EFactory& eFactory );
- void SetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ,
- const ::rtl::OUString& sTemplate );
- void SetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory ,
- const ::rtl::OUString& sAttributes);
- void SetFactoryDefaultFilter ( SvtModuleOptions::EFactory eFactory ,
- const ::rtl::OUString& sFilter );
- void MakeReadonlyStatesAvailable();
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
- private:
- static css::uno::Sequence< ::rtl::OUString > impl_ExpandSetNames ( const css::uno::Sequence< ::rtl::OUString >& lSetNames );
- void impl_Read ( const css::uno::Sequence< ::rtl::OUString >& lSetNames );
-
- //-------------------------------------------------------------------------------------------------------------
- // private types
- //-------------------------------------------------------------------------------------------------------------
- private:
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
- private:
- FactoryInfoList m_lFactories;
- sal_Bool m_bReadOnlyStatesWellKnown;
- SvtModuleOptions* m_pOutsideClass;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-/*-************************************************************************************************************//**
- @short default ctor
- @descr We open our configuration here and read all neccessary values from it.
- These values are cached till everyone call Commit(). Then we write changed ones back to cfg.
-
- @seealso baseclass ConfigItem
- @seealso method impl_Read()
-
- @param -
- @return -
-
- @onerror -
- @threadsafe no
-*//*-*************************************************************************************************************/
-SvtModuleOptions_Impl::SvtModuleOptions_Impl(SvtModuleOptions* pOutsideClass)
- : ::utl::ConfigItem( ROOTNODE_FACTORIES )
- , m_bReadOnlyStatesWellKnown( sal_False )
- , m_pOutsideClass( pOutsideClass )
-{
- // First initialize list of factory infos! Otherwise we couldnt gurantee right working of these class.
- for( sal_Int32 nFactory=0; nFactory<FACTORYCOUNT; ++nFactory )
- m_lFactories[nFactory].free();
-
- // Get name list of all existing set node names in configuration to read her properties in impl_Read().
- // These list is a list of long names of our factories.
- const css::uno::Sequence< ::rtl::OUString > lFactories = GetNodeNames( ::rtl::OUString() );
- impl_Read( lFactories );
-
- // Enable notification for changes by using configuration directly.
- // So we can update our internal values immediatly.
- EnableNotification( lFactories );
-}
-
-/*-************************************************************************************************************//**
- @short default dtor
- @descr If any values of our cache was modified we should write it back to configuration.
-
- @attention Don't forget to call "SetModified()" method of base class ConfigItem if any interface method
- of this class modify internal member list m_lFactories! Otherwise Commit() will never be called!!!
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- @threadsafe no
-*//*-*************************************************************************************************************/
-SvtModuleOptions_Impl::~SvtModuleOptions_Impl()
-{
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-/*-************************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update our
- internal values.
-
- @attention We are registered for pure set node names only. So we can use our internal method "impl_Read()" to
- update our info list. Because - these method expand given name list to full qualified property list
- and use it to read the values. These values are filled into our internal member list m_lFactories
- at right position.
-
- @seealso method impl_Read()
-
- @param "lNames" is the list of set node entries which should be updated.
- @return -
-
- @onerror -
- @threadsafe no
-*//*-*************************************************************************************************************/
-void SvtModuleOptions_Impl::Notify( const css::uno::Sequence< ::rtl::OUString >& )
-{
- OSL_ENSURE( sal_False, "SvtModuleOptions_Impl::Notify()\nNot implemented yet!\n" );
-}
-
-/*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @attention We clear complete set in configuration first and write it completly new! So we don't must
- distinguish between existing, added or removed elements. Our internal cached values
- are the only and right ones.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- @threadsafe no
-*//*-*****************************************************************************************************/
-void SvtModuleOptions_Impl::Commit()
-{
- // Reserve memory for ALL possible factory properties!
- // Step over all factories and get her realy changed values only.
- // Build list of these ones and use it for commit.
- css::uno::Sequence< css::beans::PropertyValue > lCommitProperties( FACTORYCOUNT*PROPERTYCOUNT );
- FactoryInfo* pInfo = NULL ;
- sal_Int32 nRealCount = 0 ;
- ::rtl::OUString sBasePath ;
- for( sal_Int32 nFactory=0; nFactory<FACTORYCOUNT; ++nFactory )
- {
- pInfo = &(m_lFactories[nFactory]);
-
- // These path is used to build full qualified property names ....
- // See pInfo->getChangedProperties() for further informations
- sBasePath = PATHSEPERATOR + pInfo->getFactory() + PATHSEPERATOR;
-
- const css::uno::Sequence< css::beans::PropertyValue > lChangedProperties = pInfo->getChangedProperties ( sBasePath );
- const css::beans::PropertyValue* pChangedProperties = lChangedProperties.getConstArray();
- sal_Int32 nPropertyCount = lChangedProperties.getLength();
- for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- lCommitProperties[nRealCount] = pChangedProperties[nProperty];
- ++nRealCount;
- }
- }
- // Resize commit list to real size.
- // If nothing to do - suppress calling of configuration ...
- // It could be to expensive :-)
- if( nRealCount > 0 )
- {
- lCommitProperties.realloc( nRealCount );
- SetSetProperties( ::rtl::OUString(), lCommitProperties );
- }
-}
-
-/*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These methods implement easy access to our internal values.
- You give us right enum value to specify which module interest you ... we return right information.
-
- @attention Some poeple use any value as enum ... but we support in header specified values only!
- We use it directly as index in our internal list. If enum value isn't right - we crash with an
- "index out of range"!!! Please use me right - otherwise there is no guarantee.
-
- @seealso -
-
- @param "eModule" , index in list - specify module
- @param "eFactory" , index in list - specify factory
- @param "sTemplate", set new standard template for these factory
- @return Queried information.
-
- @onerror We return default values. (mostly "not installed"!)
- @threadsafe no
-*//*-*****************************************************************************************************/
-sal_Bool SvtModuleOptions_Impl::IsModuleInstalled( SvtModuleOptions::EModule eModule ) const
-{
- sal_Bool bInstalled = sal_False;
- switch( eModule )
- {
- case SvtModuleOptions::E_SWRITER : bInstalled = m_lFactories[SvtModuleOptions::E_WRITER].getInstalled();
- break;
- case SvtModuleOptions::E_SWEB : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled();
- break;
- case SvtModuleOptions::E_SGLOBAL : bInstalled = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled();
- break;
- case SvtModuleOptions::E_SCALC : bInstalled = m_lFactories[SvtModuleOptions::E_CALC].getInstalled();
- break;
- case SvtModuleOptions::E_SDRAW : bInstalled = m_lFactories[SvtModuleOptions::E_DRAW].getInstalled();
- break;
- case SvtModuleOptions::E_SIMPRESS : bInstalled = m_lFactories[SvtModuleOptions::E_IMPRESS].getInstalled();
- break;
- case SvtModuleOptions::E_SMATH : bInstalled = m_lFactories[SvtModuleOptions::E_MATH].getInstalled();
- break;
- case SvtModuleOptions::E_SCHART : bInstalled = m_lFactories[SvtModuleOptions::E_CHART].getInstalled();
- break;
- case SvtModuleOptions::E_SSTARTMODULE : bInstalled = m_lFactories[SvtModuleOptions::E_STARTMODULE].getInstalled();
- break;
- case SvtModuleOptions::E_SBASIC : bInstalled = sal_True; // Couldn't be deselected by setup yet!
- break;
- case SvtModuleOptions::E_SDATABASE : bInstalled = m_lFactories[SvtModuleOptions::E_DATABASE].getInstalled();
- break;
- }
-
- return bInstalled;
-}
-
-::com::sun::star::uno::Sequence < ::rtl::OUString > SvtModuleOptions_Impl::GetAllServiceNames()
-{
- sal_uInt32 nCount=0;
- if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() )
- nCount++;
- if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() )
- nCount++;
- if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() )
- nCount++;
- if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() )
- nCount++;
-
- css::uno::Sequence < ::rtl::OUString > aRet( nCount );
- sal_Int32 n=0;
- if( m_lFactories[SvtModuleOptions::E_WRITER].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITER].getFactory();
- if ( m_lFactories[SvtModuleOptions::E_WRITERWEB].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERWEB].getFactory();
- if ( m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_WRITERGLOBAL].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SCALC].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SCALC].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SDRAW].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SDRAW].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SIMPRESS].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SIMPRESS].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SCHART].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SCHART].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SMATH].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SMATH].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SBASIC].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SBASIC].getFactory();
- if( m_lFactories[SvtModuleOptions::E_SDATABASE].getInstalled() )
- aRet[n++] = m_lFactories[SvtModuleOptions::E_SDATABASE].getFactory();
-
- return aRet;
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions_Impl::GetFactoryName( SvtModuleOptions::EFactory eFactory ) const
-{
- ::rtl::OUString sName;
-
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- sName = m_lFactories[eFactory].getFactory();
- }
-
- return sName;
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions_Impl::GetFactoryShortName( SvtModuleOptions::EFactory eFactory ) const
-{
- // Attention: Hard configured yet ... because it's not fine to make changes possible by xml file yet.
- // But it's good to plan further possibilities!
-
- //return m_lFactories[eFactory].sShortName;
-
- ::rtl::OUString sShortName;
- switch( eFactory )
- {
- case SvtModuleOptions::E_WRITER : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("swriter"));
- break;
- case SvtModuleOptions::E_WRITERWEB : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("swriter/web"));
- break;
- case SvtModuleOptions::E_WRITERGLOBAL : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("swriter/GlobalDocument"));
- break;
- case SvtModuleOptions::E_CALC : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("scalc"));
- break;
- case SvtModuleOptions::E_DRAW : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdraw"));
- break;
- case SvtModuleOptions::E_IMPRESS : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("simpress"));
- break;
- case SvtModuleOptions::E_MATH : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("smath"));
- break;
- case SvtModuleOptions::E_CHART : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("schart"));
- break;
- case SvtModuleOptions::E_BASIC : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sbasic"));
- break;
- case SvtModuleOptions::E_DATABASE : sShortName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sdatabase"));
- break;
- default:
- OSL_ASSERT( "unknown factory" );
- break;
- }
-
- return sShortName;
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions_Impl::GetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ) const
-{
- ::rtl::OUString sFile;
-
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- sFile = m_lFactories[eFactory].getTemplateFile();
- }
-
- return sFile;
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions_Impl::GetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory ) const
-{
- ::rtl::OUString sAttributes;
-
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- sAttributes = m_lFactories[eFactory].getWindowAttributes();
- }
-
- return sAttributes;
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions_Impl::GetFactoryEmptyDocumentURL( SvtModuleOptions::EFactory eFactory ) const
-{
- // Attention: Hard configured yet ... because it's not fine to make changes possible by xml file yet.
- // But it's good to plan further possibilities!
-
- //return m_lFactories[eFactory].getEmptyDocumentURL();
-
- ::rtl::OUString sURL;
- switch( eFactory )
- {
- case SvtModuleOptions::E_WRITER : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/swriter"));
- break;
- case SvtModuleOptions::E_WRITERWEB : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/swriter/web"));
- break;
- case SvtModuleOptions::E_WRITERGLOBAL : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/swriter/GlobalDocument"));
- break;
- case SvtModuleOptions::E_CALC : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc"));
- break;
- case SvtModuleOptions::E_DRAW : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/sdraw"));
- break;
- case SvtModuleOptions::E_IMPRESS : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/simpress?slot=6686"));
- break;
- case SvtModuleOptions::E_MATH : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/smath"));
- break;
- case SvtModuleOptions::E_CHART : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/schart"));
- break;
- case SvtModuleOptions::E_BASIC : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/sbasic"));
- break;
- case SvtModuleOptions::E_DATABASE : sURL = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/sdatabase?Interactive"));
- break;
- default:
- OSL_ASSERT( "unknown factory" );
- break;
- }
- return sURL;
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions_Impl::GetFactoryDefaultFilter( SvtModuleOptions::EFactory eFactory ) const
-{
- ::rtl::OUString sDefaultFilter;
-
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- sDefaultFilter = m_lFactories[eFactory].getDefaultFilter();
- }
- return sDefaultFilter;
-}
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions_Impl::IsDefaultFilterReadonly( SvtModuleOptions::EFactory eFactory ) const
-{
- sal_Bool bRet = sal_False;
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- bRet = m_lFactories[eFactory].isDefaultFilterReadonly();
- }
- return bRet;
-}
-
-//*****************************************************************************************************************
-sal_Int32 SvtModuleOptions_Impl::GetFactoryIcon( SvtModuleOptions::EFactory eFactory ) const
-{
- sal_Int32 nIcon = 0;
-
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- nIcon = m_lFactories[eFactory].getIcon();
- }
-
- return nIcon;
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions_Impl::SetFactoryStandardTemplate( SvtModuleOptions::EFactory eFactory ,
- const ::rtl::OUString& sTemplate )
-{
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- m_lFactories[eFactory].setTemplateFile( sTemplate );
- SetModified();
- }
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions_Impl::SetFactoryWindowAttributes( SvtModuleOptions::EFactory eFactory ,
- const ::rtl::OUString& sAttributes)
-{
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- m_lFactories[eFactory].setWindowAttributes( sAttributes );
- SetModified();
- }
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions_Impl::SetFactoryDefaultFilter( SvtModuleOptions::EFactory eFactory,
- const ::rtl::OUString& sFilter )
-{
- if( eFactory>=0 && eFactory<FACTORYCOUNT )
- {
- m_lFactories[eFactory].setDefaultFilter( sFilter );
- SetModified();
- }
-}
-
-/*-************************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent our module tree
- @descr You give use a list of current existing set node names .. and we expand it for all
- well known properties which are neccessary for this implementation.
- These full expanded list should be used to get values of this properties.
-
- @seealso ctor
-
- @param -
- @return List of all relative addressed properties of given set entry names.
-
- @onerror List will be empty.
- @threadsafe no
-*//*-*************************************************************************************************************/
-css::uno::Sequence< ::rtl::OUString > SvtModuleOptions_Impl::impl_ExpandSetNames( const css::uno::Sequence< ::rtl::OUString >& lSetNames )
-{
- sal_Int32 nCount = lSetNames.getLength() ;
- css::uno::Sequence< ::rtl::OUString > lPropNames ( nCount*PROPERTYCOUNT );
- ::rtl::OUString* pPropNames = lPropNames.getArray() ;
- sal_Int32 nPropStart = 0 ;
-
- for( sal_Int32 nName=0; nName<nCount; ++nName )
- {
- pPropNames[nPropStart+PROPERTYHANDLE_SHORTNAME ] = lSetNames[nName] + PATHSEPERATOR + PROPERTYNAME_SHORTNAME ;
- pPropNames[nPropStart+PROPERTYHANDLE_TEMPLATEFILE ] = lSetNames[nName] + PATHSEPERATOR + PROPERTYNAME_TEMPLATEFILE ;
- pPropNames[nPropStart+PROPERTYHANDLE_WINDOWATTRIBUTES] = lSetNames[nName] + PATHSEPERATOR + PROPERTYNAME_WINDOWATTRIBUTES;
- pPropNames[nPropStart+PROPERTYHANDLE_EMPTYDOCUMENTURL] = lSetNames[nName] + PATHSEPERATOR + PROPERTYNAME_EMPTYDOCUMENTURL;
- pPropNames[nPropStart+PROPERTYHANDLE_DEFAULTFILTER ] = lSetNames[nName] + PATHSEPERATOR + PROPERTYNAME_DEFAULTFILTER ;
- pPropNames[nPropStart+PROPERTYHANDLE_ICON ] = lSetNames[nName] + PATHSEPERATOR + PROPERTYNAME_ICON ;
- nPropStart += PROPERTYCOUNT;
- }
-
- return lPropNames;
-}
-
-/*-************************************************************************************************************//**
- @short helper to classify given factory by name
- @descr Every factory has his own long and short name. So we can match right enum value for internal using.
-
- @attention We change in/out parameter "eFactory" in every case! But you should use it only, if return value is TRUE!
- Algorithm: Set out-parameter to propably value ... and check the longname.
- If it match with these factory - break operation and return true AND right set parameter.
- Otherwise try next one and so on. If no factory was found return false. Out parameter eFactory
- is set to last tried value but shouldn't be used! Because our return value is false!
-
- @seealso -
-
- @param "sLongName" , long name of factory, which should be classified
- @return "eFactory" , right enum value, which match given long name
- and true for successfully classification, false otherwise
-
- @onerror We return false.
- @threadsafe no
-*//*-*************************************************************************************************************/
-sal_Bool SvtModuleOptions_Impl::ClassifyFactoryByName( const ::rtl::OUString& sName, SvtModuleOptions::EFactory& eFactory )
-{
- sal_Bool bState;
-
- eFactory = SvtModuleOptions::E_WRITER ;
- bState = ( sName == FACTORYNAME_WRITER );
-
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_WRITERWEB ;
- bState = ( sName == FACTORYNAME_WRITERWEB );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_WRITERGLOBAL ;
- bState = ( sName == FACTORYNAME_WRITERGLOBAL );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_CALC ;
- bState = ( sName == FACTORYNAME_CALC );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_DRAW ;
- bState = ( sName == FACTORYNAME_DRAW );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_IMPRESS ;
- bState = ( sName == FACTORYNAME_IMPRESS );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_MATH ;
- bState = ( sName == FACTORYNAME_MATH );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_CHART ;
- bState = ( sName == FACTORYNAME_CHART );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_DATABASE ;
- bState = ( sName == FACTORYNAME_DATABASE );
- }
- // no else!
- if( bState == sal_False )
- {
- eFactory = SvtModuleOptions::E_STARTMODULE ;
- bState = ( sName == FACTORYNAME_STARTMODULE);
- }
-
- return bState;
-}
-
-/*-************************************************************************************************************//**
- @short read factory configuration
- @descr Give us a list of pure factory names (long names!) which can be used as
- direct set node names ... and we read her property values and fill internal list.
- These method can be used by initial reading at ctor and later updating by "Notify()".
-
- @seealso ctor
- @seealso method Notify()
-
- @param "lFactories" is the list of set node entries which should be readed.
- @return -
-
- @onerror We do nothing.
- @threadsafe no
-*//*-*************************************************************************************************************/
-void SvtModuleOptions_Impl::impl_Read( const css::uno::Sequence< ::rtl::OUString >& lFactories )
-{
- // Expand every set node name in lFactories to full qualified pathes to his properties
- // and get right values from configuration.
- const css::uno::Sequence< ::rtl::OUString > lProperties = impl_ExpandSetNames( lFactories );
- const css::uno::Sequence< css::uno::Any > lValues = GetProperties( lProperties );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- OSL_ENSURE( !(lProperties.getLength()!=lValues.getLength()), "SvtModuleOptions_Impl::impl_Read()\nI miss some values of configuration keys!\n" );
-
- // Algorithm: We step over all given factory names and classify it. These enum value can be used as direct index
- // in our member list m_lFactories! VAriable nPropertyStart marks start position of every factory
- // and her properties in expanded property/value list. The defines PROPERTHANDLE_xxx are used as offset values
- // added to nPropertyStart. So we can address every property relative in these lists.
- // If we found any valid values ... we reset all existing informations for corresponding m_lFactories-entry and
- // use a pointer to these struct in memory directly to set new values.
- // But we set it only, if bInstalled is true. Otherwise all other values of a factory can be undeclared .. They
- // shouldn't be used then.
- // Attention: If a propertyset of a factory will be ignored we must step to next start position of next factory infos!
- // see "nPropertyStart += PROPERTYCOUNT" ...
-
- sal_Int32 nPropertyStart = 0 ;
- sal_Int32 nNodeCount = lFactories.getLength();
- FactoryInfo* pInfo = NULL ;
- SvtModuleOptions::EFactory eFactory ;
-
- for( sal_Int32 nSetNode=0; nSetNode<nNodeCount; ++nSetNode )
- {
- const ::rtl::OUString& sFactoryName = lFactories[nSetNode];
- if( ClassifyFactoryByName( sFactoryName, eFactory ) == sal_True )
- {
- ::rtl::OUString sTemp;
- sal_Int32 nTemp = 0;
-
- pInfo = &(m_lFactories[eFactory]);
- pInfo->free();
-
- pInfo->initInstalled( sal_True );
- pInfo->initFactory ( sFactoryName );
-
- if (lValues[nPropertyStart+PROPERTYHANDLE_SHORTNAME] >>= sTemp)
- pInfo->initShortName( sTemp );
- if (lValues[nPropertyStart+PROPERTYHANDLE_TEMPLATEFILE] >>= sTemp)
- pInfo->initTemplateFile( sTemp );
- if (lValues[nPropertyStart+PROPERTYHANDLE_WINDOWATTRIBUTES] >>= sTemp)
- pInfo->initWindowAttributes( sTemp );
- if (lValues[nPropertyStart+PROPERTYHANDLE_EMPTYDOCUMENTURL] >>= sTemp)
- pInfo->initEmptyDocumentURL( sTemp );
- if (lValues[nPropertyStart+PROPERTYHANDLE_DEFAULTFILTER ] >>= sTemp)
- pInfo->initDefaultFilter( sTemp );
- if (lValues[nPropertyStart+PROPERTYHANDLE_ICON] >>= nTemp)
- pInfo->initIcon( nTemp );
- }
- nPropertyStart += PROPERTYCOUNT;
- }
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions_Impl::MakeReadonlyStatesAvailable()
-{
- if (m_bReadOnlyStatesWellKnown)
- return;
-
- css::uno::Sequence< ::rtl::OUString > lFactories = GetNodeNames(::rtl::OUString());
- sal_Int32 c = lFactories.getLength();
- sal_Int32 i = 0;
- for (i=0; i<c; ++i)
- {
- ::rtl::OUStringBuffer sPath(256);
- sPath.append(lFactories[i] );
- sPath.append(PATHSEPERATOR );
- sPath.append(PROPERTYNAME_DEFAULTFILTER);
-
- lFactories[i] = sPath.makeStringAndClear();
- }
-
- css::uno::Sequence< sal_Bool > lReadonlyStates = GetReadOnlyStates(lFactories);
- for (i=0; i<c; ++i)
- {
- ::rtl::OUString& rFactoryName = lFactories[i];
- SvtModuleOptions::EFactory eFactory ;
-
- if (!ClassifyFactoryByName(rFactoryName, eFactory))
- continue;
-
- FactoryInfo& rInfo = m_lFactories[eFactory];
- rInfo.setDefaultFilterReadonly(lReadonlyStates[i]);
- }
-
- m_bReadOnlyStatesWellKnown = sal_True;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtModuleOptions_Impl* SvtModuleOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtModuleOptions::m_nRefCount = 0 ;
-
-/*-************************************************************************************************************//**
- @short standard constructor and destructor
- @descr This will initialize an instance with default values. We initialize/deinitialize our static data
- container and create a static mutex, which is used for threadsafe code in further time of this object.
-
- @seealso method impl_GetOwnStaticMutex()
-
- @param -
- @return -
-
- @onerror -
- @threadsafe yes
-*//*-*************************************************************************************************************/
-SvtModuleOptions::SvtModuleOptions()
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- ++m_nRefCount;
- if( m_nRefCount == 1 )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtModuleOptions_Impl::ctor()");
- m_pDataContainer = new SvtModuleOptions_Impl(this);
-
- ItemHolder1::holdConfigItem(E_MODULEOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-SvtModuleOptions::~SvtModuleOptions()
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- --m_nRefCount;
- if( m_nRefCount == 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-/*-************************************************************************************************************//**
- @short access to configuration data
- @descr This methods allow read/write access to configuration values.
- They are threadsafe. All calls are forwarded to impl-data-container. See there for further informations!
-
- @seealso method impl_GetOwnStaticMutex()
-
- @param -
- @return -
-
- @onerror -
- @threadsafe yes
-*//*-*************************************************************************************************************/
-sal_Bool SvtModuleOptions::IsModuleInstalled( EModule eModule ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( eModule );
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions::GetFactoryName( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryName( eFactory );
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions::GetFactoryShortName( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryShortName( eFactory );
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions::GetFactoryStandardTemplate( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryStandardTemplate( eFactory );
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions::GetFactoryWindowAttributes( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryWindowAttributes( eFactory );
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions::GetFactoryEmptyDocumentURL( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryEmptyDocumentURL( eFactory );
-}
-
-//*****************************************************************************************************************
-::rtl::OUString SvtModuleOptions::GetFactoryDefaultFilter( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryDefaultFilter( eFactory );
-}
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsDefaultFilterReadonly( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->MakeReadonlyStatesAvailable();
- return m_pDataContainer->IsDefaultFilterReadonly( eFactory );
-}
-//*****************************************************************************************************************
-sal_Int32 SvtModuleOptions::GetFactoryIcon( EFactory eFactory ) const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetFactoryIcon( eFactory );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::ClassifyFactoryByName( const ::rtl::OUString& sName ,
- EFactory& eFactory )
-{
- // We don't need any mutex here ... because we don't use any member here!
- return SvtModuleOptions_Impl::ClassifyFactoryByName( sName, eFactory );
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions::SetFactoryStandardTemplate( EFactory eFactory ,
- const ::rtl::OUString& sTemplate )
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->SetFactoryStandardTemplate( eFactory, sTemplate );
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions::SetFactoryWindowAttributes( EFactory eFactory ,
- const ::rtl::OUString& sAttributes)
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->SetFactoryWindowAttributes( eFactory, sAttributes );
-}
-
-//*****************************************************************************************************************
-void SvtModuleOptions::SetFactoryDefaultFilter( EFactory eFactory,
- const ::rtl::OUString& sFilter )
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- m_pDataContainer->SetFactoryDefaultFilter( eFactory, sFilter );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsMath() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SMATH );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsChart() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SCHART );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsCalc() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SCALC );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsDraw() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SDRAW );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsWriter() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SWRITER );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsImpress() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SIMPRESS );
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsBasicIDE() const
-{
- return sal_True;
-}
-//*****************************************************************************************************************
-sal_Bool SvtModuleOptions::IsDataBase() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->IsModuleInstalled( E_SDATABASE );
-}
-//*****************************************************************************************************************
-sal_uInt32 SvtModuleOptions::GetFeatures() const
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
-
- sal_uInt32 nFeature = 0;
-
- if( m_pDataContainer->IsModuleInstalled( E_SWRITER ) == sal_True )
- nFeature |= FEATUREFLAG_WRITER;
- if( m_pDataContainer->IsModuleInstalled( E_SCALC ) == sal_True )
- nFeature |= FEATUREFLAG_CALC;
- if( m_pDataContainer->IsModuleInstalled( E_SDRAW ) == sal_True )
- nFeature |= FEATUREFLAG_DRAW;
- if( m_pDataContainer->IsModuleInstalled( E_SIMPRESS ) == sal_True )
- nFeature |= FEATUREFLAG_IMPRESS;
- if( m_pDataContainer->IsModuleInstalled( E_SCHART ) == sal_True )
- nFeature |= FEATUREFLAG_CHART;
- if( m_pDataContainer->IsModuleInstalled( E_SMATH ) == sal_True )
- nFeature |= FEATUREFLAG_MATH;
- if( m_pDataContainer->IsModuleInstalled( E_SBASIC ) == sal_True )
- nFeature |= FEATUREFLAG_BASICIDE;
- if( m_pDataContainer->IsModuleInstalled( E_SDATABASE ) == sal_True )
- nFeature |= FEATUREFLAG_INSIGHT;
-
- return nFeature;
-}
-
-/*-****************************************************************************************************//**
- @short return a reference to a static mutex
- @descr These class is threadsafe.
- We create a static mutex only for one time and use it to protect our refcount and container
- member!
-
- @seealso -
-
- @param -
- @return A reference to a static mutex member.
-
- @onerror -
- @threadsafe yes
-*//*-*****************************************************************************************************/
-::osl::Mutex& SvtModuleOptions::impl_GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static ::osl::Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
-
-::rtl::OUString SvtModuleOptions::GetModuleName( EModule eModule ) const
-{
- switch( eModule )
- {
- case SvtModuleOptions::E_SWRITER : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_SWEB : { return ::rtl::OUString::createFromAscii("Web"); }
- case SvtModuleOptions::E_SGLOBAL : { return ::rtl::OUString::createFromAscii("Global"); }
- case SvtModuleOptions::E_SCALC : { return ::rtl::OUString::createFromAscii("Calc"); }
- case SvtModuleOptions::E_SDRAW : { return ::rtl::OUString::createFromAscii("Draw"); }
- case SvtModuleOptions::E_SIMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); }
- case SvtModuleOptions::E_SMATH : { return ::rtl::OUString::createFromAscii("Math"); }
- case SvtModuleOptions::E_SCHART : { return ::rtl::OUString::createFromAscii("Chart"); }
- case SvtModuleOptions::E_SBASIC : { return ::rtl::OUString::createFromAscii("Basic"); }
- case SvtModuleOptions::E_SDATABASE : { return ::rtl::OUString::createFromAscii("Database"); }
- default:
- OSL_ASSERT( "unknown module" );
- break;
- }
-
- return ::rtl::OUString();
-}
-
-::rtl::OUString SvtModuleOptions::GetModuleName( EFactory eFactory ) const
-{
- switch( eFactory )
- {
- case SvtModuleOptions::E_WRITER : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_WRITERWEB : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_WRITERGLOBAL : { return ::rtl::OUString::createFromAscii("Writer"); }
- case SvtModuleOptions::E_CALC : { return ::rtl::OUString::createFromAscii("Calc"); }
- case SvtModuleOptions::E_DRAW : { return ::rtl::OUString::createFromAscii("Draw"); }
- case SvtModuleOptions::E_IMPRESS : { return ::rtl::OUString::createFromAscii("Impress"); }
- case SvtModuleOptions::E_MATH : { return ::rtl::OUString::createFromAscii("Math"); }
- case SvtModuleOptions::E_CHART : { return ::rtl::OUString::createFromAscii("Chart"); }
- case SvtModuleOptions::E_BASIC : { return ::rtl::OUString::createFromAscii("Basic"); }
- case SvtModuleOptions::E_DATABASE : { return ::rtl::OUString::createFromAscii("Database"); }
- default:
- OSL_ASSERT( "unknown factory" );
- break;
- }
-
- return ::rtl::OUString();
-}
-
-/*-----------------------------------------------
- 07.03.2004 15:03
------------------------------------------------*/
-SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByShortName(const ::rtl::OUString& sName)
-{
- if (sName.equalsAscii("swriter"))
- return E_WRITER;
- if (sName.equalsIgnoreAsciiCaseAscii("swriter/Web")) // sometimes they are registerd for swriter/web :-(
- return E_WRITERWEB;
- if (sName.equalsIgnoreAsciiCaseAscii("swriter/GlobalDocument")) // sometimes they are registerd for swriter/globaldocument :-(
- return E_WRITERGLOBAL;
- if (sName.equalsAscii("scalc"))
- return E_CALC;
- if (sName.equalsAscii("sdraw"))
- return E_DRAW;
- if (sName.equalsAscii("simpress"))
- return E_IMPRESS;
- if (sName.equalsAscii("schart"))
- return E_CHART;
- if (sName.equalsAscii("smath"))
- return E_MATH;
- if (sName.equalsAscii("sbasic"))
- return E_BASIC;
- if (sName.equalsAscii("sdatabase"))
- return E_DATABASE;
-
- return E_UNKNOWN_FACTORY;
-}
-
-/*-----------------------------------------------
- 31.07.2003 10:41
------------------------------------------------*/
-SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByServiceName(const ::rtl::OUString& sName)
-{
- if (sName.equals(FACTORYNAME_WRITERGLOBAL))
- return E_WRITERGLOBAL;
- if (sName.equals(FACTORYNAME_WRITERWEB))
- return E_WRITERWEB;
- if (sName.equals(FACTORYNAME_WRITER))
- return E_WRITER;
- if (sName.equals(FACTORYNAME_CALC))
- return E_CALC;
- if (sName.equals(FACTORYNAME_DRAW))
- return E_DRAW;
- if (sName.equals(FACTORYNAME_IMPRESS))
- return E_IMPRESS;
- if (sName.equals(FACTORYNAME_MATH))
- return E_MATH;
- if (sName.equals(FACTORYNAME_CHART))
- return E_CHART;
- if (sName.equals(FACTORYNAME_DATABASE))
- return E_DATABASE;
-
- return E_UNKNOWN_FACTORY;
-}
-
-/*-----------------------------------------------
- 31.07.2003 14:39
------------------------------------------------*/
-SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::OUString& sURL ,
- const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor)
-{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::utl::getProcessServiceFactory();
- if (!xSMGR.is())
- return E_UNKNOWN_FACTORY;
-
- css::uno::Reference< css::container::XNameAccess > xFilterCfg;
- css::uno::Reference< css::container::XNameAccess > xTypeCfg ;
- try
- {
- xFilterCfg = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.FilterFactory")), css::uno::UNO_QUERY);
- xTypeCfg = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.document.TypeDetection")), css::uno::UNO_QUERY);
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- { return E_UNKNOWN_FACTORY; }
-
- ::comphelper::SequenceAsHashMap stlDesc(lMediaDescriptor);
-
- // is there already a filter inside the descriptor?
- ::rtl::OUString sFilterName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("FilterName"), ::rtl::OUString());
- if (sFilterName.getLength())
- {
- try
- {
- ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sFilterName));
- ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString());
- SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService);
-
- if (eApp != E_UNKNOWN_FACTORY)
- return eApp;
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- { /* do nothing here ... may the following code can help!*/ }
- }
-
- // is there already a type inside the descriptor?
- ::rtl::OUString sTypeName = stlDesc.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("TypeName"), ::rtl::OUString());
- if (!sTypeName.getLength())
- {
- // no :-(
- // start flat detection of URL
- css::uno::Reference< css::document::XTypeDetection > xDetect(xTypeCfg, css::uno::UNO_QUERY);
- sTypeName = xDetect->queryTypeByURL(sURL);
- }
-
- if (!sTypeName.getLength())
- return E_UNKNOWN_FACTORY;
-
- // yes - there is a type info
- // Try to find the preferred filter.
- try
- {
- ::comphelper::SequenceAsHashMap stlTypeProps (xTypeCfg->getByName(sTypeName));
- ::rtl::OUString sPreferredFilter = stlTypeProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("PreferredFilter"), ::rtl::OUString());
- ::comphelper::SequenceAsHashMap stlFilterProps (xFilterCfg->getByName(sPreferredFilter));
- ::rtl::OUString sDocumentService = stlFilterProps.getUnpackedValueOrDefault(::rtl::OUString::createFromAscii("DocumentService"), ::rtl::OUString());
- SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(sDocumentService);
-
- if (eApp != E_UNKNOWN_FACTORY)
- return eApp;
- }
- catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception&)
- { /* do nothing here ... may the following code can help!*/ }
-
- // no filter/no type/no detection result => no fun :-)
- return E_UNKNOWN_FACTORY;
-}
-
-/*-----------------------------------------------
- 31.07.2003 10:41
------------------------------------------------*/
-SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByModel(const css::uno::Reference< css::frame::XModel >& xModel)
-{
- css::uno::Reference< css::lang::XServiceInfo > xInfo(xModel, css::uno::UNO_QUERY);
- if (!xInfo.is())
- return E_UNKNOWN_FACTORY;
-
- const css::uno::Sequence< ::rtl::OUString > lServices = xInfo->getSupportedServiceNames();
- const ::rtl::OUString* pServices = lServices.getConstArray();
-
- for (sal_Int32 i=0; i<lServices.getLength() ; ++i)
- {
- SvtModuleOptions::EFactory eApp = SvtModuleOptions::ClassifyFactoryByServiceName(pServices[i]);
- if (eApp != E_UNKNOWN_FACTORY)
- return eApp;
- }
-
- return E_UNKNOWN_FACTORY;
-}
-
-::com::sun::star::uno::Sequence < ::rtl::OUString > SvtModuleOptions::GetAllServiceNames()
-{
- ::osl::MutexGuard aGuard( impl_GetOwnStaticMutex() );
- return m_pDataContainer->GetAllServiceNames();
-}
-
-::rtl::OUString SvtModuleOptions::GetDefaultModuleName()
-{
- ::rtl::OUString aModule;
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWRITER))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITER);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SCALC))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_CALC);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SIMPRESS))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_IMPRESS);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDATABASE))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_DATABASE);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SDRAW))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_DRAW);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SWEB))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITERWEB);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SGLOBAL))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_WRITERGLOBAL);
- else
- if (m_pDataContainer->IsModuleInstalled(SvtModuleOptions::E_SMATH))
- aModule = m_pDataContainer->GetFactoryShortName(SvtModuleOptions::E_MATH);
- return aModule;
-}
-
diff --git a/svtools/source/config/optionsdlg.cxx b/svtools/source/config/optionsdlg.cxx
deleted file mode 100644
index 87878b0302bc..000000000000
--- a/svtools/source/config/optionsdlg.cxx
+++ /dev/null
@@ -1,293 +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: optionsdlg.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/optionsdlg.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-#include <comphelper/stl_types.hxx>
-
-#include <hash_map>
-#include "itemholder1.hxx"
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::beans ;
-using namespace com::sun::star::uno;
-
-#define CFG_FILENAME OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.OptionsDialog" ) )
-#define ROOT_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsDialogGroups" ) )
-#define PAGES_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) )
-#define OPTIONS_NODE OUString( RTL_CONSTASCII_USTRINGPARAM( "Options" ) )
-#define PROPERTY_HIDE OUString( RTL_CONSTASCII_USTRINGPARAM( "Hide" ) )
-
-static SvtOptionsDlgOptions_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-class SvtOptionsDlgOptions_Impl : public utl::ConfigItem
-{
-private:
- struct OUStringHashCode
- {
- size_t operator()( const ::rtl::OUString& sString ) const
- {
- return sString.hashCode();
- }
- };
-
- typedef std::hash_map< OUString, sal_Bool, OUStringHashCode, ::std::equal_to< OUString > > OptionNodeList;
-
- OUString m_sPathDelimiter;
- OptionNodeList m_aOptionNodeList;
-
- enum NodeType{ NT_Group, NT_Page, NT_Option };
- void ReadNode( const OUString& _rNode, NodeType _eType );
- sal_Bool IsHidden( const OUString& _rPath ) const;
-
-public:
- SvtOptionsDlgOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
- static ::osl::Mutex & getInitMutex();
-
- sal_Bool IsGroupHidden ( const OUString& _rGroup ) const;
- sal_Bool IsPageHidden ( const OUString& _rPage,
- const OUString& _rGroup ) const;
- sal_Bool IsOptionHidden ( const OUString& _rOption,
- const OUString& _rPage,
- const OUString& _rGroup ) const;
-};
-
-::osl::Mutex & SvtOptionsDlgOptions_Impl::getInitMutex()
-{
- static ::osl::Mutex *pMutex = 0;
-
- if( ! pMutex )
- {
- ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() );
- if( ! pMutex )
- {
- static ::osl::Mutex mutex;
- pMutex = &mutex;
- }
- }
- return *pMutex;
-}
-
-// -----------------------------------------------------------------------
-
-SvtOptionsDlgOptions_Impl::SvtOptionsDlgOptions_Impl()
- : ConfigItem( OUString( CFG_FILENAME ) ),
-
- m_sPathDelimiter( RTL_CONSTASCII_USTRINGPARAM( "/" ) ),
- m_aOptionNodeList( OptionNodeList() )
-
-{
- OUString sRootNode( ROOT_NODE );
- Sequence< OUString > aNodeSeq = GetNodeNames( sRootNode );
- OUString sNode( sRootNode + m_sPathDelimiter );
- sal_uInt32 nCount = aNodeSeq.getLength();
- for ( sal_uInt32 n = 0; n < nCount; n++ )
- {
- OUString sSubNode( sNode + aNodeSeq[n] );
- ReadNode( sSubNode, NT_Group );
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SvtOptionsDlgOptions_Impl::Commit()
-{
- // nothing to commit
-}
-
-// -----------------------------------------------------------------------
-
-void SvtOptionsDlgOptions_Impl::Notify( const Sequence< rtl::OUString >& )
-{
- // nothing to notify
-}
-
-void SvtOptionsDlgOptions_Impl::ReadNode( const OUString& _rNode, NodeType _eType )
-{
- OUString sNode( _rNode + m_sPathDelimiter );
- OUString sSet;
- sal_Int32 nLen = 0;
- switch ( _eType )
- {
- case NT_Group :
- {
- sSet = PAGES_NODE;
- nLen = 2;
- break;
- }
-
- case NT_Page :
- {
- sSet = OPTIONS_NODE;
- nLen = 2;
- break;
- }
-
- case NT_Option :
- {
- nLen = 1;
- break;
- }
- }
-
- Sequence< OUString > lResult( nLen );
- lResult[0] = OUString( sNode + PROPERTY_HIDE );
- if ( _eType != NT_Option )
- lResult[1] = OUString( sNode + sSet );
-
- Sequence< Any > aValues;
- aValues = GetProperties( lResult );
- sal_Bool bHide = sal_False;
- if ( aValues[0] >>= bHide )
- m_aOptionNodeList.insert( OptionNodeList::value_type( sNode, bHide ) );
-
- if ( _eType != NT_Option )
- {
- OUString sNodes( sNode + sSet );
- Sequence< OUString > aNodes = GetNodeNames( sNodes );
- if ( aNodes.getLength() > 0 )
- {
- for ( sal_uInt32 n = 0; n < (sal_uInt32)aNodes.getLength(); ++n )
- {
- OUString sSubNodeName( sNodes + m_sPathDelimiter + aNodes[n] );
- ReadNode( sSubNodeName, _eType == NT_Group ? NT_Page : NT_Option );
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-OUString getGroupPath( const OUString& _rGroup )
-{
- return OUString( ROOT_NODE + OUString('/') + _rGroup + OUString('/') );
-}
-OUString getPagePath( const OUString& _rPage )
-{
- return OUString( PAGES_NODE + OUString('/') + _rPage + OUString('/') );
-}
-OUString getOptionPath( const OUString& _rOption )
-{
- return OUString( OPTIONS_NODE + OUString('/') + _rOption + OUString('/') );
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvtOptionsDlgOptions_Impl::IsHidden( const OUString& _rPath ) const
-{
- sal_Bool bRet = sal_False;
- OptionNodeList::const_iterator pIter = m_aOptionNodeList.find( _rPath );
- if ( pIter != m_aOptionNodeList.end() )
- bRet = pIter->second;
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvtOptionsDlgOptions_Impl::IsGroupHidden( const OUString& _rGroup ) const
-{
- return IsHidden( getGroupPath( _rGroup ) );
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvtOptionsDlgOptions_Impl::IsPageHidden( const OUString& _rPage, const OUString& _rGroup ) const
-{
- return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) );
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvtOptionsDlgOptions_Impl::IsOptionHidden(
- const OUString& _rOption, const OUString& _rPage, const OUString& _rGroup ) const
-{
- return IsHidden( getGroupPath( _rGroup ) + getPagePath( _rPage ) + getOptionPath( _rOption ) );
-}
-
-// -----------------------------------------------------------------------
-
-SvtOptionsDialogOptions::SvtOptionsDialogOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( SvtOptionsDlgOptions_Impl::getInitMutex() );
- ++nRefCount;
- if ( !pOptions )
- {
- pOptions = new SvtOptionsDlgOptions_Impl;
-
- ItemHolder1::holdConfigItem( E_OPTIONSDLGOPTIONS );
- }
- m_pImp = pOptions;
-}
-
-// -----------------------------------------------------------------------
-
-SvtOptionsDialogOptions::~SvtOptionsDialogOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( SvtOptionsDlgOptions_Impl::getInitMutex() );
- if ( !--nRefCount )
- {
- if ( pOptions->IsModified() )
- pOptions->Commit();
- DELETEZ( pOptions );
- }
-}
-
-sal_Bool SvtOptionsDialogOptions::IsGroupHidden( const String& _rGroup ) const
-{
- return m_pImp->IsGroupHidden( _rGroup );
-}
-
-sal_Bool SvtOptionsDialogOptions::IsPageHidden( const String& _rPage, const String& _rGroup ) const
-{
- return m_pImp->IsPageHidden( _rPage, _rGroup );
-}
-
-sal_Bool SvtOptionsDialogOptions::IsOptionHidden(
- const String& _rOption, const String& _rPage, const String& _rGroup ) const
-{
- return m_pImp->IsOptionHidden( _rOption, _rPage, _rGroup );
-}
-
diff --git a/svtools/source/config/optionsdrawinglayer.cxx b/svtools/source/config/optionsdrawinglayer.cxx
index abb044c7863e..43490c5ea79e 100644
--- a/svtools/source/config/optionsdrawinglayer.cxx
+++ b/svtools/source/config/optionsdrawinglayer.cxx
@@ -27,6 +27,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
#ifdef _MSC_VER
#pragma hdrstop
#endif
@@ -191,6 +194,7 @@ public:
//---------------------------------------------------------------------------------------------------------
virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
//---------------------------------------------------------------------------------------------------------
// public interface
@@ -735,6 +739,10 @@ void SvtOptionsDrawinglayer_Impl::Commit()
PutProperties( aSeqNames, aSeqValues );
}
+void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
+{
+}
+
//*****************************************************************************************************************
// public method
//*****************************************************************************************************************
diff --git a/svtools/source/config/pathoptions.cxx b/svtools/source/config/pathoptions.cxx
deleted file mode 100644
index 8c561b299d46..000000000000
--- a/svtools/source/config/pathoptions.cxx
+++ /dev/null
@@ -1,1094 +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: pathoptions.cxx,v $
- * $Revision: 1.81 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <svtools/pathoptions.hxx>
-#include <unotools/configitem.hxx>
-#include <unotools/configmgr.hxx>
-#include <tools/debug.hxx>
-#include <tools/resmgr.hxx>
-#include <tools/urlobj.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <osl/mutex.hxx>
-#include <osl/file.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <unotools/bootstrap.hxx>
-
-#include <unotools/ucbhelper.hxx>
-#include <vos/process.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/beans/XFastPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-#include <com/sun/star/util/XStringSubstitution.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <rtl/instance.hxx>
-
-#include <itemholder1.hxx>
-
-#include <vector>
-#include <hash_map>
-
-using namespace osl;
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::util;
-using namespace com::sun::star::lang;
-
-// define ----------------------------------------------------------------
-
-#define SEARCHPATH_DELIMITER ';'
-
-#define ASCII_STR(s) OUString( RTL_CONSTASCII_USTRINGPARAM(s) )
-
-#define SIGN_STARTVARIABLE ASCII_STR("$(")
-#define SIGN_ENDVARIABLE ASCII_STR(")")
-
-// Supported variables by the old SvtPathOptions implementation
-#define SUBSTITUTE_INST "$(inst)"
-#define SUBSTITUTE_PROG "$(prog)"
-#define SUBSTITUTE_USER "$(user)"
-#define SUBSTITUTE_INSTPATH "$(instpath)"
-#define SUBSTITUTE_PROGPATH "$(progpath)"
-#define SUBSTITUTE_USERPATH "$(userpath)"
-#define SUBSTITUTE_INSTURL "$(insturl)"
-#define SUBSTITUTE_PROGURL "$(progurl)"
-#define SUBSTITUTE_USERURL "$(userurl)"
-#define SUBSTITUTE_PATH "$(path)"
-//#define SUBSTITUTE_LANG "$(lang)"
-#define SUBSTITUTE_LANGID "$(langid)"
-#define SUBSTITUTE_VLANG "$(vlang)"
-#define SUBSTITUTE_WORKDIRURL "$(workdirurl)"
-
-#define STRPOS_NOTFOUND -1
-
-struct OUStringHashCode
-{
- size_t operator()( const ::rtl::OUString& sString ) const
- {
- return sString.hashCode();
- }
-};
-
-enum VarNameProperty
-{
- VAR_NEEDS_SYSTEM_PATH,
- VAR_NEEDS_FILEURL
-};
-
-class NameToHandleMap : public ::std::hash_map< ::rtl::OUString, sal_Int32, OUStringHashCode, ::std::equal_to< ::rtl::OUString > >
-{
- public:
- inline void free() { NameToHandleMap().swap( *this ); }
-};
-
-class EnumToHandleMap : public ::std::hash_map< sal_Int32, sal_Int32, std::hash< sal_Int32 >, std::equal_to< sal_Int32 > >
-{
- public:
- inline void free() { EnumToHandleMap().swap( *this ); }
-};
-
-class VarNameToEnumMap : public ::std::hash_map< OUString, VarNameProperty, OUStringHashCode, ::std::equal_to< OUString > >
-{
- public:
- inline void free() { VarNameToEnumMap().swap( *this ); }
-};
-
-
-// class SvtPathOptions_Impl ---------------------------------------------
-class SvtPathOptions_Impl
-{
- private:
- // Local variables to return const references
- std::vector< String > m_aPathArray;
- Reference< XFastPropertySet > m_xPathSettings;
- Reference< XStringSubstitution > m_xSubstVariables;
- mutable EnumToHandleMap m_aMapEnumToPropHandle;
- VarNameToEnumMap m_aMapVarNamesToEnum;
-
- ::com::sun::star::lang::Locale m_aLocale;
- String m_aEmptyString;
- mutable ::osl::Mutex m_aMutex;
-
- public:
- SvtPathOptions_Impl();
-
- // get the pathes, not const because of using a mutex
- const String& GetPath( SvtPathOptions::Pathes );
- const String& GetAddinPath() { return GetPath( SvtPathOptions::PATH_ADDIN ); }
- const String& GetAutoCorrectPath() { return GetPath( SvtPathOptions::PATH_AUTOCORRECT ); }
- const String& GetAutoTextPath() { return GetPath( SvtPathOptions::PATH_AUTOTEXT ); }
- const String& GetBackupPath() { return GetPath( SvtPathOptions::PATH_BACKUP ); }
- const String& GetBasicPath() { return GetPath( SvtPathOptions::PATH_BASIC ); }
- const String& GetBitmapPath() { return GetPath( SvtPathOptions::PATH_BITMAP ); }
- const String& GetConfigPath() { return GetPath( SvtPathOptions::PATH_CONFIG ); }
- const String& GetDictionaryPath() { return GetPath( SvtPathOptions::PATH_DICTIONARY ); }
- const String& GetFavoritesPath() { return GetPath( SvtPathOptions::PATH_FAVORITES ); }
- const String& GetFilterPath() { return GetPath( SvtPathOptions::PATH_FILTER ); }
- const String& GetGalleryPath() { return GetPath( SvtPathOptions::PATH_GALLERY ); }
- const String& GetGraphicPath() { return GetPath( SvtPathOptions::PATH_GRAPHIC ); }
- const String& GetHelpPath() { return GetPath( SvtPathOptions::PATH_HELP ); }
- const String& GetLinguisticPath() { return GetPath( SvtPathOptions::PATH_LINGUISTIC ); }
- const String& GetModulePath() { return GetPath( SvtPathOptions::PATH_MODULE ); }
- const String& GetPalettePath() { return GetPath( SvtPathOptions::PATH_PALETTE ); }
- const String& GetPluginPath() { return GetPath( SvtPathOptions::PATH_PLUGIN ); }
- const String& GetStoragePath() { return GetPath( SvtPathOptions::PATH_STORAGE ); }
- const String& GetTempPath() { return GetPath( SvtPathOptions::PATH_TEMP ); }
- const String& GetTemplatePath() { return GetPath( SvtPathOptions::PATH_TEMPLATE ); }
- const String& GetUserConfigPath() { return GetPath( SvtPathOptions::PATH_USERCONFIG ); }
- const String& GetWorkPath() { return GetPath( SvtPathOptions::PATH_WORK ); }
- const String& GetUIConfigPath() { return GetPath( SvtPathOptions::PATH_UICONFIG ); }
- const String& GetFingerprintPath() { return GetPath( SvtPathOptions::PATH_FINGERPRINT ); }
-
- // set the pathes
- void SetPath( SvtPathOptions::Pathes, const String& rNewPath );
- void SetAddinPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_ADDIN, rPath ); }
- void SetAutoCorrectPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOCORRECT, rPath ); }
- void SetAutoTextPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_AUTOTEXT, rPath ); }
- void SetBackupPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BACKUP, rPath ); }
- void SetBasicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BASIC, rPath ); }
- void SetBitmapPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_BITMAP, rPath ); }
- void SetConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_CONFIG, rPath ); }
- void SetDictionaryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_DICTIONARY, rPath ); }
- void SetFavoritesPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FAVORITES, rPath ); }
- void SetFilterPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_FILTER, rPath ); }
- void SetGalleryPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GALLERY, rPath ); }
- void SetGraphicPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_GRAPHIC, rPath ); }
- void SetHelpPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_HELP, rPath ); }
- void SetLinguisticPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_LINGUISTIC, rPath ); }
- void SetModulePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_MODULE, rPath ); }
- void SetPalettePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PALETTE, rPath ); }
- void SetPluginPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_PLUGIN, rPath ); }
- void SetStoragePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_STORAGE, rPath ); }
- void SetTempPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMP, rPath ); }
- void SetTemplatePath( const String& rPath ) { SetPath( SvtPathOptions::PATH_TEMPLATE, rPath ); }
- void SetUserConfigPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_USERCONFIG, rPath ); }
- void SetWorkPath( const String& rPath ) { SetPath( SvtPathOptions::PATH_WORK, rPath ); }
-
- rtl::OUString SubstVar( const rtl::OUString& rVar );
- rtl::OUString SubstituteAndConvert( const rtl::OUString& rPath );
- rtl::OUString UsePathVariables( const rtl::OUString& rPath );
-
- ::com::sun::star::lang::Locale GetLocale() const { return m_aLocale; }
-
- BOOL IsPathReadonly(SvtPathOptions::Pathes ePath)const;
-};
-
-// global ----------------------------------------------------------------
-
-static SvtPathOptions_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-// functions -------------------------------------------------------------
-struct PropertyStruct
-{
- const char* pPropName; // The ascii name of the Office path
- SvtPathOptions::Pathes ePath; // The enum value used by SvtPathOptions
-};
-
-struct VarNameAttribute
-{
- const char* pVarName; // The name of the path variable
- VarNameProperty eVarProperty; // Which return value is needed by this path variable
-};
-
-static PropertyStruct aPropNames[] =
-{
- { "Addin", SvtPathOptions::PATH_ADDIN },
- { "AutoCorrect", SvtPathOptions::PATH_AUTOCORRECT },
- { "AutoText", SvtPathOptions::PATH_AUTOTEXT },
- { "Backup", SvtPathOptions::PATH_BACKUP },
- { "Basic", SvtPathOptions::PATH_BASIC },
- { "Bitmap", SvtPathOptions::PATH_BITMAP },
- { "Config", SvtPathOptions::PATH_CONFIG },
- { "Dictionary", SvtPathOptions::PATH_DICTIONARY },
- { "Favorite", SvtPathOptions::PATH_FAVORITES },
- { "Filter", SvtPathOptions::PATH_FILTER },
- { "Gallery", SvtPathOptions::PATH_GALLERY },
- { "Graphic", SvtPathOptions::PATH_GRAPHIC },
- { "Help", SvtPathOptions::PATH_HELP },
- { "Linguistic", SvtPathOptions::PATH_LINGUISTIC },
- { "Module", SvtPathOptions::PATH_MODULE },
- { "Palette", SvtPathOptions::PATH_PALETTE },
- { "Plugin", SvtPathOptions::PATH_PLUGIN },
- { "Storage", SvtPathOptions::PATH_STORAGE },
- { "Temp", SvtPathOptions::PATH_TEMP },
- { "Template", SvtPathOptions::PATH_TEMPLATE },
- { "UserConfig", SvtPathOptions::PATH_USERCONFIG },
- { "Work", SvtPathOptions::PATH_WORK },
- { "UIConfig", SvtPathOptions::PATH_UICONFIG },
- { "Fingerprint", SvtPathOptions::PATH_FINGERPRINT }
-};
-
-static VarNameAttribute aVarNameAttribute[] =
-{
- { SUBSTITUTE_INSTPATH, VAR_NEEDS_SYSTEM_PATH }, // $(instpath)
- { SUBSTITUTE_PROGPATH, VAR_NEEDS_SYSTEM_PATH }, // $(progpath)
- { SUBSTITUTE_USERPATH, VAR_NEEDS_SYSTEM_PATH }, // $(userpath)
- { SUBSTITUTE_PATH, VAR_NEEDS_SYSTEM_PATH }, // $(path)
-};
-
-#if 0
-// currently unused
-static Sequence< OUString > GetPathPropertyNames()
-{
- const int nCount = sizeof( aPropNames ) / sizeof( PropertyStruct );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i].pPropName );
-
- return aNames;
-}
-#endif
-
-// class SvtPathOptions_Impl ---------------------------------------------
-
-const String& SvtPathOptions_Impl::GetPath( SvtPathOptions::Pathes ePath )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( ePath < SvtPathOptions::PATH_COUNT )
- {
- OUString aPathValue;
- String aResult;
- sal_Int32 nHandle = m_aMapEnumToPropHandle[ (sal_Int32)ePath ];
-
- // Substitution is done by the service itself using the substition service
- Any a = m_xPathSettings->getFastPropertyValue( nHandle );
- a >>= aPathValue;
- if( ePath == SvtPathOptions::PATH_ADDIN ||
- ePath == SvtPathOptions::PATH_FILTER ||
- ePath == SvtPathOptions::PATH_HELP ||
- ePath == SvtPathOptions::PATH_MODULE ||
- ePath == SvtPathOptions::PATH_PLUGIN ||
- ePath == SvtPathOptions::PATH_STORAGE
- )
- {
- // These office paths have to be converted to system pathes
- utl::LocalFileHelper::ConvertURLToPhysicalName( aPathValue, aResult );
- aPathValue = aResult;
- }
-
- m_aPathArray[ ePath ] = aPathValue;
- return m_aPathArray[ ePath ];
- }
-
- return m_aEmptyString;
-}
-// -----------------------------------------------------------------------
-BOOL SvtPathOptions_Impl::IsPathReadonly(SvtPathOptions::Pathes ePath)const
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- BOOL bReadonly = FALSE;
- if ( ePath < SvtPathOptions::PATH_COUNT )
- {
- Reference<XPropertySet> xPrSet(m_xPathSettings, UNO_QUERY);
- if(xPrSet.is())
- {
- Reference<XPropertySetInfo> xInfo = xPrSet->getPropertySetInfo();
- const char* pA = aPropNames[ePath].pPropName;
- ::rtl::OUString sU = OUString::createFromAscii(pA);
- Property aProperty = xInfo->getPropertyByName(sU);
- bReadonly = 0 != (aProperty.Attributes & PropertyAttribute::READONLY);
- }
- }
- return bReadonly;
-}
-// -----------------------------------------------------------------------
-
-void SvtPathOptions_Impl::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( ePath < SvtPathOptions::PATH_COUNT )
- {
- String aResult;
- OUString aNewValue;
- Any a;
-
- switch ( ePath )
- {
- case SvtPathOptions::PATH_ADDIN:
- case SvtPathOptions::PATH_FILTER:
- case SvtPathOptions::PATH_HELP:
- case SvtPathOptions::PATH_MODULE:
- case SvtPathOptions::PATH_PLUGIN:
- case SvtPathOptions::PATH_STORAGE:
- {
- // These office paths have to be convert back to UCB-URL's
- utl::LocalFileHelper::ConvertPhysicalNameToURL( rNewPath, aResult );
- aNewValue = aResult;
- }
- break;
-
- default:
- aNewValue = rNewPath;
- }
-
- // Resubstitution is done by the service itself using the substition service
- a <<= aNewValue;
- try
- {
- m_xPathSettings->setFastPropertyValue( m_aMapEnumToPropHandle[ (sal_Int32)ePath], a );
- }
- catch (const Exception&)
- {
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-OUString SvtPathOptions_Impl::SubstituteAndConvert( const rtl::OUString& rPath )
-{
- return SubstVar( rPath );
-}
-
-//-------------------------------------------------------------------------
-
-OUString SvtPathOptions_Impl::UsePathVariables( const OUString& rPath )
-{
- return m_xSubstVariables->reSubstituteVariables( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar )
-{
- // Don't work at parameter-string directly. Copy it.
- OUString aWorkText = rVar;
-
- // Convert the returned path to system path!
- BOOL bConvertLocal = FALSE;
-
- // Search for first occure of "$(...".
- sal_Int32 nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE ); // = first position of "$(" in string
- sal_Int32 nLength = 0; // = count of letters from "$(" to ")" in string
-
- // Have we found any variable like "$(...)"?
- if ( nPosition != STRPOS_NOTFOUND )
- {
- // Yes; Get length of found variable.
- // If no ")" was found - nLength is set to 0 by default! see before.
- sal_Int32 nEndPosition = aWorkText.indexOf( SIGN_ENDVARIABLE, nPosition );
- if ( nEndPosition != STRPOS_NOTFOUND )
- nLength = nEndPosition - nPosition + 1;
- }
-
- // Is there another path variable?
- while ( ( nPosition != STRPOS_NOTFOUND ) && ( nLength > 0 ) )
- {
- // YES; Get the next variable for replace.
- OUString aReplacement;
- OUString aSubString = aWorkText.copy( nPosition, nLength );
- aSubString = aSubString.toAsciiLowerCase();
-
- // Look for special variable that needs a system path.
- VarNameToEnumMap::const_iterator pIter = m_aMapVarNamesToEnum.find( aSubString );
- if ( pIter != m_aMapVarNamesToEnum.end() )
- bConvertLocal = TRUE;
-
- nPosition += nLength;
-
- // We must control index in string before call something at OUString!
- // The OUString-implementation don't do it for us :-( but the result is not defined otherwise.
- if ( nPosition + 1 > aWorkText.getLength() )
- {
- // Position is out of range. Break loop!
- nPosition = STRPOS_NOTFOUND;
- nLength = 0;
- }
- else
- {
- // Else; Position is valid. Search for next variable.
- nPosition = aWorkText.indexOf( SIGN_STARTVARIABLE, nPosition );
- // Have we found any variable like "$(...)"?
- if ( nPosition != STRPOS_NOTFOUND )
- {
- // Yes; Get length of found variable. If no ")" was found - nLength must set to 0!
- nLength = 0;
- sal_Int32 nEndPosition = aWorkText.indexOf( SIGN_ENDVARIABLE, nPosition );
- if ( nEndPosition != STRPOS_NOTFOUND )
- nLength = nEndPosition - nPosition + 1;
- }
- }
- }
-
- aWorkText = m_xSubstVariables->substituteVariables( rVar, sal_False );
-
- if ( bConvertLocal )
- {
- // Convert the URL to a system path for special path variables
- String aReturn;
- utl::LocalFileHelper::ConvertURLToPhysicalName( aWorkText, aReturn );
- return aReturn;
- }
-
- return aWorkText;
-}
-
-// -----------------------------------------------------------------------
-
-SvtPathOptions_Impl::SvtPathOptions_Impl() :
- m_aPathArray( (sal_Int32)SvtPathOptions::PATH_COUNT )
-{
- Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
-
- // Create necessary services
- m_xPathSettings = Reference< XFastPropertySet >( xSMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.PathSettings" ))),
- UNO_QUERY );
- if ( !m_xPathSettings.is() )
- {
- // #112719#: check for existance
- DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" );
- throw RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSettings cannot be created" )),
- Reference< XInterface >() );
- }
-
- m_xSubstVariables = Reference< XStringSubstitution >( xSMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.util.PathSubstitution" ))),
- UNO_QUERY );
- if ( !m_xSubstVariables.is() )
- {
- // #112719#: check for existance
- DBG_ERROR( "SvtPathOptions_Impl::SvtPathOptions_Impl(): #112719# happened again!" );
- throw RuntimeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Service com.sun.star.util.PathSubstitution cannot be created" )),
- Reference< XInterface >() );
- }
-
- // Create temporary hash map to have a mapping between property names and property handles
- Reference< XPropertySet > xPropertySet = Reference< XPropertySet >( m_xPathSettings, UNO_QUERY );
- Reference< XPropertySetInfo > xPropSetInfo = xPropertySet->getPropertySetInfo();
- Sequence< Property > aPathPropSeq = xPropSetInfo->getProperties();
-
- NameToHandleMap aTempHashMap;
- for ( sal_Int32 n = 0; n < aPathPropSeq.getLength(); n++ )
- {
- const com::sun::star::beans::Property& aProperty = aPathPropSeq[n];
- aTempHashMap.insert( NameToHandleMap::value_type( aProperty.Name, aProperty.Handle ));
- }
-
- // Create mapping between internal enum (SvtPathOptions::Pathes) and property handle
- sal_Int32 nCount = sizeof( aPropNames ) / sizeof( PropertyStruct );
- sal_Int32 i;
- for ( i = 0; i < nCount; i++ )
- {
- NameToHandleMap::const_iterator pIter =
- aTempHashMap.find( rtl::OUString::createFromAscii( aPropNames[i].pPropName ));
-
- if ( pIter != aTempHashMap.end() )
- {
- sal_Int32 nHandle = pIter->second;
- sal_Int32 nEnum = aPropNames[i].ePath;
- m_aMapEnumToPropHandle.insert( EnumToHandleMap::value_type( nEnum, nHandle ));
- }
- }
-
- // Create hash map for path variables that need a system path as a return value!
- nCount = sizeof( aVarNameAttribute ) / sizeof( VarNameAttribute );
- for ( i = 0; i < nCount; i++ )
- {
- m_aMapVarNamesToEnum.insert( VarNameToEnumMap::value_type(
- OUString::createFromAscii( aVarNameAttribute[i].pVarName ),
- aVarNameAttribute[i].eVarProperty ));
- }
-
- // Set language type!
- Any aLocale = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE );
- OUString aLocaleStr;
- if ( aLocale >>= aLocaleStr )
- {
- sal_Int32 nIndex = 0;
- m_aLocale.Language = aLocaleStr.getToken(0, '-', nIndex );
- m_aLocale.Country = aLocaleStr.getToken(0, '-', nIndex );
- m_aLocale.Variant = aLocaleStr.getToken(0, '-', nIndex );
- }
- else
- {
- DBG_ERRORFILE( "wrong any type" );
- m_aLocale.Language = OStringToOUString(OString("en"), RTL_TEXTENCODING_UTF8);
- m_aLocale.Country = OStringToOUString(OString("US"), RTL_TEXTENCODING_UTF8);
- m_aLocale.Variant = OStringToOUString(OString(""), RTL_TEXTENCODING_UTF8);
- }
-}
-
-// -----------------------------------------------------------------------
-
-// class SvtPathOptions --------------------------------------------------
-
-namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; }
-
-SvtPathOptions::SvtPathOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( lclMutex::get() );
- if ( !pOptions )
- {
- pOptions = new SvtPathOptions_Impl;
- ItemHolder1::holdConfigItem(E_PATHOPTIONS);
- }
- ++nRefCount;
- pImp = pOptions;
-}
-
-// -----------------------------------------------------------------------
-
-SvtPathOptions::~SvtPathOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( lclMutex::get() );
- if ( !--nRefCount )
- {
- DELETEZ( pOptions );
- }
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetAddinPath() const
-{
- return pImp->GetAddinPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetAutoCorrectPath() const
-{
- return pImp->GetAutoCorrectPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetAutoTextPath() const
-{
- return pImp->GetAutoTextPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetBackupPath() const
-{
- return pImp->GetBackupPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetBasicPath() const
-{
- return pImp->GetBasicPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetBitmapPath() const
-{
- return pImp->GetBitmapPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetConfigPath() const
-{
- return pImp->GetConfigPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetDictionaryPath() const
-{
- return pImp->GetDictionaryPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetFavoritesPath() const
-{
- return pImp->GetFavoritesPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetFilterPath() const
-{
- return pImp->GetFilterPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetGalleryPath() const
-{
- return pImp->GetGalleryPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetGraphicPath() const
-{
- return pImp->GetGraphicPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetHelpPath() const
-{
- return pImp->GetHelpPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetLinguisticPath() const
-{
- return pImp->GetLinguisticPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetFingerprintPath() const
-{
- return pImp->GetFingerprintPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetModulePath() const
-{
- return pImp->GetModulePath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetPalettePath() const
-{
- return pImp->GetPalettePath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetPluginPath() const
-{
- return pImp->GetPluginPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetStoragePath() const
-{
- return pImp->GetStoragePath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetTempPath() const
-{
- return pImp->GetTempPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetTemplatePath() const
-{
- return pImp->GetTemplatePath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetUserConfigPath() const
-{
- return pImp->GetUserConfigPath();
-}
-
-const String& SvtPathOptions::GetUIConfigPath() const
-{
- return pImp->GetUIConfigPath();
-}
-
-// -----------------------------------------------------------------------
-
-const String& SvtPathOptions::GetWorkPath() const
-{
- return pImp->GetWorkPath();
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetAddinPath( const String& rPath )
-{
- pImp->SetAddinPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetAutoCorrectPath( const String& rPath )
-{
- pImp->SetAutoCorrectPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetAutoTextPath( const String& rPath )
-{
- pImp->SetAutoTextPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetBackupPath( const String& rPath )
-{
- pImp->SetBackupPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetBasicPath( const String& rPath )
-{
- pImp->SetBasicPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetBitmapPath( const String& rPath )
-{
- pImp->SetBitmapPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetConfigPath( const String& rPath )
-{
- pImp->SetConfigPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetDictionaryPath( const String& rPath )
-{
- pImp->SetDictionaryPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetFavoritesPath( const String& rPath )
-{
- pImp->SetFavoritesPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetFilterPath( const String& rPath )
-{
- pImp->SetFilterPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetGalleryPath( const String& rPath )
-{
- pImp->SetGalleryPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetGraphicPath( const String& rPath )
-{
- pImp->SetGraphicPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetHelpPath( const String& rPath )
-{
- pImp->SetHelpPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetLinguisticPath( const String& rPath )
-{
- pImp->SetLinguisticPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetModulePath( const String& rPath )
-{
- pImp->SetModulePath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetPalettePath( const String& rPath )
-{
- pImp->SetPalettePath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetPluginPath( const String& rPath )
-{
- pImp->SetPluginPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetStoragePath( const String& rPath )
-{
- pImp->SetStoragePath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetTempPath( const String& rPath )
-{
- pImp->SetTempPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetTemplatePath( const String& rPath )
-{
- pImp->SetTemplatePath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetUserConfigPath( const String& rPath )
-{
- pImp->SetUserConfigPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtPathOptions::SetWorkPath( const String& rPath )
-{
- pImp->SetWorkPath( rPath );
-}
-
-// -----------------------------------------------------------------------
-
-String SvtPathOptions::SubstituteVariable( const String& rVar )
-{
- String aRet = pImp->SubstituteAndConvert( rVar );
- return aRet;
-}
-
-String SvtPathOptions::UseVariable( const String& rPath )
-{
- String aRet = pImp->UsePathVariables( rPath );
- return aRet;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Pathes ePath )
-{
- // check parameter: empty inifile name?
- if ( !rIniFile.Len() )
- {
- DBG_ERRORFILE( "SvtPathOptions::SearchFile(): invalid parameter" );
- return sal_False;
- }
-
- String aIniFile = pImp->SubstVar( rIniFile );
- sal_Bool bRet = sal_False;
-
- switch ( ePath )
- {
- case PATH_USERCONFIG:
- {
- // path is a URL
- bRet = sal_True;
- INetURLObject aObj( GetUserConfigPath() );
- xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' );
- for ( i = 0; i < nCount; ++i )
- aObj.insertName( aIniFile.GetToken( i, '/' ) );
-
- if ( !::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- aObj.SetSmartURL( GetConfigPath() );
- aObj.insertName( aIniFile );
- bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
- }
-
- if ( bRet )
- rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE );
-
- break;
- }
-
- default:
- {
- String aPath;
- switch ( ePath )
- {
- case PATH_ADDIN: aPath = GetAddinPath(); break;
- case PATH_AUTOCORRECT: aPath = GetAutoCorrectPath(); break;
- case PATH_AUTOTEXT: aPath = GetAutoTextPath(); break;
- case PATH_BACKUP: aPath = GetBackupPath(); break;
- case PATH_BASIC: aPath = GetBasicPath(); break;
- case PATH_BITMAP: aPath = GetBitmapPath(); break;
- case PATH_CONFIG: aPath = GetConfigPath(); break;
- case PATH_DICTIONARY: aPath = GetDictionaryPath(); break;
- case PATH_FAVORITES: aPath = GetFavoritesPath(); break;
- case PATH_FILTER: aPath = GetFilterPath(); break;
- case PATH_GALLERY: aPath = GetGalleryPath(); break;
- case PATH_GRAPHIC: aPath = GetGraphicPath(); break;
- case PATH_HELP: aPath = GetHelpPath(); break;
- case PATH_LINGUISTIC: aPath = GetLinguisticPath(); break;
- case PATH_MODULE: aPath = GetModulePath(); break;
- case PATH_PALETTE: aPath = GetPalettePath(); break;
- case PATH_PLUGIN: aPath = GetPluginPath(); break;
- case PATH_STORAGE: aPath = GetStoragePath(); break;
- case PATH_TEMP: aPath = GetTempPath(); break;
- case PATH_TEMPLATE: aPath = GetTemplatePath(); break;
- case PATH_WORK: aPath = GetWorkPath(); break;
- case PATH_UICONFIG: aPath = GetUIConfigPath(); break;
- case PATH_FINGERPRINT: aPath = GetFingerprintPath(); break;
- case PATH_USERCONFIG:/*-Wall???*/ break;
- case PATH_COUNT: /*-Wall???*/ break;
- }
-
- sal_uInt16 j, nIdx = 0, nTokenCount = aPath.GetTokenCount( SEARCHPATH_DELIMITER );
- for ( j = 0; j < nTokenCount; ++j )
- {
- BOOL bIsURL = TRUE;
- String aPathToken = aPath.GetToken( 0, SEARCHPATH_DELIMITER, nIdx );
- INetURLObject aObj( aPathToken );
- if ( aObj.HasError() )
- {
- bIsURL = FALSE;
- String aURL;
- if ( LocalFileHelper::ConvertPhysicalNameToURL( aPathToken, aURL ) )
- aObj.SetURL( aURL );
- }
-
- xub_StrLen i, nCount = aIniFile.GetTokenCount( '/' );
- for ( i = 0; i < nCount; ++i )
- aObj.insertName( aIniFile.GetToken( i, '/' ) );
- bRet = ::utl::UCBContentHelper::Exists( aObj.GetMainURL( INetURLObject::NO_DECODE ) );
-
- if ( bRet )
- {
- if ( !bIsURL )
- ::utl::LocalFileHelper::ConvertURLToPhysicalName(
- aObj.GetMainURL( INetURLObject::NO_DECODE ), rIniFile );
- else
- rIniFile = aObj.GetMainURL( INetURLObject::NO_DECODE );
- break;
- }
- }
- }
- }
-
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-::com::sun::star::lang::Locale SvtPathOptions::GetLocale() const
-{
- return pImp->GetLocale();
-}
-// -----------------------------------------------------------------------
-BOOL SvtPathOptions::IsPathReadonly(Pathes ePath)const
-{
- return pImp->IsPathReadonly(ePath);
-}
-// -----------------------------------------------------------------------
-const String& SvtPathOptions::GetPath(Pathes ePath)const
-{
- return pImp->GetPath(ePath);
-}
-// -----------------------------------------------------------------------
-void SvtPathOptions::SetPath( SvtPathOptions::Pathes ePath, const String& rNewPath )
-{
- pImp->SetPath(ePath, rNewPath);
-}
-
-// class PathService -----------------------------------------------------
-#include <com/sun/star/frame/XConfigManager.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-class PathService : public ::cppu::WeakImplHelper2< ::com::sun::star::frame::XConfigManager, ::com::sun::star::lang::XServiceInfo >
-{
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& sKeyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL flush( ) throw(::com::sun::star::uno::RuntimeException);
-};
-
-// class PathService -----------------------------------------------------
-
-void SAL_CALL PathService::addPropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {}
-void SAL_CALL PathService::removePropertyChangeListener( const ::rtl::OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& ) throw(::com::sun::star::uno::RuntimeException) {}
-void SAL_CALL PathService::flush( ) throw(::com::sun::star::uno::RuntimeException) {}
-
-::rtl::OUString SAL_CALL PathService::substituteVariables( const ::rtl::OUString& sText ) throw(::com::sun::star::uno::RuntimeException)
-{
- return SvtPathOptions().SubstituteVariable( sText );
-}
-
-::rtl::OUString SAL_CALL PathService::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
-{
- return OUString::createFromAscii("com.sun.star.comp.svtools.PathService");
-}
-
-sal_Bool SAL_CALL PathService::supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException)
-{
- if ( ServiceName.compareToAscii("com.sun.star.config.SpecialConfigManager") == COMPARE_EQUAL )
- return sal_True;
- else
- return sal_False;
-}
-
-::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL PathService::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
-{
- Sequence< OUString > aRet(1);
- *aRet.getArray() = OUString::createFromAscii("com.sun.star.config.SpecialConfigManager");
- return aRet;
-}
diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx
index 0f54366c47f6..9627a2ce10d9 100644
--- a/svtools/source/config/printoptions.cxx
+++ b/svtools/source/config/printoptions.cxx
@@ -31,11 +31,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
//_________________________________________________________________________________________________________________
// includes
//_________________________________________________________________________________________________________________
@@ -73,7 +68,7 @@
#endif
#ifndef _SVT_LOGHELPER_HXX
-#include <loghelper.hxx>
+#include <unotools/loghelper.hxx>
#endif
#include <itemholder2.hxx>
diff --git a/svtools/source/config/printwarningoptions.cxx b/svtools/source/config/printwarningoptions.cxx
deleted file mode 100644
index c2dfe94b0a2b..000000000000
--- a/svtools/source/config/printwarningoptions.cxx
+++ /dev/null
@@ -1,419 +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: printwarningoptions.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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/printwarningoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <itemholder1.hxx>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Print"))
-
-#define PROPERTYNAME_PAPERSIZE OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/PaperSize"))
-#define PROPERTYNAME_PAPERORIENTATION OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/PaperOrientation"))
-#define PROPERTYNAME_NOTFOUND OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/NotFound"))
-#define PROPERTYNAME_TRANSPARENCY OUString(RTL_CONSTASCII_USTRINGPARAM("Warning/Transparency"))
-#define PROPERTYNAME_PRINTINGMODIFIESDOCUMENT OUString(RTL_CONSTASCII_USTRINGPARAM("PrintingModifiesDocument"))
-
-#define PROPERTYHANDLE_PAPERSIZE 0
-#define PROPERTYHANDLE_PAPERORIENTATION 1
-#define PROPERTYHANDLE_NOTFOUND 2
-#define PROPERTYHANDLE_TRANSPARENCY 3
-#define PROPERTYHDL_PRINTINGMODIFIESDOCUMENT 4
-
-#define PROPERTYCOUNT 5
-
-class SvtPrintWarningOptions_Impl : public ConfigItem
-{
-public:
-
-//---------------------------------------------------------------------------------------------------------
-// constructor / destructor
-//---------------------------------------------------------------------------------------------------------
-
- SvtPrintWarningOptions_Impl();
- ~SvtPrintWarningOptions_Impl();
-
-//---------------------------------------------------------------------------------------------------------
-// overloaded methods of baseclass
-//---------------------------------------------------------------------------------------------------------
-
- virtual void Commit();
-
-//---------------------------------------------------------------------------------------------------------
-// public interface
-//---------------------------------------------------------------------------------------------------------
-
- sal_Bool IsPaperSize() const { return m_bPaperSize; }
- sal_Bool IsPaperOrientation() const { return m_bPaperOrientation; }
- sal_Bool IsNotFound() const { return m_bNotFound; }
- sal_Bool IsTransparency() const { return m_bTransparency; }
- sal_Bool IsModifyDocumentOnPrintingAllowed() const { return m_bModifyDocumentOnPrintingAllowed; }
-
- void SetPaperSize( sal_Bool bState ) { m_bPaperSize = bState; SetModified(); }
- void SetPaperOrientation( sal_Bool bState ) { m_bPaperOrientation = bState; SetModified(); }
- void SetNotFound( sal_Bool bState ) { m_bNotFound = bState; SetModified(); }
- void SetTransparency( sal_Bool bState ) { m_bTransparency = bState; SetModified(); }
- void SetModifyDocumentOnPrintingAllowed( sal_Bool bState ) { m_bModifyDocumentOnPrintingAllowed = bState; SetModified(); }
-
-//-------------------------------------------------------------------------------------------------------------
-// private methods
-//-------------------------------------------------------------------------------------------------------------
-
-private:
-
- static Sequence< OUString > impl_GetPropertyNames();
-
-//-------------------------------------------------------------------------------------------------------------
-// private member
-//-------------------------------------------------------------------------------------------------------------
-
-private:
-
- sal_Bool m_bPaperSize;
- sal_Bool m_bPaperOrientation;
- sal_Bool m_bNotFound;
- sal_Bool m_bTransparency;
- sal_Bool m_bModifyDocumentOnPrintingAllowed;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl() :
- ConfigItem( ROOTNODE_START ),
- m_bPaperSize( sal_False ),
- m_bPaperOrientation( sal_False ),
- m_bNotFound( sal_False ),
- m_bTransparency( sal_True ),
- m_bModifyDocumentOnPrintingAllowed( sal_True )
-{
- Sequence< OUString > seqNames( impl_GetPropertyNames() );
- Sequence< Any > seqValues( GetProperties( seqNames ) );
-
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to our internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- sal_Int32 nProperty = 0;
-
- for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtPrintWarningOptions_Impl::SvtPrintWarningOptions_Impl()\nInvalid property value for property detected!\n" );
-
- switch( nProperty )
- {
- case PROPERTYHANDLE_PAPERSIZE:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bPaperSize;
- }
- break;
-
- case PROPERTYHANDLE_PAPERORIENTATION:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bPaperOrientation;
- }
- break;
-
- case PROPERTYHANDLE_NOTFOUND:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bNotFound;
- }
- break;
-
- case PROPERTYHANDLE_TRANSPARENCY:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bTransparency;
- }
- break;
- case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT:
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "Invalid type" );
- seqValues[nProperty] >>= m_bModifyDocumentOnPrintingAllowed;
- }
- break;
-
- }
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtPrintWarningOptions_Impl::~SvtPrintWarningOptions_Impl()
-{
- if( IsModified() )
- Commit();
-}
-
-//*****************************************************************************************************************
-// Commit
-//*****************************************************************************************************************
-void SvtPrintWarningOptions_Impl::Commit()
-{
- Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
- Sequence< Any > aSeqValues( aSeqNames.getLength() );
-
- for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_PAPERSIZE:
- aSeqValues[nProperty] <<= m_bPaperSize;
- break;
-
- case PROPERTYHANDLE_PAPERORIENTATION:
- aSeqValues[nProperty] <<= m_bPaperOrientation;
- break;
-
- case PROPERTYHANDLE_NOTFOUND:
- aSeqValues[nProperty] <<= m_bNotFound;
- break;
-
- case PROPERTYHANDLE_TRANSPARENCY:
- aSeqValues[nProperty] <<= m_bTransparency;
- break;
- case PROPERTYHDL_PRINTINGMODIFIESDOCUMENT:
- aSeqValues[nProperty] <<= m_bModifyDocumentOnPrintingAllowed;
- break;
- }
- }
-
- PutProperties( aSeqNames, aSeqValues );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtPrintWarningOptions_Impl::impl_GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_PAPERSIZE,
- PROPERTYNAME_PAPERORIENTATION,
- PROPERTYNAME_NOTFOUND,
- PROPERTYNAME_TRANSPARENCY,
- PROPERTYNAME_PRINTINGMODIFIESDOCUMENT
- };
-
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
-
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtPrintWarningOptions_Impl* SvtPrintWarningOptions::m_pDataContainer = NULL;
-sal_Int32 SvtPrintWarningOptions::m_nRefCount = 0;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtPrintWarningOptions::SvtPrintWarningOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already!
- if( m_pDataContainer == NULL )
- {
- m_pDataContainer = new SvtPrintWarningOptions_Impl();
- ItemHolder1::holdConfigItem(E_PRINTWARNINGOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtPrintWarningOptions::~SvtPrintWarningOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtPrintWarningOptions::IsPaperSize() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsPaperSize();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtPrintWarningOptions::IsPaperOrientation() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsPaperOrientation();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtPrintWarningOptions::IsNotFound() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsNotFound();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtPrintWarningOptions::IsTransparency() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsTransparency();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtPrintWarningOptions::SetPaperSize( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetPaperSize( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtPrintWarningOptions::SetPaperOrientation( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetPaperOrientation( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtPrintWarningOptions::SetNotFound( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetNotFound( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtPrintWarningOptions::SetTransparency( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetTransparency( bState );
-}
-// -----------------------------------------------------------------------------
-
-sal_Bool SvtPrintWarningOptions::IsModifyDocumentOnPrintingAllowed() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsModifyDocumentOnPrintingAllowed();
-}
-
-// -----------------------------------------------------------------------------
-
-void SvtPrintWarningOptions::SetModifyDocumentOnPrintingAllowed( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetModifyDocumentOnPrintingAllowed( bState ) ;
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtPrintWarningOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/regoptions.cxx b/svtools/source/config/regoptions.cxx
deleted file mode 100644
index 7c94807f2c25..000000000000
--- a/svtools/source/config/regoptions.cxx
+++ /dev/null
@@ -1,554 +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: regoptions.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_svtools.hxx"
-#include "regoptions.hxx"
-#include <unotools/confignode.hxx>
-#include <tools/date.hxx>
-#include <comphelper/processfactory.hxx>
-#include <osl/mutex.hxx>
-#include <unotools/bootstrap.hxx>
-#include <rtl/ustring.hxx>
-
-//........................................................................
-namespace svt
-{
-//........................................................................
-
- using namespace ::utl;
- using namespace ::com::sun::star::uno;
-
- //====================================================================
- //= local helpers
- //====================================================================
- //--------------------------------------------------------------------
- /** converts a string representation of a date into a integer representation
- <p>No semantic check is made, i.e. if the string describes the 40.12, this is not recognized. In opposite,
- the string must have a valid structure (DD.MM.YYYY).</p>
- @return
- the integer representation of the date which can be used with the Date class,
- or 0 if the given string was no valid date representation
- */
- static sal_Int32 lcl_convertString2Date( const ::rtl::OUString& _rStringRep )
- {
- sal_Int32 nDateIntRep = 0;
- if ( _rStringRep.getLength() == 2 + 1 + 2 + 1 + 4 ) // DD.MM.YYYY
- {
- // validate the string
- sal_Bool bValid = sal_True;
-
- const sal_Unicode* pStringRep = _rStringRep.getStr();
- sal_Int32 nLen = _rStringRep.getLength();
- for ( sal_Int32 nPos = 0;
- bValid && ( nPos < nLen );
- ++nPos, ++pStringRep
- )
- {
- if ( ( 2 == nPos ) || ( 5 == nPos ) )
- bValid = '.' == *pStringRep; // the number separators
- else
- bValid = ( *pStringRep >= '0' ) && ( *pStringRep <= '9' );
- }
-
- // passed the test?
- if ( bValid )
- {
- Date aDate;
- aDate.SetDay ( (USHORT)_rStringRep.copy( 0, 2 ).toInt32( ) );
- aDate.SetMonth ( (USHORT)_rStringRep.copy( 3, 2 ).toInt32( ) );
- aDate.SetYear ( (USHORT)_rStringRep.copy( 6, 4 ).toInt32( ) );
- nDateIntRep = aDate.GetDate();
- }
- }
-
- return nDateIntRep;
- }
-
- //--------------------------------------------------------------------
- static const ::rtl::OUString& lcl_fillToken( const sal_Int32 /* [in] */ _nToken, const sal_Int16 /* [in] */ _nDigits, ::rtl::OUString& /* [out] */ _rToken )
- {
- // convert into string
- ::rtl::OUString sLeanToken = ::rtl::OUString::valueOf( _nToken );
- // check length
- if ( sLeanToken.getLength() < _nDigits )
- { // fill
- OSL_ENSURE( _nDigits <= 4, "lcl_fillToken: invalid digit number!" );
- _rToken = ::rtl::OUString( "0000", _nDigits - sLeanToken.getLength(), RTL_TEXTENCODING_ASCII_US );
- _rToken += sLeanToken;
- }
- else
- _rToken = sLeanToken;
-
- return _rToken;
- }
-
- //--------------------------------------------------------------------
- /** converts a integer representation of a date into a string representation
- */
- static ::rtl::OUString lcl_ConvertDate2String( const Date& _rDate )
- {
- OSL_ENSURE( _rDate.IsValid(), "lcl_ConvertDate2String: invalid integer representation!" );
-
- sal_Unicode cSeparator( '.' );
- ::rtl::OUString sSeparator( &cSeparator, 1 );
-
- ::rtl::OUString sStringRep;
- ::rtl::OUString sToken;
- sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetDay(), 2, sToken );
- sStringRep += sSeparator;
- sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetMonth(), 2, sToken );
- sStringRep += sSeparator;
- sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetYear(), 4, sToken );
-
- return sStringRep;
- }
-
- //--------------------------------------------------------------------
- /// checks whether a given trigger date is reached (i.e. is _before_ the current date)
- static sal_Bool lcl_reachedTriggerDate( const Date& _rTriggerDate )
- {
- return _rTriggerDate <= Date();
- }
-
- //--------------------------------------------------------------------
- #define DECLARE_STATIC_LAZY_USTRING( name ) \
- static const ::rtl::OUString& lcl_get##name##Name() \
- { \
- static const ::rtl::OUString sName = ::rtl::OUString::createFromAscii( #name ); \
- return sName; \
- }
-
- DECLARE_STATIC_LAZY_USTRING( ReminderDate );
- DECLARE_STATIC_LAZY_USTRING( RequestDialog );
- DECLARE_STATIC_LAZY_USTRING( ShowMenuItem );
- DECLARE_STATIC_LAZY_USTRING( Patch );
-
- //====================================================================
- //= RegOptionsImpl
- //====================================================================
- class RegOptionsImpl
- {
- private:
- OConfigurationTreeRoot m_aRegistrationNode; // the configuration node we need to access our persistent data
-
- String m_sRegistrationURL; // the URL to use when doing an online registration
- Date m_aReminderDate; // the reminder date as found in the configuration
- sal_Int32 m_nDialogCounter; // the dialog counter - see getDialogPermission
- sal_Bool m_bShowMenuItem; // the flag indicating if the registration menu item is allowed
-
- static RegOptionsImpl* s_pSingleInstance; // the one and only instance of this class
- static sal_Int32 s_nInstanceCount; // reference counter for the instances
- static sal_Bool s_bThisSessionDone; // the flag indicating if for this session, everything beeing relevant has already been done
-
- private:
- RegOptionsImpl( );
-
- static ::osl::Mutex& getStaticMutex(); // get the mutex used to protect the static members of this class
-
- void commit( );
- sal_Int32 getBuildId() const;
-
- private:
- RegOptions::DialogPermission implGetDialogPermission( ) const;
-
- public:
- static RegOptionsImpl* registerClient( );
- static void revokeClient( );
-
- inline sal_Bool hasURL( ) const { return ( 0 != m_sRegistrationURL.Len() ); }
- inline sal_Bool allowMenu( ) const { return hasURL() && m_bShowMenuItem; }
- inline String getRegistrationURL( ) const { return m_sRegistrationURL; }
-
- RegOptions::DialogPermission getDialogPermission( ) const;
- void markSessionDone( );
- void activateReminder( sal_Int32 _nDaysFromNow );
- void removeReminder();
- bool hasReminderDateCome() const;
- };
-
- //--------------------------------------------------------------------
- RegOptionsImpl* RegOptionsImpl::s_pSingleInstance = NULL;
- sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False;
- sal_Int32 RegOptionsImpl::s_nInstanceCount = 0;
-
- //--------------------------------------------------------------------
- ::osl::Mutex& RegOptionsImpl::getStaticMutex()
- {
- static ::osl::Mutex* s_pStaticMutex = NULL;
- if ( !s_pStaticMutex )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !s_pStaticMutex )
- {
- static ::osl::Mutex s_aStaticMutex;
- s_pStaticMutex = &s_aStaticMutex;
- }
- }
- return *s_pStaticMutex;
- }
-
- //--------------------------------------------------------------------
- void RegOptionsImpl::commit( )
- {
- m_aRegistrationNode.commit( );
- }
-
- //--------------------------------------------------------------------
- RegOptionsImpl* RegOptionsImpl::registerClient( )
- {
- ::osl::MutexGuard aGuard( getStaticMutex() );
-
- if ( !s_pSingleInstance )
- s_pSingleInstance = new RegOptionsImpl;
-
- ++s_nInstanceCount;
- return s_pSingleInstance;
- }
-
- //--------------------------------------------------------------------
- void RegOptionsImpl::revokeClient( )
- {
- ::osl::MutexGuard aGuard( getStaticMutex() );
- OSL_ENSURE( s_nInstanceCount, "RegOptionsImpl::revokeClient: there are no clients alive!" );
- OSL_ENSURE( s_pSingleInstance || !s_nInstanceCount, "RegOptionsImpl::revokeClient: invalid instance pointer!" );
-
- if ( s_nInstanceCount )
- {
- if ( s_pSingleInstance )
- // commit the changes done by this client
- s_pSingleInstance->commit();
-
- if ( 0 == --s_nInstanceCount )
- {
- delete s_pSingleInstance;
- s_pSingleInstance = NULL;
- }
- }
- }
-
- //--------------------------------------------------------------------
- RegOptionsImpl::RegOptionsImpl( )
- :m_nDialogCounter ( 0 )
- ,m_bShowMenuItem ( sal_False )
- {
- // create the config node for all our registration information
- m_aRegistrationNode = OConfigurationTreeRoot::createWithServiceFactory(
- ::comphelper::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Common/Help/Registration" )
- );
-
- // cache some data
- //the URL to use for online registration
- ::rtl::OUString sStringValue;
- m_aRegistrationNode.getNodeValue( ::rtl::OUString::createFromAscii( "URL" ) ) >>= sStringValue;
- m_sRegistrationURL = sStringValue;
-
- // the state of the dialog
- m_aRegistrationNode.getNodeValue( lcl_getRequestDialogName() ) >>= m_nDialogCounter;
-
- // the flag for showing the menu item
- sal_Bool bBoolValue = sal_False;
- m_aRegistrationNode.getNodeValue( lcl_getShowMenuItemName() ) >>= bBoolValue;
- m_bShowMenuItem = bBoolValue;
-
- // the reminder date (if any)
- sal_Int32 nIntDate = 0;
- sStringValue = ::rtl::OUString();
- m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sStringValue;
- bool bIsPatchDate = ( sStringValue.equals( lcl_getPatchName() ) != sal_False );
- if ( !bIsPatchDate && sStringValue.getLength() )
- nIntDate = lcl_convertString2Date( sStringValue );
- m_aReminderDate.SetDate( nIntDate );
- }
-
- //--------------------------------------------------------------------
- RegOptions::DialogPermission RegOptionsImpl::implGetDialogPermission( ) const
- {
- RegOptions::DialogPermission eResult = RegOptions::dpDisabled;
- // no URL or a counter already decreased to zero means the dialog is disabled
- if ( hasURL() && ( m_nDialogCounter > 0 ) )
- {
- // during every session, the counter will be decreased
- // If it reaches zero, the dialog shall be executed
- if ( 1 == m_nDialogCounter )
- {
- if ( m_aReminderDate.IsValid( ) )
- { // valid reminder date
- // assume remind later
- eResult = RegOptions::dpRemindLater;
- // and check if we reached the reminder date
- if ( lcl_reachedTriggerDate( m_aReminderDate ) )
- eResult = RegOptions::dpThisSession;
- }
- else
- eResult = RegOptions::dpThisSession; // execute in this session
- }
- else
- eResult = RegOptions::dpNotThisSession; // first trigger session not reached
-
- // a last check ....
- if ( ( s_bThisSessionDone ) // this session is already marked as "done"
- && ( RegOptions::dpThisSession == eResult )// but without this, the state would be "now"
- )
- eResult = RegOptions::dpDisabled; // -> change state to "disabled"
- }
-
- return eResult;
- }
-
- //--------------------------------------------------------------------
- RegOptions::DialogPermission RegOptionsImpl::getDialogPermission( ) const
- {
- OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::getDialogPermission: should never be asked in this session, again!" );
- // Somebody already marked this session as "everything relevant happened". So why sombody (else?) asks
- // me again?
-
- return implGetDialogPermission( );
- }
-
- //--------------------------------------------------------------------
- void RegOptionsImpl::activateReminder( sal_Int32 _nDaysFromNow )
- {
- OSL_ENSURE( s_bThisSessionDone || ( implGetDialogPermission( ) != RegOptions::dpDisabled ), "RegOptionsImpl::activateReminder: invalid call!" );
- OSL_ENSURE( _nDaysFromNow > 0, "RegOptionsImpl::activateReminder: invalid argument!" );
-
- // calc the reminder
- m_aReminderDate = Date() + _nDaysFromNow; // today (default ctor) + days
-
- // remember the date
- m_aRegistrationNode.setNodeValue(
- lcl_getReminderDateName(),
- makeAny( lcl_ConvertDate2String( m_aReminderDate ) )
- );
- // to be on the save side, write the counter
- m_aRegistrationNode.setNodeValue(
- lcl_getRequestDialogName(),
- makeAny( (sal_Int32)1 )
- );
-
- // mark this session as done
- if ( !s_bThisSessionDone )
- markSessionDone( );
- }
-
- //--------------------------------------------------------------------
- void RegOptionsImpl::removeReminder()
- {
- ::rtl::OUString aDefault;
- ::rtl::OUString aReminderValue( lcl_getPatchName() );
- aReminderValue += ::rtl::OUString::valueOf(getBuildId());
-
- m_aRegistrationNode.setNodeValue(
- lcl_getReminderDateName(),
- Any( aReminderValue )
- );
- }
-
- //--------------------------------------------------------------------
- sal_Int32 RegOptionsImpl::getBuildId() const
- {
- sal_Int32 nBuildId( 0 );
- ::rtl::OUString aDefault;
- ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault );
- sal_Int32 nIndex1 = aBuildIdData.indexOf(':');
- sal_Int32 nIndex2 = aBuildIdData.indexOf(')');
- if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 ))
- {
- ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 );
- nBuildId = aBuildId.toInt32();
- }
-
- return nBuildId;
- }
-
- //--------------------------------------------------------------------
- bool RegOptionsImpl::hasReminderDateCome() const
- {
- bool bRet = false;
- sal_Int32 nDate = 0;
- ::rtl::OUString sDate;
- m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sDate;
- if ( sDate.getLength() )
- {
- if ( sDate.indexOf( lcl_getPatchName() ) == 0)
- {
- if (sDate.equals( lcl_getPatchName() ))
- bRet = true;
- else if (sDate.getLength() > lcl_getPatchName().getLength() )
- {
- // Check the build ID to determine if the registration
- // dialog needs to be shown.
- sal_Int32 nBuildId = getBuildId();
- ::rtl::OUString aStoredBuildId( sDate.copy(lcl_getPatchName().getLength()));
-
- // remind if the current build ID is not the same as the stored one
- if ( nBuildId != aStoredBuildId.toInt32() )
- bRet = true;
- }
- }
- else
- {
- nDate = lcl_convertString2Date( sDate );
- if ( nDate > 0 )
- {
- Date aReminderDate;
- aReminderDate.SetDate( nDate );
- bRet = aReminderDate <= Date();
- }
- }
- }
- else
- bRet = true;
-
- return bRet;
- }
-
- //--------------------------------------------------------------------
- void RegOptionsImpl::markSessionDone( )
- {
- OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::markSessionDone: already marked!" );
- OSL_ENSURE( implGetDialogPermission( ) != RegOptions::dpDisabled, "RegOptionsImpl::markSessionDone: invalid call!" );
- if ( !s_bThisSessionDone )
- {
- RegOptions::DialogPermission eOldPermission = implGetDialogPermission( );
-
- s_bThisSessionDone = sal_True;
-
- if ( RegOptions::dpRemindLater == eOldPermission )
- { // no action required. If we shall remind later, the counter is already at 1, we should not change this,
- // as the next smaller number (which is 0 :) means that the dialog would be disabled
- OSL_ENSURE( 1 == m_nDialogCounter, "RegOptionsImpl::markSessionDone: invalid session counter (1)!" );
- }
- else
- {
- OSL_ENSURE( m_nDialogCounter > 0, "RegOptionsImpl::markSessionDone: invalid session counter (2)!" );
- --m_nDialogCounter;
-
- // decrease the session counter
- m_aRegistrationNode.setNodeValue(
- lcl_getRequestDialogName(),
- makeAny( (sal_Int32)m_nDialogCounter )
- );
-
- // and clear the reminder date
- removeReminder();
- }
- }
- }
-
- //====================================================================
- //= RegOptions
- //====================================================================
- //--------------------------------------------------------------------
- RegOptions::RegOptions()
- :m_pImpl( NULL )
- {
- }
-
- //--------------------------------------------------------------------
- void RegOptions::ensureImpl( )
- {
- if ( !m_pImpl )
- m_pImpl = RegOptionsImpl::registerClient();
- }
-
- //--------------------------------------------------------------------
- RegOptions::~RegOptions()
- {
- if ( m_pImpl )
- {
- RegOptionsImpl::revokeClient();
- m_pImpl = NULL;
- }
- }
-
- //--------------------------------------------------------------------
- String RegOptions::getRegistrationURL( ) const
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- return m_pImpl->getRegistrationURL();
- }
-
- //--------------------------------------------------------------------
- RegOptions::DialogPermission RegOptions::getDialogPermission( ) const
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- return m_pImpl->getDialogPermission();
- }
-
- //--------------------------------------------------------------------
- void RegOptions::markSessionDone( )
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- m_pImpl->markSessionDone();
- }
-
- //--------------------------------------------------------------------
- void RegOptions::activateReminder( sal_Int32 _nDaysFromNow )
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- m_pImpl->activateReminder( _nDaysFromNow );
- }
-
- //--------------------------------------------------------------------
- sal_Bool RegOptions::allowMenu( ) const
- {
- /// we cache this setting, 'cause it is needed very often
- static sal_Bool bKnowMenuPermission = sal_False;
- static sal_Bool bAllowMenu = sal_False;
-
- if ( !bKnowMenuPermission )
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- bAllowMenu = m_pImpl->allowMenu();
- bKnowMenuPermission = sal_True;
- }
- return bAllowMenu;
- }
-
- //--------------------------------------------------------------------
- void RegOptions::removeReminder()
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- m_pImpl->removeReminder();
- }
-
- //--------------------------------------------------------------------
- bool RegOptions::hasReminderDateCome() const
- {
- const_cast< RegOptions* >( this )->ensureImpl( );
- return m_pImpl->hasReminderDateCome();
- }
-
-//........................................................................
-} // namespace svt
-//........................................................................
-
diff --git a/svtools/source/config/saveopt.cxx b/svtools/source/config/saveopt.cxx
deleted file mode 100644
index 2b18d1bf4767..000000000000
--- a/svtools/source/config/saveopt.cxx
+++ /dev/null
@@ -1,1047 +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: saveopt.cxx,v $
- * $Revision: 1.36 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#ifndef GCC
-#endif
-
-#include <svtools/saveopt.hxx>
-#include "rtl/instance.hxx"
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <osl/mutex.hxx>
-#include <comphelper/configurationhelper.hxx>
-#include <unotools/processfactory.hxx>
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-namespace css = ::com::sun::star;
-
-class SvtSaveOptions_Impl;
-class SvtLoadOptions_Impl;
-
-#define CFG_READONLY_DEFAULT sal_False
-
-struct SvtLoadSaveOptions_Impl
-{
- SvtSaveOptions_Impl* pSaveOpt;
- SvtLoadOptions_Impl* pLoadOpt;
-};
-
-static SvtLoadSaveOptions_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-class SvtSaveOptions_Impl : public utl::ConfigItem
-{
- sal_Int32 nAutoSaveTime;
- sal_Bool bUseUserData,
- bBackup,
- bAutoSave,
- bAutoSavePrompt,
- bDocInfSave,
- bSaveWorkingSet,
- bSaveDocWins,
- bSaveDocView,
- bSaveRelINet,
- bSaveRelFSys,
- bSaveUnpacked,
- bDoPrettyPrinting,
- bWarnAlienFormat,
- bLoadDocPrinter;
-
- sal_Bool bROAutoSaveTime,
- bROUseUserData,
- bROBackup,
- bROAutoSave,
- bROAutoSavePrompt,
- bRODocInfSave,
- bROSaveWorkingSet,
- bROSaveDocWins,
- bROSaveDocView,
- bROSaveRelINet,
- bROSaveRelFSys,
- bROSaveUnpacked,
- bROWarnAlienFormat,
- bRODoPrettyPrinting,
- bROLoadDocPrinter,
- bROODFDefaultVersion;
-
- SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion;
-
-public:
- SvtSaveOptions_Impl();
- ~SvtSaveOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
- sal_Int32 GetAutoSaveTime() const { return nAutoSaveTime; }
- BOOL IsUseUserData() const { return bUseUserData; }
- BOOL IsBackup() const { return bBackup; }
- BOOL IsAutoSave() const { return bAutoSave; }
- BOOL IsAutoSavePrompt() const { return bAutoSavePrompt; }
- BOOL IsDocInfoSave() const { return bDocInfSave; }
- BOOL IsSaveWorkingSet() const { return bSaveWorkingSet; }
- BOOL IsSaveDocWins() const { return bSaveDocWins; }
- BOOL IsSaveDocView() const { return bSaveDocView; }
- BOOL IsSaveRelINet() const { return bSaveRelINet; }
- BOOL IsSaveRelFSys() const { return bSaveRelFSys; }
- BOOL IsSaveUnpacked() const { return bSaveUnpacked; }
- sal_Bool IsPrettyPrintingEnabled( ) const { return bDoPrettyPrinting; }
- sal_Bool IsWarnAlienFormat() const { return bWarnAlienFormat; }
- sal_Bool IsLoadDocPrinter() const { return bLoadDocPrinter; }
- SvtSaveOptions::ODFDefaultVersion
- GetODFDefaultVersion() const { return eODFDefaultVersion; }
-
- void SetAutoSaveTime( sal_Int32 n );
- void SetUseUserData( BOOL b );
- void SetBackup( BOOL b );
- void SetAutoSave( BOOL b );
- void SetAutoSavePrompt( BOOL b );
- void SetDocInfoSave( BOOL b );
- void SetSaveWorkingSet( BOOL b );
- void SetSaveDocWins( BOOL b );
- void SetSaveDocView( BOOL b );
- void SetSaveRelINet( BOOL b );
- void SetSaveRelFSys( BOOL b );
- void SetSaveUnpacked( BOOL b );
- void EnablePrettyPrinting( sal_Bool _bDoPP );
- void SetWarnAlienFormat( sal_Bool _bDoPP );
- void SetLoadDocPrinter( sal_Bool bNew );
- void SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew );
-
- sal_Bool IsReadOnly( SvtSaveOptions::EOption eOption ) const;
-};
-
-void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n )
-{
- if (!bROAutoSaveTime && nAutoSaveTime!=n)
- {
- nAutoSaveTime = n;
- SetModified();
- Commit();
- }
-}
-
-void SvtSaveOptions_Impl::SetUseUserData( BOOL b )
-{
- if (!bROUseUserData && bUseUserData!=b)
- {
- bUseUserData = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetBackup( BOOL b )
-{
- if (!bROBackup && bBackup!=b)
- {
- bBackup = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetAutoSave( BOOL b )
-{
- if (!bROAutoSave && bAutoSave!=b)
- {
- bAutoSave = b;
- SetModified();
- Commit();
- }
-}
-
-void SvtSaveOptions_Impl::SetAutoSavePrompt( BOOL b )
-{
- if (!bROAutoSavePrompt && bAutoSavePrompt!=b)
- {
- bAutoSavePrompt = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetDocInfoSave(BOOL b)
-{
- if (!bRODocInfSave && bDocInfSave!=b)
- {
- bDocInfSave = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetSaveWorkingSet( BOOL b )
-{
- if (!bROSaveWorkingSet && bSaveWorkingSet!=b)
- {
- bSaveWorkingSet = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetSaveDocWins( BOOL b )
-{
- if (!bROSaveDocWins && bSaveDocWins!=b)
- {
- bSaveDocWins = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetSaveDocView( BOOL b )
-{
- if (!bROSaveDocView && bSaveDocView!=b)
- {
- bSaveDocView = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetSaveRelINet( BOOL b )
-{
- if (!bROSaveRelINet && bSaveRelINet!=b)
- {
- bSaveRelINet = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetSaveRelFSys( BOOL b )
-{
- if (!bROSaveRelFSys && bSaveRelFSys!=b)
- {
- bSaveRelFSys = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetSaveUnpacked( BOOL b )
-{
- if (!bROSaveUnpacked && bSaveUnpacked!=b)
- {
- bSaveUnpacked = b;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::EnablePrettyPrinting( sal_Bool _bDoPP )
-{
- if (!bRODoPrettyPrinting && bDoPrettyPrinting!=_bDoPP)
- {
- bDoPrettyPrinting = _bDoPP;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetWarnAlienFormat( sal_Bool _bDoPP )
-{
- if (!bROWarnAlienFormat && bWarnAlienFormat!=_bDoPP)
- {
- bWarnAlienFormat = _bDoPP;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetLoadDocPrinter( sal_Bool bNew )
-{
- if ( !bROLoadDocPrinter && bLoadDocPrinter != bNew )
- {
- bLoadDocPrinter = bNew;
- SetModified();
- }
-}
-
-void SvtSaveOptions_Impl::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eNew )
-{
- if ( !bROODFDefaultVersion && eODFDefaultVersion != eNew )
- {
- eODFDefaultVersion = eNew;
- SetModified();
- }
-}
-
-sal_Bool SvtSaveOptions_Impl::IsReadOnly( SvtSaveOptions::EOption eOption ) const
-{
- sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
- switch(eOption)
- {
- case SvtSaveOptions::E_AUTOSAVETIME :
- bReadOnly = bROAutoSaveTime;
- break;
- case SvtSaveOptions::E_USEUSERDATA :
- bReadOnly = bROUseUserData;
- break;
- case SvtSaveOptions::E_BACKUP :
- bReadOnly = bROBackup;
- break;
- case SvtSaveOptions::E_AUTOSAVE :
- bReadOnly = bROAutoSave;
- break;
- case SvtSaveOptions::E_AUTOSAVEPROMPT :
- bReadOnly = bROAutoSavePrompt;
- break;
- case SvtSaveOptions::E_DOCINFSAVE :
- bReadOnly = bRODocInfSave;
- break;
- case SvtSaveOptions::E_SAVEWORKINGSET :
- bReadOnly = bROSaveWorkingSet;
- break;
- case SvtSaveOptions::E_SAVEDOCWINS :
- bReadOnly = bROSaveDocWins;
- break;
- case SvtSaveOptions::E_SAVEDOCVIEW :
- bReadOnly = bROSaveDocView;
- break;
- case SvtSaveOptions::E_SAVERELINET :
- bReadOnly = bROSaveRelINet;
- break;
- case SvtSaveOptions::E_SAVERELFSYS :
- bReadOnly = bROSaveRelFSys;
- break;
- case SvtSaveOptions::E_SAVEUNPACKED :
- bReadOnly = bROSaveUnpacked;
- break;
- case SvtSaveOptions::E_DOPRETTYPRINTING :
- bReadOnly = bRODoPrettyPrinting;
- break;
- case SvtSaveOptions::E_WARNALIENFORMAT :
- bReadOnly = bROWarnAlienFormat;
- break;
- case SvtSaveOptions::E_LOADDOCPRINTER :
- bReadOnly = bROLoadDocPrinter;
- break;
- case SvtSaveOptions::E_ODFDEFAULTVERSION :
- bReadOnly = bROLoadDocPrinter;
- break;
- }
- return bReadOnly;
-}
-
-#define FORMAT 0
-#define TIMEINTERVALL 1
-#define USEUSERDATA 2
-#define CREATEBACKUP 3
-#define AUTOSAVE 4
-#define PROMPT 5
-#define EDITPROPERTY 6
-#define SAVEDOCWINS 7
-#define SAVEVIEWINFO 8
-#define UNPACKED 9
-#define PRETTYPRINTING 10
-#define WARNALIENFORMAT 11
-#define LOADDOCPRINTER 12
-#define FILESYSTEM 13
-#define INTERNET 14
-#define SAVEWORKINGSET 15
-#define ODFDEFAULTVERSION 16
-
-Sequence< OUString > GetPropertyNames()
-{
- static const char* aPropNames[] =
- {
- "Graphic/Format",
- "Document/AutoSaveTimeIntervall",
- "Document/UseUserData",
- "Document/CreateBackup",
- "Document/AutoSave",
- "Document/AutoSavePrompt",
- "Document/EditProperty",
- "Document/DocumentWindows",
- "Document/ViewInfo",
- "Document/Unpacked",
- "Document/PrettyPrinting",
- "Document/WarnAlienFormat",
- "Document/LoadPrinter",
- "URL/FileSystem",
- "URL/Internet",
- "WorkingSet",
- "ODF/DefaultVersion"
- };
-
- const int nCount = sizeof( aPropNames ) / sizeof( const char* );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
-
- return aNames;
-}
-
-// -----------------------------------------------------------------------
-
-SvtSaveOptions_Impl::SvtSaveOptions_Impl()
- : ConfigItem( OUString::createFromAscii("Office.Common/Save") )
- , nAutoSaveTime( 0 )
- , bUseUserData( sal_False )
- , bBackup( sal_False )
- , bAutoSave( sal_False )
- , bAutoSavePrompt( sal_False )
- , bDocInfSave( sal_False )
- , bSaveWorkingSet( sal_False )
- , bSaveDocWins( sal_False )
- , bSaveDocView( sal_False )
- , bSaveRelINet( sal_False )
- , bSaveRelFSys( sal_False )
- , bSaveUnpacked( sal_False )
- , bDoPrettyPrinting( sal_False )
- , bWarnAlienFormat( sal_True )
- , bLoadDocPrinter( sal_True )
- , bROAutoSaveTime( CFG_READONLY_DEFAULT )
- , bROUseUserData( CFG_READONLY_DEFAULT )
- , bROBackup( CFG_READONLY_DEFAULT )
- , bROAutoSave( CFG_READONLY_DEFAULT )
- , bROAutoSavePrompt( CFG_READONLY_DEFAULT )
- , bRODocInfSave( CFG_READONLY_DEFAULT )
- , bROSaveWorkingSet( CFG_READONLY_DEFAULT )
- , bROSaveDocWins( CFG_READONLY_DEFAULT )
- , bROSaveDocView( CFG_READONLY_DEFAULT )
- , bROSaveRelINet( CFG_READONLY_DEFAULT )
- , bROSaveRelFSys( CFG_READONLY_DEFAULT )
- , bROSaveUnpacked( CFG_READONLY_DEFAULT )
- , bROWarnAlienFormat( CFG_READONLY_DEFAULT )
- , bRODoPrettyPrinting( CFG_READONLY_DEFAULT )
- , bROLoadDocPrinter( CFG_READONLY_DEFAULT )
- , bROODFDefaultVersion( CFG_READONLY_DEFAULT )
- , eODFDefaultVersion( SvtSaveOptions::ODFVER_LATEST )
-{
- Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames );
- EnableNotification( aNames );
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" );
- if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() )
- {
- for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
- {
- DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
- if ( pValues[nProp].hasValue() )
- {
- sal_Int32 nTemp = 0;
- switch ( nProp )
- {
- case FORMAT:
- // not supported anymore
- break;
-
- case TIMEINTERVALL :
- if ( pValues[nProp] >>= nTemp )
- nAutoSaveTime = nTemp;
- else {
- DBG_ERROR( "Wrong Type!" );
- };
- bROAutoSaveTime = pROStates[nProp];
- break;
-
- case ODFDEFAULTVERSION :
- {
- sal_Int16 nTmp = 0;
- if ( pValues[nProp] >>= nTmp )
- {
- if( nTmp == 3 )
- eODFDefaultVersion = SvtSaveOptions::ODFVER_LATEST;
- else
- eODFDefaultVersion = SvtSaveOptions::ODFDefaultVersion( nTmp );
- }
- else {
- DBG_ERRORFILE( "SvtSaveOptions_Impl::SvtSaveOptions_Impl(): Wrong Type!" );
- };
- bROODFDefaultVersion = pROStates[nProp];
- break;
- }
-
- default:
- {
- sal_Bool bTemp = sal_Bool();
- if ( pValues[nProp] >>= bTemp )
- {
- switch ( nProp )
- {
- case USEUSERDATA :
- bUseUserData = bTemp;
- bROUseUserData = pROStates[nProp];
- break;
- case CREATEBACKUP :
- bBackup = bTemp;
- bROBackup = pROStates[nProp];
- break;
- case AUTOSAVE :
- bAutoSave = bTemp;
- bROAutoSave = pROStates[nProp];
- break;
- case PROMPT :
- bAutoSavePrompt = bTemp;
- bROAutoSavePrompt = pROStates[nProp];
- break;
- case EDITPROPERTY :
- bDocInfSave = bTemp;
- bRODocInfSave = pROStates[nProp];
- break;
- case SAVEWORKINGSET :
- bSaveWorkingSet = bTemp;
- bROSaveWorkingSet = pROStates[nProp];
- break;
- case SAVEDOCWINS :
- bSaveDocWins = bTemp;
- bROSaveDocWins = pROStates[nProp];
- break;
- case SAVEVIEWINFO :
- bSaveDocView = bTemp;
- bROSaveDocView = pROStates[nProp];
- break;
- case FILESYSTEM :
- bSaveRelFSys = bTemp;
- bROSaveRelFSys = pROStates[nProp];
- break;
- case INTERNET :
- bSaveRelINet = bTemp;
- bROSaveRelINet = pROStates[nProp];
- break;
- case UNPACKED :
- bSaveUnpacked = bTemp;
- bROSaveUnpacked = pROStates[nProp];
- break;
-
- case PRETTYPRINTING:
- bDoPrettyPrinting = bTemp;
- bRODoPrettyPrinting = pROStates[nProp];
- break;
-
- case WARNALIENFORMAT:
- bWarnAlienFormat = bTemp;
- bROWarnAlienFormat = pROStates[nProp];
- break;
-
- case LOADDOCPRINTER:
- bLoadDocPrinter = bTemp;
- bROLoadDocPrinter = pROStates[nProp];
- break;
-
- default :
- DBG_ERRORFILE( "invalid index to load a path" );
- }
- }
- else
- {
- DBG_ERROR( "Wrong Type!" );
- }
- }
- }
- }
- }
- }
-
- try
- {
- css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig(
- ::utl::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
- ::comphelper::ConfigurationHelper::E_READONLY);
-
- ::comphelper::ConfigurationHelper::readRelativeKey(
- xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("Enabled")) >>= bAutoSave;
-
- ::comphelper::ConfigurationHelper::readRelativeKey(
- xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("TimeIntervall")) >>= nAutoSaveTime;
- }
- catch(const css::uno::Exception&)
- { DBG_ERROR("Could not find needed informations for AutoSave feature."); }
-}
-
-SvtSaveOptions_Impl::~SvtSaveOptions_Impl()
-{}
-
-void SvtSaveOptions_Impl::Commit()
-{
- Sequence< OUString > aOrgNames = GetPropertyNames();
- OUString* pOrgNames = aOrgNames.getArray();
- sal_Int32 nOrgCount = aOrgNames.getLength();
-
- Sequence< OUString > aNames( nOrgCount );
- Sequence< Any > aValues( nOrgCount );
- OUString* pNames = aNames.getArray();
- Any* pValues = aValues.getArray();
- sal_Int32 nRealCount = 0;
-
- for (sal_Int32 i=0; i<nOrgCount; ++i)
- {
- switch (i)
- {
- case FORMAT:
- // not supported anymore
- break;
- case TIMEINTERVALL :
- if (!bROAutoSaveTime)
- {
- pValues[nRealCount] <<= nAutoSaveTime;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case USEUSERDATA :
- if (!bROUseUserData)
- {
- pValues[nRealCount] <<= bUseUserData;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case CREATEBACKUP :
- if (!bROBackup)
- {
- pValues[nRealCount] <<= bBackup;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case AUTOSAVE :
- if (!bROAutoSave)
- {
- pValues[nRealCount] <<= bAutoSave;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case PROMPT :
- if (!bROAutoSavePrompt)
- {
- pValues[nRealCount] <<= bAutoSavePrompt;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case EDITPROPERTY :
- if (!bRODocInfSave)
- {
- pValues[nRealCount] <<= bDocInfSave;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case SAVEWORKINGSET :
- if (!bROSaveWorkingSet)
- {
- pValues[nRealCount] <<= bSaveWorkingSet;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case SAVEDOCWINS :
- if (!bROSaveDocWins)
- {
- pValues[nRealCount] <<= bSaveDocWins;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case SAVEVIEWINFO :
- if (!bROSaveDocView)
- {
- pValues[nRealCount] <<= bSaveDocView;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case FILESYSTEM :
- if (!bROSaveRelFSys)
- {
- pValues[nRealCount] <<= bSaveRelFSys;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case INTERNET :
- if (!bROSaveRelINet)
- {
- pValues[nRealCount] <<= bSaveRelINet;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case UNPACKED :
- if (!bROSaveUnpacked)
- {
- pValues[nRealCount] <<= bSaveUnpacked;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case PRETTYPRINTING:
- if (!bRODoPrettyPrinting)
- {
- pValues[nRealCount] <<= bDoPrettyPrinting;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case WARNALIENFORMAT:
- if (!bROWarnAlienFormat)
- {
- pValues[nRealCount] <<= bWarnAlienFormat;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case LOADDOCPRINTER:
- if (!bROLoadDocPrinter)
- {
- pValues[nRealCount] <<= bLoadDocPrinter;
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- case ODFDEFAULTVERSION:
- if (!bROODFDefaultVersion)
- {
- pValues[nRealCount] <<= (eODFDefaultVersion == SvtSaveOptions::ODFVER_LATEST) ? sal_Int16( 3 ) : sal_Int16( eODFDefaultVersion );
- pNames[nRealCount] = pOrgNames[i];
- ++nRealCount;
- }
- break;
- default:
- DBG_ERRORFILE( "invalid index to save a path" );
- }
- }
-
- aNames.realloc(nRealCount);
- aValues.realloc(nRealCount);
- PutProperties( aNames, aValues );
-
- css::uno::Reference< css::uno::XInterface > xCFG = ::comphelper::ConfigurationHelper::openConfig(
- ::utl::getProcessServiceFactory(),
- ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
- ::comphelper::ConfigurationHelper::E_STANDARD);
-
- ::comphelper::ConfigurationHelper::writeRelativeKey(
- xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("TimeIntervall"),
- css::uno::makeAny(nAutoSaveTime));
-
- ::comphelper::ConfigurationHelper::writeRelativeKey(
- xCFG,
- ::rtl::OUString::createFromAscii("AutoSave"),
- ::rtl::OUString::createFromAscii("Enabled"),
- css::uno::makeAny(bAutoSave));
-
- ::comphelper::ConfigurationHelper::flush(xCFG);
-}
-
-// -----------------------------------------------------------------------
-
-void SvtSaveOptions_Impl::Notify( const Sequence<rtl::OUString>& )
-{
-}
-
-
-class SvtLoadOptions_Impl : public utl::ConfigItem
-{
-
- sal_Bool bLoadUserDefinedSettings;
-
-public:
- SvtLoadOptions_Impl();
- ~SvtLoadOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
- void SetLoadUserSettings(sal_Bool b){bLoadUserDefinedSettings = b; SetModified();}
- sal_Bool IsLoadUserSettings() const {return bLoadUserDefinedSettings;}
-};
-// -----------------------------------------------------------------------
-const sal_Char cUserDefinedSettings[] = "UserDefinedSettings";
-
-SvtLoadOptions_Impl::SvtLoadOptions_Impl()
- : ConfigItem( OUString::createFromAscii("Office.Common/Load") )
- , bLoadUserDefinedSettings( sal_False )
-{
- Sequence< OUString > aNames(1);
- aNames[0] = OUString::createFromAscii(cUserDefinedSettings);
- Sequence< Any > aValues = GetProperties( aNames );
- EnableNotification( aNames );
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- if (pValues[0].getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN)
- bLoadUserDefinedSettings = *(sal_Bool *)pValues[0].getValue();
-}
-// -----------------------------------------------------------------------
-SvtLoadOptions_Impl::~SvtLoadOptions_Impl()
-{
-}
-// -----------------------------------------------------------------------
-void SvtLoadOptions_Impl::Commit()
-{
- Sequence< OUString > aNames(1);
- aNames[0] = OUString::createFromAscii(cUserDefinedSettings);
- Sequence< Any > aValues( 1 );
- aValues[0].setValue(&bLoadUserDefinedSettings, ::getBooleanCppuType());
- PutProperties( aNames, aValues );
-}
-// -----------------------------------------------------------------------
-void SvtLoadOptions_Impl::Notify( const Sequence<rtl::OUString>& )
-{
- DBG_ERRORFILE( "properties have been changed" );
-}
-// -----------------------------------------------------------------------
-
-namespace
-{
- class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
- {
- };
-}
-
-// -----------------------------------------------------------------------
-SvtSaveOptions::SvtSaveOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( LocalSingleton::get() );
- if ( !pOptions )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSaveOptions_Impl::ctor()");
- pOptions = new SvtLoadSaveOptions_Impl;
- pOptions->pSaveOpt = new SvtSaveOptions_Impl;
- pOptions->pLoadOpt = new SvtLoadOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_SAVEOPTIONS);
- }
- ++nRefCount;
- pImp = pOptions;
-}
-
-// -----------------------------------------------------------------------
-
-SvtSaveOptions::~SvtSaveOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( LocalSingleton::get() );
- if ( !--nRefCount )
- {
- if ( pOptions->pSaveOpt->IsModified() )
- pOptions->pSaveOpt->Commit();
- if ( pOptions->pLoadOpt->IsModified() )
- pOptions->pLoadOpt->Commit();
-
- DELETEZ( pOptions->pLoadOpt );
- DELETEZ( pOptions->pSaveOpt );
- DELETEZ( pOptions );
- }
-}
-
-void SvtSaveOptions::SetAutoSaveTime( sal_Int32 n )
-{
- pImp->pSaveOpt->SetAutoSaveTime( n );
-}
-
-sal_Int32 SvtSaveOptions::GetAutoSaveTime() const
-{
- return pImp->pSaveOpt->GetAutoSaveTime();
-}
-
-void SvtSaveOptions::SetUseUserData( sal_Bool b )
-{
- pImp->pSaveOpt->SetUseUserData( b );
-}
-
-sal_Bool SvtSaveOptions::IsUseUserData() const
-{
- return pImp->pSaveOpt->IsUseUserData();
-}
-
-void SvtSaveOptions::SetBackup( sal_Bool b )
-{
- pImp->pSaveOpt->SetBackup( b );
-}
-
-sal_Bool SvtSaveOptions::IsBackup() const
-{
- return pImp->pSaveOpt->IsBackup();
-}
-
-void SvtSaveOptions::SetAutoSave( sal_Bool b )
-{
- pImp->pSaveOpt->SetAutoSave( b );
-}
-
-sal_Bool SvtSaveOptions::IsAutoSave() const
-{
- return pImp->pSaveOpt->IsAutoSave();
-}
-
-void SvtSaveOptions::SetAutoSavePrompt( sal_Bool b )
-{
- pImp->pSaveOpt->SetAutoSavePrompt( b );
-}
-
-sal_Bool SvtSaveOptions::IsAutoSavePrompt() const
-{
- return pImp->pSaveOpt->IsAutoSavePrompt();
-}
-
-void SvtSaveOptions::SetDocInfoSave(sal_Bool b)
-{
- pImp->pSaveOpt->SetDocInfoSave( b );
-}
-
-sal_Bool SvtSaveOptions::IsDocInfoSave() const
-{
- return pImp->pSaveOpt->IsDocInfoSave();
-}
-
-void SvtSaveOptions::SetSaveWorkingSet( sal_Bool b )
-{
- pImp->pSaveOpt->SetSaveWorkingSet( b );
-}
-
-sal_Bool SvtSaveOptions::IsSaveWorkingSet() const
-{
- return pImp->pSaveOpt->IsSaveWorkingSet();
-}
-
-void SvtSaveOptions::SetSaveDocWins( sal_Bool b )
-{
- pImp->pSaveOpt->SetSaveDocWins( b );
-}
-
-sal_Bool SvtSaveOptions::IsSaveDocWins() const
-{
- return pImp->pSaveOpt->IsSaveDocWins();
-}
-
-void SvtSaveOptions::SetSaveDocView( sal_Bool b )
-{
- pImp->pSaveOpt->SetSaveDocView( b );
-}
-
-sal_Bool SvtSaveOptions::IsSaveDocView() const
-{
- return pImp->pSaveOpt->IsSaveDocView();
-}
-
-void SvtSaveOptions::SetSaveRelINet( sal_Bool b )
-{
- pImp->pSaveOpt->SetSaveRelINet( b );
-}
-
-sal_Bool SvtSaveOptions::IsSaveRelINet() const
-{
- return pImp->pSaveOpt->IsSaveRelINet();
-}
-
-void SvtSaveOptions::SetSaveRelFSys( sal_Bool b )
-{
- pImp->pSaveOpt->SetSaveRelFSys( b );
-}
-
-sal_Bool SvtSaveOptions::IsSaveRelFSys() const
-{
- return pImp->pSaveOpt->IsSaveRelFSys();
-}
-
-void SvtSaveOptions::SetSaveUnpacked( sal_Bool b )
-{
- pImp->pSaveOpt->SetSaveUnpacked( b );
-}
-
-sal_Bool SvtSaveOptions::IsSaveUnpacked() const
-{
- return pImp->pSaveOpt->IsSaveUnpacked();
-}
-
-void SvtSaveOptions::SetLoadUserSettings(sal_Bool b)
-{
- pImp->pLoadOpt->SetLoadUserSettings(b);
-}
-
-sal_Bool SvtSaveOptions::IsLoadUserSettings() const
-{
- return pImp->pLoadOpt->IsLoadUserSettings();
-}
-
-void SvtSaveOptions::SetPrettyPrinting( sal_Bool _bEnable )
-{
- pImp->pSaveOpt->EnablePrettyPrinting( _bEnable );
-}
-
-sal_Bool SvtSaveOptions::IsPrettyPrinting() const
-{
- return pImp->pSaveOpt->IsPrettyPrintingEnabled();
-}
-
-void SvtSaveOptions::SetWarnAlienFormat( sal_Bool _bEnable )
-{
- pImp->pSaveOpt->SetWarnAlienFormat( _bEnable );
-}
-
-sal_Bool SvtSaveOptions::IsWarnAlienFormat() const
-{
- return pImp->pSaveOpt->IsWarnAlienFormat();
-}
-
-void SvtSaveOptions::SetLoadDocumentPrinter( sal_Bool _bEnable )
-{
- pImp->pSaveOpt->SetLoadDocPrinter( _bEnable );
-}
-
-sal_Bool SvtSaveOptions::IsLoadDocumentPrinter() const
-{
- return pImp->pSaveOpt->IsLoadDocPrinter();
-}
-
-void SvtSaveOptions::SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion eVersion )
-{
- pImp->pSaveOpt->SetODFDefaultVersion( eVersion );
-}
-
-SvtSaveOptions::ODFDefaultVersion SvtSaveOptions::GetODFDefaultVersion() const
-{
- return pImp->pSaveOpt->GetODFDefaultVersion();
-}
-
-sal_Bool SvtSaveOptions::IsReadOnly( SvtSaveOptions::EOption eOption ) const
-{
- return pImp->pSaveOpt->IsReadOnly(eOption);
-}
-
diff --git a/svtools/source/config/searchopt.cxx b/svtools/source/config/searchopt.cxx
deleted file mode 100644
index 261edf4d0f1e..000000000000
--- a/svtools/source/config/searchopt.cxx
+++ /dev/null
@@ -1,634 +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: searchopt.cxx,v $
- * $Revision: 1.13 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include "searchopt.hxx"
-#include <tools/solar.h>
-#include <tools/debug.hxx>
-#include <unotools/configitem.hxx>
-#include <com/sun/star/i18n/TransliterationModules.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Any.h>
-#include <rtl/logfile.hxx>
-
-
-using namespace rtl;
-using namespace utl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::i18n;
-
-#define MAX_FLAGS_OFFSET 25
-
-//////////////////////////////////////////////////////////////////////
-
-
-class SvtSearchOptions_Impl : public ConfigItem
-{
- INT32 nFlags;
- BOOL bModified;
-
- // disallow copy-constructor and assignment-operator for now
- SvtSearchOptions_Impl( const SvtSearchOptions_Impl & );
- SvtSearchOptions_Impl & operator = ( const SvtSearchOptions_Impl & );
-
-protected:
- BOOL IsModified() const { return bModified; }
- using ConfigItem::SetModified;
- void SetModified( BOOL bVal );
- BOOL Load();
- BOOL Save();
-
- Sequence< OUString > GetPropertyNames() const;
-
-public:
- SvtSearchOptions_Impl();
- virtual ~SvtSearchOptions_Impl();
-
- // ConfigItem
- virtual void Commit();
-
- BOOL GetFlag( USHORT nOffset ) const;
- void SetFlag( USHORT nOffset, BOOL bVal );
-};
-
-
-
-SvtSearchOptions_Impl::SvtSearchOptions_Impl() :
- ConfigItem( OUString::createFromAscii( "Office.Common/SearchOptions" ) )
-{
- RTL_LOGFILE_CONTEXT(aLog, "svtools SvtSearchOptions_Impl::SvtSearchOptions_Impl()");
- nFlags = 0x0003FFFF; // set all options values to 'true'
- Load();
- SetModified( FALSE );
-}
-
-
-SvtSearchOptions_Impl::~SvtSearchOptions_Impl()
-{
- Commit();
-}
-
-
-void SvtSearchOptions_Impl::Commit()
-{
- if (IsModified())
- Save();
-}
-
-
-BOOL SvtSearchOptions_Impl::GetFlag( USHORT nOffset ) const
-{
- DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range");
- return ((nFlags >> nOffset) & 0x01) ? TRUE : FALSE;
-}
-
-
-void SvtSearchOptions_Impl::SetFlag( USHORT nOffset, BOOL bVal )
-{
- DBG_ASSERT( nOffset <= MAX_FLAGS_OFFSET, "offset out of range");
- INT32 nOldFlags = nFlags;
- INT32 nMask = ((INT32) 1) << nOffset;
- if (bVal)
- nFlags |= nMask;
- else
- nFlags &= ~nMask;
- if (nFlags != nOldFlags)
- SetModified( TRUE );
-}
-
-
-void SvtSearchOptions_Impl::SetModified( BOOL bVal )
-{
- bModified = bVal;
- if (bModified)
- {
- ConfigItem::SetModified();
- }
-}
-
-
-Sequence< OUString > SvtSearchOptions_Impl::GetPropertyNames() const
-{
- static const char* aPropNames[ MAX_FLAGS_OFFSET + 1 ] =
- {
- "IsWholeWordsOnly", // 0
- "IsBackwards", // 1
- "IsUseRegularExpression", // 2
- //"IsCurrentSelectionOnly", // interactively set or not...
- "IsSearchForStyles", // 3
- "IsSimilaritySearch", // 4
- "IsUseAsianOptions", // 5
- "IsMatchCase", // 6
- "Japanese/IsMatchFullHalfWidthForms", // 7
- "Japanese/IsMatchHiraganaKatakana", // 8
- "Japanese/IsMatchContractions", // 9
- "Japanese/IsMatchMinusDashCho-on", // 10
- "Japanese/IsMatchRepeatCharMarks", // 11
- "Japanese/IsMatchVariantFormKanji", // 12
- "Japanese/IsMatchOldKanaForms", // 13
- "Japanese/IsMatch_DiZi_DuZu", // 14
- "Japanese/IsMatch_BaVa_HaFa", // 15
- "Japanese/IsMatch_TsiThiChi_DhiZi", // 16
- "Japanese/IsMatch_HyuIyu_ByuVyu", // 17
- "Japanese/IsMatch_SeShe_ZeJe", // 18
- "Japanese/IsMatch_IaIya", // 19
- "Japanese/IsMatch_KiKu", // 20
- "Japanese/IsIgnorePunctuation", // 21
- "Japanese/IsIgnoreWhitespace", // 22
- "Japanese/IsIgnoreProlongedSoundMark", // 23
- "Japanese/IsIgnoreMiddleDot", // 24
- "IsNotes" // 25
- };
-
- const int nCount = sizeof( aPropNames ) / sizeof( aPropNames[0] );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for (INT32 i = 0; i < nCount; ++i)
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
-
- return aNames;
-}
-
-
-BOOL SvtSearchOptions_Impl::Load()
-{
- BOOL bSucc = FALSE;
-
- Sequence< OUString > aNames = GetPropertyNames();
- INT32 nProps = aNames.getLength();
-
- const Sequence< Any > aValues = GetProperties( aNames );
- DBG_ASSERT( aValues.getLength() == aNames.getLength(),
- "GetProperties failed" );
- //EnableNotification( aNames );
-
- if (nProps && aValues.getLength() == nProps)
- {
- bSucc = TRUE;
-
- const Any* pValues = aValues.getConstArray();
- for (USHORT i = 0; i < nProps; ++i)
- {
- const Any &rVal = pValues[i];
- DBG_ASSERT( rVal.hasValue(), "property value missing" );
- if (rVal.hasValue())
- {
- BOOL bVal = BOOL();
- if (rVal >>= bVal)
- {
- if (i <= MAX_FLAGS_OFFSET)
- {
- // use index in sequence as flag index
- SetFlag( i, bVal );
- }
- else {
- DBG_ERROR( "unexpected index" );
- }
- }
- else
- {
- DBG_ERROR( "unexpected type" );
- bSucc = FALSE;
- }
- }
- else
- {
- DBG_ERROR( "value missing" );
- bSucc = FALSE;
- }
- }
- }
- DBG_ASSERT( bSucc, "LoadConfig failed" );
-
- return bSucc;
-}
-
-
-BOOL SvtSearchOptions_Impl::Save()
-{
- BOOL bSucc = FALSE;
-
- const Sequence< OUString > aNames = GetPropertyNames();
- INT32 nProps = aNames.getLength();
-
- Sequence< Any > aValues( nProps );
- Any *pValue = aValues.getArray();
-
- DBG_ASSERT( nProps == MAX_FLAGS_OFFSET + 1,
- "unexpected size of index" );
- if (nProps && nProps == MAX_FLAGS_OFFSET + 1)
- {
- for (USHORT i = 0; i < nProps; ++i)
- pValue[i] <<= (BOOL) GetFlag(i);
- bSucc |= PutProperties( aNames, aValues );
- }
-
- if (bSucc)
- SetModified( FALSE );
-
- return bSucc;
-}
-
-
-//////////////////////////////////////////////////////////////////////
-
-SvtSearchOptions::SvtSearchOptions()
-{
- pImpl = new SvtSearchOptions_Impl;
-}
-
-
-SvtSearchOptions::~SvtSearchOptions()
-{
- delete pImpl;
-}
-
-
-INT32 SvtSearchOptions::GetTransliterationFlags() const
-{
- INT32 nRes = 0;
-
- if (!IsMatchCase()) // 'IsMatchCase' means act case sensitive
- nRes |= TransliterationModules_IGNORE_CASE;
- if ( IsMatchFullHalfWidthForms())
- nRes |= TransliterationModules_IGNORE_WIDTH;
- if ( IsMatchHiraganaKatakana())
- nRes |= TransliterationModules_IGNORE_KANA;
- if ( IsMatchContractions())
- nRes |= TransliterationModules_ignoreSize_ja_JP;
- if ( IsMatchMinusDashChoon())
- nRes |= TransliterationModules_ignoreMinusSign_ja_JP;
- if ( IsMatchRepeatCharMarks())
- nRes |= TransliterationModules_ignoreIterationMark_ja_JP;
- if ( IsMatchVariantFormKanji())
- nRes |= TransliterationModules_ignoreTraditionalKanji_ja_JP;
- if ( IsMatchOldKanaForms())
- nRes |= TransliterationModules_ignoreTraditionalKana_ja_JP;
- if ( IsMatchDiziDuzu())
- nRes |= TransliterationModules_ignoreZiZu_ja_JP;
- if ( IsMatchBavaHafa())
- nRes |= TransliterationModules_ignoreBaFa_ja_JP;
- if ( IsMatchTsithichiDhizi())
- nRes |= TransliterationModules_ignoreTiJi_ja_JP;
- if ( IsMatchHyuiyuByuvyu())
- nRes |= TransliterationModules_ignoreHyuByu_ja_JP;
- if ( IsMatchSesheZeje())
- nRes |= TransliterationModules_ignoreSeZe_ja_JP;
- if ( IsMatchIaiya())
- nRes |= TransliterationModules_ignoreIandEfollowedByYa_ja_JP;
- if ( IsMatchKiku())
- nRes |= TransliterationModules_ignoreKiKuFollowedBySa_ja_JP;
- if ( IsIgnorePunctuation())
- nRes |= TransliterationModules_ignoreSeparator_ja_JP;
- if ( IsIgnoreWhitespace())
- nRes |= TransliterationModules_ignoreSpace_ja_JP;
- if ( IsIgnoreProlongedSoundMark())
- nRes |= TransliterationModules_ignoreProlongedSoundMark_ja_JP;
- if ( IsIgnoreMiddleDot())
- nRes |= TransliterationModules_ignoreMiddleDot_ja_JP;
-
- return nRes;
-}
-
-
-BOOL SvtSearchOptions::IsWholeWordsOnly() const
-{
- return pImpl->GetFlag( 0 );
-}
-
-
-void SvtSearchOptions::SetWholeWordsOnly( BOOL bVal )
-{
- pImpl->SetFlag( 0, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsBackwards() const
-{
- return pImpl->GetFlag( 1 );
-}
-
-
-void SvtSearchOptions::SetBackwards( BOOL bVal )
-{
- pImpl->SetFlag( 1, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsUseRegularExpression() const
-{
- return pImpl->GetFlag( 2 );
-}
-
-
-void SvtSearchOptions::SetUseRegularExpression( BOOL bVal )
-{
- pImpl->SetFlag( 2, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsSearchForStyles() const
-{
- return pImpl->GetFlag( 3 );
-}
-
-
-void SvtSearchOptions::SetSearchForStyles( BOOL bVal )
-{
- pImpl->SetFlag( 3, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsSimilaritySearch() const
-{
- return pImpl->GetFlag( 4 );
-}
-
-
-void SvtSearchOptions::SetSimilaritySearch( BOOL bVal )
-{
- pImpl->SetFlag( 4, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsUseAsianOptions() const
-{
- return pImpl->GetFlag( 5 );
-}
-
-
-void SvtSearchOptions::SetUseAsianOptions( BOOL bVal )
-{
- pImpl->SetFlag( 5, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchCase() const
-{
- return pImpl->GetFlag( 6 );
-}
-
-
-void SvtSearchOptions::SetMatchCase( BOOL bVal )
-{
- pImpl->SetFlag( 6, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchFullHalfWidthForms() const
-{
- return pImpl->GetFlag( 7 );
-}
-
-
-void SvtSearchOptions::SetMatchFullHalfWidthForms( BOOL bVal )
-{
- pImpl->SetFlag( 7, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchHiraganaKatakana() const
-{
- return pImpl->GetFlag( 8 );
-}
-
-
-void SvtSearchOptions::SetMatchHiraganaKatakana( BOOL bVal )
-{
- pImpl->SetFlag( 8, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchContractions() const
-{
- return pImpl->GetFlag( 9 );
-}
-
-
-void SvtSearchOptions::SetMatchContractions( BOOL bVal )
-{
- pImpl->SetFlag( 9, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchMinusDashChoon() const
-{
- return pImpl->GetFlag( 10 );
-}
-
-
-void SvtSearchOptions::SetMatchMinusDashChoon( BOOL bVal )
-{
- pImpl->SetFlag( 10, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchRepeatCharMarks() const
-{
- return pImpl->GetFlag( 11 );
-}
-
-
-void SvtSearchOptions::SetMatchRepeatCharMarks( BOOL bVal )
-{
- pImpl->SetFlag( 11, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchVariantFormKanji() const
-{
- return pImpl->GetFlag( 12 );
-}
-
-
-void SvtSearchOptions::SetMatchVariantFormKanji( BOOL bVal )
-{
- pImpl->SetFlag( 12, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchOldKanaForms() const
-{
- return pImpl->GetFlag( 13 );
-}
-
-
-void SvtSearchOptions::SetMatchOldKanaForms( BOOL bVal )
-{
- pImpl->SetFlag( 13, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchDiziDuzu() const
-{
- return pImpl->GetFlag( 14 );
-}
-
-
-void SvtSearchOptions::SetMatchDiziDuzu( BOOL bVal )
-{
- pImpl->SetFlag( 14, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchBavaHafa() const
-{
- return pImpl->GetFlag( 15 );
-}
-
-
-void SvtSearchOptions::SetMatchBavaHafa( BOOL bVal )
-{
- pImpl->SetFlag( 15, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchTsithichiDhizi() const
-{
- return pImpl->GetFlag( 16 );
-}
-
-
-void SvtSearchOptions::SetMatchTsithichiDhizi( BOOL bVal )
-{
- pImpl->SetFlag( 16, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchHyuiyuByuvyu() const
-{
- return pImpl->GetFlag( 17 );
-}
-
-
-void SvtSearchOptions::SetMatchHyuiyuByuvyu( BOOL bVal )
-{
- pImpl->SetFlag( 17, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchSesheZeje() const
-{
- return pImpl->GetFlag( 18 );
-}
-
-
-void SvtSearchOptions::SetMatchSesheZeje( BOOL bVal )
-{
- pImpl->SetFlag( 18, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchIaiya() const
-{
- return pImpl->GetFlag( 19 );
-}
-
-
-void SvtSearchOptions::SetMatchIaiya( BOOL bVal )
-{
- pImpl->SetFlag( 19, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsMatchKiku() const
-{
- return pImpl->GetFlag( 20 );
-}
-
-
-void SvtSearchOptions::SetMatchKiku( BOOL bVal )
-{
- pImpl->SetFlag( 20, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsIgnorePunctuation() const
-{
- return pImpl->GetFlag( 21 );
-}
-
-
-void SvtSearchOptions::SetIgnorePunctuation( BOOL bVal )
-{
- pImpl->SetFlag( 21, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsIgnoreWhitespace() const
-{
- return pImpl->GetFlag( 22 );
-}
-
-
-void SvtSearchOptions::SetIgnoreWhitespace( BOOL bVal )
-{
- pImpl->SetFlag( 22, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsIgnoreProlongedSoundMark() const
-{
- return pImpl->GetFlag( 23 );
-}
-
-
-void SvtSearchOptions::SetIgnoreProlongedSoundMark( BOOL bVal )
-{
- pImpl->SetFlag( 23, bVal );
-}
-
-
-BOOL SvtSearchOptions::IsIgnoreMiddleDot() const
-{
- return pImpl->GetFlag( 24 );
-}
-
-
-void SvtSearchOptions::SetIgnoreMiddleDot( BOOL bVal )
-{
- pImpl->SetFlag( 24, bVal );
-}
-
-BOOL SvtSearchOptions::IsNotes() const
-{
- return pImpl->GetFlag( 25 );
-}
-
-
-void SvtSearchOptions::SetNotes( BOOL bVal )
-{
- pImpl->SetFlag( 25, bVal );
-}
-
-//////////////////////////////////////////////////////////////////////
-
diff --git a/svtools/source/config/securityoptions.cxx b/svtools/source/config/securityoptions.cxx
deleted file mode 100644
index 8fbc9008d51e..000000000000
--- a/svtools/source/config/securityoptions.cxx
+++ /dev/null
@@ -1,1312 +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: securityoptions.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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/securityoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <tools/urlobj.hxx>
-#include <tools/wldcrd.hxx>
-
-#include <svtools/pathoptions.hxx>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_SECURITY OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Security/Scripting"))
-#define DEFAULT_SECUREURL Sequence< OUString >()
-#define DEFAULT_SECLEVEL 3
-#define DEFAULT_TRUSTEDAUTHORS Sequence< SvtSecurityOptions::Certificate >()
-
-// xmlsec05 depricated
-#define DEFAULT_STAROFFICEBASIC eALWAYS_EXECUTE
-
-#define CSTR_SECUREURL "SecureURL"
-#define CSTR_DOCWARN_SAVEORSEND "WarnSaveOrSendDoc"
-#define CSTR_DOCWARN_SIGNING "WarnSignDoc"
-#define CSTR_DOCWARN_PRINT "WarnPrintDoc"
-#define CSTR_DOCWARN_CREATEPDF "WarnCreatePDF"
-#define CSTR_DOCWARN_REMOVEPERSONALINFO "RemovePersonalInfoOnSaving"
-#define CSTR_DOCWARN_RECOMMENDPASSWORD "RecommendPasswordProtection"
-#define CSTR_CTRLCLICK_HYPERLINK "HyperlinksWithCtrlClick"
-#define CSTR_MACRO_SECLEVEL "MacroSecurityLevel"
-#define CSTR_MACRO_TRUSTEDAUTHORS "TrustedAuthors"
-#define CSTR_MACRO_DISABLE "DisableMacrosExecution"
-#define CSTR_TRUSTEDAUTHOR_SUBJECTNAME "SubjectName"
-#define CSTR_TRUSTEDAUTHOR_SERIALNUMBER "SerialNumber"
-#define CSTR_TRUSTEDAUTHOR_RAWDATA "RawData"
-
-#define PROPERTYNAME_SECUREURL OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_SECUREURL ))
-#define PROPERTYNAME_DOCWARN_SAVEORSEND OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SAVEORSEND ))
-#define PROPERTYNAME_DOCWARN_SIGNING OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_SIGNING ))
-#define PROPERTYNAME_DOCWARN_PRINT OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_PRINT ))
-#define PROPERTYNAME_DOCWARN_CREATEPDF OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_CREATEPDF ))
-#define PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_REMOVEPERSONALINFO ))
-#define PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_DOCWARN_RECOMMENDPASSWORD ))
-#define PROPERTYNAME_CTRLCLICK_HYPERLINK OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_CTRLCLICK_HYPERLINK ))
-#define PROPERTYNAME_MACRO_SECLEVEL OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_SECLEVEL ))
-#define PROPERTYNAME_MACRO_TRUSTEDAUTHORS OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_TRUSTEDAUTHORS ))
-#define PROPERTYNAME_MACRO_DISABLE OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_MACRO_DISABLE ))
-#define PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SUBJECTNAME))
-#define PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_SERIALNUMBER))
-#define PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA OUString(RTL_CONSTASCII_USTRINGPARAM(CSTR_TRUSTEDAUTHOR_RAWDATA))
-
-// xmlsec05 depricated
-#define PROPERTYNAME_STAROFFICEBASIC OUString(RTL_CONSTASCII_USTRINGPARAM("OfficeBasic" ))
-#define PROPERTYNAME_EXECUTEPLUGINS OUString(RTL_CONSTASCII_USTRINGPARAM("ExecutePlugins" ))
-#define PROPERTYNAME_WARNINGENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Warning" ))
-#define PROPERTYNAME_CONFIRMATIONENABLED OUString(RTL_CONSTASCII_USTRINGPARAM("Confirmation" ))
-// xmlsec05 depricated
-
-
-#define PROPERTYHANDLE_SECUREURL 0
-
-// xmlsec05 depricated
-#define PROPERTYHANDLE_STAROFFICEBASIC 1
-#define PROPERTYHANDLE_EXECUTEPLUGINS 2
-#define PROPERTYHANDLE_WARNINGENABLED 3
-#define PROPERTYHANDLE_CONFIRMATIONENABLED 4
-// xmlsec05 depricated
-
-#define PROPERTYHANDLE_DOCWARN_SAVEORSEND 5
-#define PROPERTYHANDLE_DOCWARN_SIGNING 6
-#define PROPERTYHANDLE_DOCWARN_PRINT 7
-#define PROPERTYHANDLE_DOCWARN_CREATEPDF 8
-#define PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO 9
-#define PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD 10
-#define PROPERTYHANDLE_CTRLCLICK_HYPERLINK 11
-#define PROPERTYHANDLE_MACRO_SECLEVEL 12
-#define PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS 13
-#define PROPERTYHANDLE_MACRO_DISABLE 14
-
-#define PROPERTYCOUNT 15
-#define PROPERTYHANDLE_INVALID -1
-
-#define CFG_READONLY_DEFAULT sal_False
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-class SvtSecurityOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtSecurityOptions_Impl();
- ~SvtSecurityOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- sal_Bool IsReadOnly ( SvtSecurityOptions::EOption eOption ) const ;
-
- Sequence< OUString > GetSecureURLs ( ) const ;
- void SetSecureURLs ( const Sequence< OUString >& seqURLList ) ;
- sal_Bool IsSecureURL ( const OUString& sURL,
- const OUString& sReferer ) const ;
- inline sal_Int32 GetMacroSecurityLevel ( ) const ;
- void SetMacroSecurityLevel ( sal_Int32 _nLevel ) ;
-
- inline sal_Bool IsMacroDisabled ( ) const ;
-
- Sequence< SvtSecurityOptions::Certificate > GetTrustedAuthors ( ) const ;
- void SetTrustedAuthors ( const Sequence< SvtSecurityOptions::Certificate >& rAuthors ) ;
- sal_Bool IsTrustedAuthorsEnabled ( ) ;
-
- sal_Bool IsOptionSet ( SvtSecurityOptions::EOption eOption ) const ;
- sal_Bool SetOption ( SvtSecurityOptions::EOption eOption, sal_Bool bValue ) ;
- sal_Bool IsOptionEnabled ( SvtSecurityOptions::EOption eOption ) const ;
-private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent our module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management.
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- void SetProperty( sal_Int32 nHandle, const Any& rValue, sal_Bool bReadOnly );
- void LoadAuthors( void );
- static sal_Int32 GetHandle( const OUString& rPropertyName );
- bool GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO );
-
- static Sequence< OUString > GetPropertyNames();
-
- Sequence< OUString > m_seqSecureURLs;
- sal_Bool m_bSaveOrSend;
- sal_Bool m_bSigning;
- sal_Bool m_bPrint;
- sal_Bool m_bCreatePDF;
- sal_Bool m_bRemoveInfo;
- sal_Bool m_bRecommendPwd;
- sal_Bool m_bCtrlClickHyperlink;
- sal_Int32 m_nSecLevel;
- Sequence< SvtSecurityOptions::Certificate > m_seqTrustedAuthors;
- sal_Bool m_bDisableMacros;
-
- sal_Bool m_bROSecureURLs;
- sal_Bool m_bROSaveOrSend;
- sal_Bool m_bROSigning;
- sal_Bool m_bROPrint;
- sal_Bool m_bROCreatePDF;
- sal_Bool m_bRORemoveInfo;
- sal_Bool m_bRORecommendPwd;
- sal_Bool m_bROCtrlClickHyperlink;
- sal_Bool m_bROSecLevel;
- sal_Bool m_bROTrustedAuthors;
- sal_Bool m_bRODisableMacros;
-
-
- // xmlsec05 depricated
- EBasicSecurityMode m_eBasicMode;
- sal_Bool m_bExecutePlugins;
- sal_Bool m_bWarning;
- sal_Bool m_bConfirmation;
-
- sal_Bool m_bROConfirmation;
- sal_Bool m_bROWarning;
- sal_Bool m_bROExecutePlugins;
- sal_Bool m_bROBasicMode;
- public:
- sal_Bool IsWarningEnabled() const;
- void SetWarningEnabled( sal_Bool bSet );
- sal_Bool IsConfirmationEnabled() const;
- void SetConfirmationEnabled( sal_Bool bSet );
- sal_Bool IsExecutePlugins() const;
- void SetExecutePlugins( sal_Bool bSet );
- EBasicSecurityMode GetBasicMode ( ) const ;
- void SetBasicMode ( EBasicSecurityMode eMode ) ;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()
- :ConfigItem ( ROOTNODE_SECURITY )
- ,m_seqSecureURLs ( DEFAULT_SECUREURL )
- ,m_bSaveOrSend ( sal_True )
- ,m_bSigning ( sal_True )
- ,m_bPrint ( sal_True )
- ,m_bCreatePDF ( sal_True )
- ,m_bRemoveInfo ( sal_True )
- ,m_nSecLevel ( sal_True )
- ,m_seqTrustedAuthors ( DEFAULT_TRUSTEDAUTHORS )
- ,m_bDisableMacros ( sal_False )
- ,m_bROSecureURLs ( CFG_READONLY_DEFAULT )
- ,m_bROSaveOrSend ( CFG_READONLY_DEFAULT )
- ,m_bROSigning ( CFG_READONLY_DEFAULT )
- ,m_bROPrint ( CFG_READONLY_DEFAULT )
- ,m_bROCreatePDF ( CFG_READONLY_DEFAULT )
- ,m_bRORemoveInfo ( CFG_READONLY_DEFAULT )
- ,m_bROSecLevel ( CFG_READONLY_DEFAULT )
- ,m_bROTrustedAuthors ( CFG_READONLY_DEFAULT )
- ,m_bRODisableMacros ( sal_True ) // currently is not intended to be changed
-
- // xmlsec05 depricated
- , m_eBasicMode ( DEFAULT_STAROFFICEBASIC )
- , m_bExecutePlugins ( sal_True )
- , m_bWarning ( sal_True )
- , m_bConfirmation ( sal_True )
- , m_bROConfirmation ( CFG_READONLY_DEFAULT )
- , m_bROWarning ( CFG_READONLY_DEFAULT )
- , m_bROExecutePlugins ( CFG_READONLY_DEFAULT )
- , m_bROBasicMode ( CFG_READONLY_DEFAULT )
- // xmlsec05 depricated
-
-{
- Sequence< OUString > seqNames = GetPropertyNames ( );
- Sequence< Any > seqValues = GetProperties ( seqNames );
- Sequence< sal_Bool > seqRO = GetReadOnlyStates ( seqNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::SvtSecurityOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to our internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- for( sal_Int32 nProperty = 0 ; nProperty < nPropertyCount ; ++nProperty )
- SetProperty( nProperty, seqValues[ nProperty ], seqRO[ nProperty ] );
-
- LoadAuthors();
-
- // Enable notification mechanism of our baseclass.
- // We need it to get information about changes outside these class on our used configuration keys!*/
-
- EnableNotification( seqNames );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtSecurityOptions_Impl::~SvtSecurityOptions_Impl()
-{
- if( IsModified() )
- Commit();
-}
-
-void SvtSecurityOptions_Impl::SetProperty( sal_Int32 nProperty, const Any& rValue, sal_Bool bRO )
-{
- switch( nProperty )
- {
- case PROPERTYHANDLE_SECUREURL:
- {
- m_seqSecureURLs.realloc( 0 );
- rValue >>= m_seqSecureURLs;
- SvtPathOptions aOpt;
- sal_uInt32 nCount = m_seqSecureURLs.getLength();
- for( sal_uInt32 nItem = 0 ; nItem < nCount ; ++nItem )
- m_seqSecureURLs[ nItem ] = aOpt.SubstituteVariable( m_seqSecureURLs[ nItem ] );
- m_bROSecureURLs = bRO;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_SAVEORSEND:
- {
- rValue >>= m_bSaveOrSend;
- m_bROSaveOrSend = bRO;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_SIGNING:
- {
- rValue >>= m_bSigning;
- m_bROSigning = bRO;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_PRINT:
- {
- rValue >>= m_bPrint;
- m_bROPrint = bRO;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_CREATEPDF:
- {
- rValue >>= m_bCreatePDF;
- m_bROCreatePDF = bRO;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO:
- {
- rValue >>= m_bRemoveInfo;
- m_bRORemoveInfo = bRO;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD:
- {
- rValue >>= m_bRecommendPwd;
- m_bRORecommendPwd = bRO;
- }
- break;
-
- case PROPERTYHANDLE_CTRLCLICK_HYPERLINK:
- {
- rValue >>= m_bCtrlClickHyperlink;
- m_bROCtrlClickHyperlink = bRO;
- }
- break;
-
- case PROPERTYHANDLE_MACRO_SECLEVEL:
- {
- rValue >>= m_nSecLevel;
- m_bROSecLevel = bRO;
- }
- break;
-
- case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS:
- {
- // don't care about value here...
- m_bROTrustedAuthors = bRO;
- }
- break;
-
- case PROPERTYHANDLE_MACRO_DISABLE:
- {
- rValue >>= m_bDisableMacros;
- m_bRODisableMacros = bRO;
- }
- break;
-
-
- // xmlsec05 depricated
- case PROPERTYHANDLE_STAROFFICEBASIC:
- {
- sal_Int32 nMode = 0;
- rValue >>= nMode;
- m_eBasicMode = (EBasicSecurityMode)nMode;
- m_bROBasicMode = bRO;
- }
- break;
- case PROPERTYHANDLE_EXECUTEPLUGINS:
- {
- rValue >>= m_bExecutePlugins;
- m_bROExecutePlugins = bRO;
- }
- break;
- case PROPERTYHANDLE_WARNINGENABLED:
- {
- rValue >>= m_bWarning;
- m_bROWarning = bRO;
- }
- break;
- case PROPERTYHANDLE_CONFIRMATIONENABLED:
- {
- rValue >>= m_bConfirmation;
- m_bROConfirmation = bRO;
- }
- break;
- // xmlsec05 depricated
-
-
- #if OSL_DEBUG_LEVEL > 1
- default:
- DBG_ASSERT( false, "SvtSecurityOptions_Impl::SetProperty()\nUnkown property!\n" );
- #endif
- }
-}
-
-void SvtSecurityOptions_Impl::LoadAuthors( void )
-{
- m_seqTrustedAuthors.realloc( 0 ); // first clear
- Sequence< OUString > lAuthors = GetNodeNames( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
- sal_Int32 c1 = lAuthors.getLength();
- if( c1 )
- {
- sal_Int32 c2 = c1 * 3; // 3 Properties inside Struct TrustedAuthor
- Sequence< OUString > lAllAuthors( c2 );
-
- sal_Int32 i1;
- sal_Int32 i2;
- OUString aSep( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
- for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
- {
- lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME;
- ++i2;
- lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER;
- ++i2;
- lAllAuthors[ i2 ] = PROPERTYNAME_MACRO_TRUSTEDAUTHORS + aSep + lAuthors[ i1 ] + aSep + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA;
- ++i2;
- }
-
- Sequence< Any > lValues = GetProperties( lAllAuthors );
- if( lValues.getLength() == c2 )
- {
- m_seqTrustedAuthors.realloc( c1 );
- SvtSecurityOptions::Certificate aCert( 3 );
- for( i1 = 0, i2 = 0 ; i1 < c1 ; ++i1 )
- {
- lValues[ i2 ] >>= aCert[ 0 ];
- ++i2;
- lValues[ i2 ] >>= aCert[ 1 ];
- ++i2;
- lValues[ i2 ] >>= aCert[ 2 ];
- ++i2;
- m_seqTrustedAuthors[ i1 ] = aCert;
- }
- }
- }
-}
-
-sal_Int32 SvtSecurityOptions_Impl::GetHandle( const OUString& rName )
-{
- sal_Int32 nHandle;
-
- if( rName.compareToAscii( CSTR_SECUREURL ) == 0 )
- nHandle = PROPERTYHANDLE_SECUREURL;
- else if( rName.compareToAscii( CSTR_DOCWARN_SAVEORSEND ) == 0 )
- nHandle = PROPERTYHANDLE_DOCWARN_SAVEORSEND;
- else if( rName.compareToAscii( CSTR_DOCWARN_SIGNING ) == 0 )
- nHandle = PROPERTYHANDLE_DOCWARN_SIGNING;
- else if( rName.compareToAscii( CSTR_DOCWARN_PRINT ) == 0 )
- nHandle = PROPERTYHANDLE_DOCWARN_PRINT;
- else if( rName.compareToAscii( CSTR_DOCWARN_CREATEPDF ) == 0 )
- nHandle = PROPERTYHANDLE_DOCWARN_CREATEPDF;
- else if( rName.compareToAscii( CSTR_DOCWARN_REMOVEPERSONALINFO ) == 0 )
- nHandle = PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO;
- else if( rName.compareToAscii( CSTR_DOCWARN_RECOMMENDPASSWORD ) == 0 )
- nHandle = PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD;
- else if( rName.compareToAscii( CSTR_CTRLCLICK_HYPERLINK ) == 0 )
- nHandle = PROPERTYHANDLE_CTRLCLICK_HYPERLINK;
- else if( rName.compareToAscii( CSTR_MACRO_SECLEVEL ) == 0 )
- nHandle = PROPERTYHANDLE_MACRO_SECLEVEL;
- else if( rName.compareToAscii( CSTR_MACRO_TRUSTEDAUTHORS ) == 0 )
- nHandle = PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS;
- else if( rName.compareToAscii( CSTR_MACRO_DISABLE ) == 0 )
- nHandle = PROPERTYHANDLE_MACRO_DISABLE;
-
- // xmlsec05 depricated
- else if( rName == PROPERTYNAME_STAROFFICEBASIC )
- nHandle = PROPERTYHANDLE_STAROFFICEBASIC;
- else if( rName == PROPERTYNAME_EXECUTEPLUGINS )
- nHandle = PROPERTYHANDLE_EXECUTEPLUGINS;
- else if( rName == PROPERTYNAME_WARNINGENABLED )
- nHandle = PROPERTYHANDLE_WARNINGENABLED;
- else if( rName == PROPERTYNAME_CONFIRMATIONENABLED )
- nHandle = PROPERTYHANDLE_CONFIRMATIONENABLED;
- // xmlsec05 depricated
-
- else
- nHandle = PROPERTYHANDLE_INVALID;
-
- return nHandle;
-}
-
-bool SvtSecurityOptions_Impl::GetOption( SvtSecurityOptions::EOption eOption, sal_Bool*& rpValue, sal_Bool*& rpRO )
-{
- switch( eOption )
- {
- case SvtSecurityOptions::E_DOCWARN_SAVEORSEND:
- rpValue = &m_bSaveOrSend;
- rpRO = &m_bROSaveOrSend;
- break;
- case SvtSecurityOptions::E_DOCWARN_SIGNING:
- rpValue = &m_bSigning;
- rpRO = &m_bROSigning;
- break;
- case SvtSecurityOptions::E_DOCWARN_PRINT:
- rpValue = &m_bPrint;
- rpRO = &m_bROPrint;
- break;
- case SvtSecurityOptions::E_DOCWARN_CREATEPDF:
- rpValue = &m_bCreatePDF;
- rpRO = &m_bROCreatePDF;
- break;
- case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO:
- rpValue = &m_bRemoveInfo;
- rpRO = &m_bRORemoveInfo;
- break;
- case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD:
- rpValue = &m_bRecommendPwd;
- rpRO = &m_bRORecommendPwd;
- break;
- case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK:
- rpValue = &m_bCtrlClickHyperlink;
- rpRO = &m_bROCtrlClickHyperlink;
- break;
- default:
- rpValue = NULL;
- rpRO = NULL;
- break;
- }
-
- return rpValue != NULL;
-}
-
-void SvtSecurityOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
-{
- // Use given list of updated properties to get his values from configuration directly!
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- Sequence< sal_Bool > seqRO = GetReadOnlyStates( seqPropertyNames );
- // Safe impossible cases.
- // We need values from ALL notified configuration keys.
- DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtSecurityOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
- // Step over list of property names and get right value from coreesponding value list to set it on internal members!
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProperty = 0 ; nProperty < nCount ; ++nProperty )
- SetProperty( GetHandle( seqPropertyNames[ nProperty ] ), seqValues[ nProperty ], seqRO[ nProperty ] );
-
- // read set of trusted authors separately
- LoadAuthors();
-}
-
-void SvtSecurityOptions_Impl::Commit()
-{
- // Get names of supported properties, create a list for values and copy current values to it.
- Sequence< OUString > lOrgNames = GetPropertyNames();
- sal_Int32 nOrgCount = lOrgNames.getLength();
-
- Sequence< OUString > lNames(nOrgCount);
- Sequence< Any > lValues(nOrgCount);
- sal_Int32 nRealCount = 0;
- bool bDone;
-
- ClearNodeSet( PROPERTYNAME_MACRO_TRUSTEDAUTHORS );
-
- for( sal_Int32 nProperty = 0 ; nProperty < nOrgCount ; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_SECUREURL:
- {
- bDone = !m_bROSecureURLs;
- if( bDone )
- {
- Sequence< OUString > lURLs( m_seqSecureURLs );
- SvtPathOptions aOpt;
- sal_Int32 nURLsCnt = lURLs.getLength();
- for( sal_Int32 nItem = 0 ; nItem < nURLsCnt ; ++nItem )
- lURLs[ nItem ] = aOpt.UseVariable( lURLs[ nItem ] );
- lValues[ nRealCount ] <<= lURLs;
- }
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_SAVEORSEND:
- {
- bDone = !m_bROSaveOrSend;
- if( bDone )
- lValues[ nRealCount ] <<= m_bSaveOrSend;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_SIGNING:
- {
- bDone = !m_bROSigning;
- if( bDone )
- lValues[ nRealCount ] <<= m_bSigning;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_PRINT:
- {
- bDone = !m_bROPrint;
- if( bDone )
- lValues[ nRealCount ] <<= m_bPrint;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_CREATEPDF:
- {
- bDone = !m_bROCreatePDF;
- if( bDone )
- lValues[ nRealCount ] <<= m_bCreatePDF;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_REMOVEPERSONALINFO:
- {
- bDone = !m_bRORemoveInfo;
- if( bDone )
- lValues[ nRealCount ] <<= m_bRemoveInfo;
- }
- break;
-
- case PROPERTYHANDLE_DOCWARN_RECOMMENDPASSWORD:
- {
- bDone = !m_bRORecommendPwd;
- if( bDone )
- lValues[ nRealCount ] <<= m_bRecommendPwd;
- }
- break;
-
- case PROPERTYHANDLE_CTRLCLICK_HYPERLINK:
- {
- bDone = !m_bROCtrlClickHyperlink;
- if( bDone )
- lValues[ nRealCount ] <<= m_bCtrlClickHyperlink;
- }
- break;
-
- case PROPERTYHANDLE_MACRO_SECLEVEL:
- {
- bDone = !m_bROSecLevel;
- if( bDone )
- lValues[ nRealCount ] <<= m_nSecLevel;
- }
- break;
-
- case PROPERTYHANDLE_MACRO_TRUSTEDAUTHORS:
- {
- bDone = !m_bROTrustedAuthors;
- if( bDone )
- {
- sal_Int32 nCnt = m_seqTrustedAuthors.getLength();
- if( nCnt )
- {
- String s;
- s.AppendAscii( CSTR_MACRO_TRUSTEDAUTHORS );
- s.AppendAscii( "/a" );
-
- Sequence< Sequence< com::sun::star::beans::PropertyValue > > lPropertyValuesSeq( nCnt );
- for( sal_Int32 i = 0 ; i < nCnt ; ++i )
- {
- String aPrefix( s );
- aPrefix += String::CreateFromInt32( i );
- aPrefix.AppendAscii( "/" );
- Sequence< com::sun::star::beans::PropertyValue > lPropertyValues( 3 );
- lPropertyValues[ 0 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SUBJECTNAME;
- lPropertyValues[ 0 ].Value <<= m_seqTrustedAuthors[ i ][0];
- lPropertyValues[ 1 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_SERIALNUMBER;
- lPropertyValues[ 1 ].Value <<= m_seqTrustedAuthors[ i ][1];
- lPropertyValues[ 2 ].Name = aPrefix + PROPERTYNAME_TRUSTEDAUTHOR_RAWDATA;
- lPropertyValues[ 2 ].Value <<= m_seqTrustedAuthors[ i ][2];
-
-
- SetSetProperties( PROPERTYNAME_MACRO_TRUSTEDAUTHORS, lPropertyValues );
- }
-
- bDone = false; // because we save in loop above!
- }
- else
- bDone = false;
- }
- }
- break;
-
- case PROPERTYHANDLE_MACRO_DISABLE:
- {
- bDone = !m_bRODisableMacros;
- if( bDone )
- lValues[ nRealCount ] <<= (sal_Bool)m_bDisableMacros;
- }
- break;
-
-
- // xmlsec05 depricated
- case PROPERTYHANDLE_STAROFFICEBASIC:
- {
- bDone = !m_bROBasicMode;
- if( bDone )
- lValues[ nRealCount ] <<= (sal_Int32)m_eBasicMode;
- }
- break;
- case PROPERTYHANDLE_EXECUTEPLUGINS:
- {
- bDone = !m_bROExecutePlugins;
- if( bDone )
- lValues[ nRealCount ] <<= m_bExecutePlugins;
- }
- break;
- case PROPERTYHANDLE_WARNINGENABLED:
- {
- bDone = !m_bROWarning;
- if( bDone )
- lValues[ nRealCount ] <<= m_bWarning;
- }
- break;
- case PROPERTYHANDLE_CONFIRMATIONENABLED:
- {
- bDone = !m_bROConfirmation;
- if( bDone )
- lValues[ nRealCount ] <<= m_bConfirmation;
- }
- break;
- // xmlsec05 depricated
-
-
- default:
- bDone = false;
- }
-
- if( bDone )
- {
- lNames[ nRealCount ] = lOrgNames[ nProperty ];
- ++nRealCount;
- }
- }
- // Set properties in configuration.
- lNames.realloc(nRealCount);
- lValues.realloc(nRealCount);
- PutProperties( lNames, lValues );
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsReadOnly( SvtSecurityOptions::EOption eOption ) const
-{
- sal_Bool bReadonly;
- switch(eOption)
- {
- case SvtSecurityOptions::E_SECUREURLS :
- bReadonly = m_bROSecureURLs;
- break;
- case SvtSecurityOptions::E_DOCWARN_SAVEORSEND:
- bReadonly = m_bROSaveOrSend;
- break;
- case SvtSecurityOptions::E_DOCWARN_SIGNING:
- bReadonly = m_bROSigning;
- break;
- case SvtSecurityOptions::E_DOCWARN_PRINT:
- bReadonly = m_bROPrint;
- break;
- case SvtSecurityOptions::E_DOCWARN_CREATEPDF:
- bReadonly = m_bROCreatePDF;
- break;
- case SvtSecurityOptions::E_DOCWARN_REMOVEPERSONALINFO:
- bReadonly = m_bRORemoveInfo;
- break;
- case SvtSecurityOptions::E_DOCWARN_RECOMMENDPASSWORD:
- bReadonly = m_bRORecommendPwd;
- break;
- case SvtSecurityOptions::E_MACRO_SECLEVEL:
- bReadonly = m_bROSecLevel;
- break;
- case SvtSecurityOptions::E_MACRO_TRUSTEDAUTHORS:
- bReadonly = m_bROTrustedAuthors;
- break;
- case SvtSecurityOptions::E_MACRO_DISABLE:
- bReadonly = m_bRODisableMacros;
- break;
- case SvtSecurityOptions::E_CTRLCLICK_HYPERLINK:
- bReadonly = m_bROCtrlClickHyperlink;
- break;
-
-
- // xmlsec05 depricated
- case SvtSecurityOptions::E_BASICMODE:
- bReadonly = m_bROBasicMode;
- break;
- case SvtSecurityOptions::E_EXECUTEPLUGINS:
- bReadonly = m_bROExecutePlugins;
- break;
- case SvtSecurityOptions::E_WARNING:
- bReadonly = m_bROWarning;
- break;
- case SvtSecurityOptions::E_CONFIRMATION:
- bReadonly = m_bROConfirmation;
- break;
- // xmlsec05 depricated
-
-
- default:
- bReadonly = sal_True;
- }
-
- return bReadonly;
-}
-
-Sequence< OUString > SvtSecurityOptions_Impl::GetSecureURLs() const
-{
- return m_seqSecureURLs;
-}
-
-void SvtSecurityOptions_Impl::SetSecureURLs( const Sequence< OUString >& seqURLList )
-{
- DBG_ASSERT(!m_bROSecureURLs, "SvtSecurityOptions_Impl::SetSecureURLs()\nYou tried to write on a readonly value!\n");
- if (!m_bROSecureURLs && m_seqSecureURLs!=seqURLList)
- {
- m_seqSecureURLs = seqURLList;
- SetModified();
- }
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsSecureURL( const OUString& sURL ,
- const OUString& sReferer) const
-{
- sal_Bool bState = sal_False;
-
- // Check for uncritical protocols first
- // All protocols different from "macro..." and "slot..." are secure per definition and must not be checked.
- // "macro://#..." means AppBasic macros that are considered safe
- INetURLObject aURL ( sURL );
- INetProtocol aProtocol = aURL.GetProtocol();
-
- // All other URLs must checked in combination with referer and internal information about security
- if ( (aProtocol != INET_PROT_MACRO && aProtocol != INET_PROT_SLOT) ||
- aURL.GetMainURL( INetURLObject::NO_DECODE ).matchIgnoreAsciiCaseAsciiL( "macro:///", 9 ) == 0)
- {
- // security check only for "macro" ( without app basic ) or "slot" protocols
- bState = sal_True;
- }
- else
- {
- // check list of allowed URL patterns
- // Trusted referer given?
- // NO => bState will be false per default
- // YES => search for it in our internal url list
- if( sReferer.getLength() > 0 )
- {
- // Search in internal list
- ::rtl::OUString sRef = sReferer.toAsciiLowerCase();
- sal_uInt32 nCount = m_seqSecureURLs.getLength();
- for( sal_uInt32 nItem=0; nItem<nCount; ++nItem )
- {
- OUString sCheckURL = m_seqSecureURLs[nItem].toAsciiLowerCase();
- sCheckURL += OUString(RTL_CONSTASCII_USTRINGPARAM("*"));
- if( WildCard( sCheckURL ).Matches( sRef ) == sal_True )
- {
- bState = sal_True;
- break;
- }
- }
-
- if ( !bState )
- bState = sRef.compareToAscii("private:user") == COMPARE_EQUAL;
- }
- }
-
- // Return result of operation.
- return bState;
-}
-
-inline sal_Int32 SvtSecurityOptions_Impl::GetMacroSecurityLevel() const
-{
- return m_nSecLevel;
-}
-
-inline sal_Bool SvtSecurityOptions_Impl::IsMacroDisabled() const
-{
- return m_bDisableMacros;
-}
-
-void SvtSecurityOptions_Impl::SetMacroSecurityLevel( sal_Int32 _nLevel )
-{
- if( !m_bROSecLevel )
- {
- if( _nLevel > 3 || _nLevel < 0 )
- _nLevel = 3;
-
- if( m_nSecLevel != _nLevel )
- {
- m_nSecLevel = _nLevel;
- SetModified();
- }
- }
-}
-
-Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions_Impl::GetTrustedAuthors() const
-{
- return m_seqTrustedAuthors;
-}
-
-void SvtSecurityOptions_Impl::SetTrustedAuthors( const Sequence< SvtSecurityOptions::Certificate >& rAuthors )
-{
- DBG_ASSERT(!m_bROTrustedAuthors, "SvtSecurityOptions_Impl::SetTrustedAuthors()\nYou tried to write on a readonly value!\n");
- if( !m_bROTrustedAuthors && rAuthors != m_seqTrustedAuthors )
- {
- m_seqTrustedAuthors = rAuthors;
- SetModified();
- }
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsTrustedAuthorsEnabled()
-{
- return m_bROTrustedAuthors;
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsOptionSet( SvtSecurityOptions::EOption eOption ) const
-{
- sal_Bool* pValue;
- sal_Bool* pRO;
- sal_Bool bRet = sal_False;
-
- if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) )
- bRet = *pValue;
-
- return bRet;
-}
-
-sal_Bool SvtSecurityOptions_Impl::SetOption( SvtSecurityOptions::EOption eOption, sal_Bool bValue )
-{
- sal_Bool* pValue;
- sal_Bool* pRO;
- sal_Bool bRet = sal_False;
-
- if( GetOption( eOption, pValue, pRO ) )
- {
- if( !*pRO )
- {
- bRet = sal_True;
- if( *pValue != bValue )
- {
- *pValue = bValue;
- SetModified();
- }
- }
- }
-
- return bRet;
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsOptionEnabled( SvtSecurityOptions::EOption eOption ) const
-{
- sal_Bool* pValue;
- sal_Bool* pRO;
- sal_Bool bRet = sal_False;
-
- if( ( const_cast< SvtSecurityOptions_Impl* >( this ) )->GetOption( eOption, pValue, pRO ) )
- bRet = !*pRO;
-
- return bRet;
-}
-
-Sequence< OUString > SvtSecurityOptions_Impl::GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_SECUREURL,
- PROPERTYNAME_STAROFFICEBASIC,
- PROPERTYNAME_EXECUTEPLUGINS,
- PROPERTYNAME_WARNINGENABLED,
- PROPERTYNAME_CONFIRMATIONENABLED,
- PROPERTYNAME_DOCWARN_SAVEORSEND,
- PROPERTYNAME_DOCWARN_SIGNING,
- PROPERTYNAME_DOCWARN_PRINT,
- PROPERTYNAME_DOCWARN_CREATEPDF,
- PROPERTYNAME_DOCWARN_REMOVEPERSONALINFO,
- PROPERTYNAME_DOCWARN_RECOMMENDPASSWORD,
- PROPERTYNAME_CTRLCLICK_HYPERLINK,
- PROPERTYNAME_MACRO_SECLEVEL,
- PROPERTYNAME_MACRO_TRUSTEDAUTHORS,
- PROPERTYNAME_MACRO_DISABLE
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtSecurityOptions_Impl* SvtSecurityOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtSecurityOptions::m_nRefCount = 0 ;
-
-SvtSecurityOptions::SvtSecurityOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetInitMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSecurityOptions_Impl::ctor()");
- m_pDataContainer = new SvtSecurityOptions_Impl;
-
- ItemHolder1::holdConfigItem(E_SECURITYOPTIONS);
- }
-}
-
-SvtSecurityOptions::~SvtSecurityOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetInitMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-sal_Bool SvtSecurityOptions::IsReadOnly( EOption eOption ) const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsReadOnly(eOption);
-}
-
-Sequence< OUString > SvtSecurityOptions::GetSecureURLs() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->GetSecureURLs();
-}
-
-void SvtSecurityOptions::SetSecureURLs( const Sequence< OUString >& seqURLList )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetSecureURLs( seqURLList );
-}
-
-sal_Bool SvtSecurityOptions::IsSecureURL( const OUString& sURL ,
- const OUString& sReferer ) const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsSecureURL( sURL, sReferer );
-}
-
-sal_Int32 SvtSecurityOptions::GetMacroSecurityLevel() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->GetMacroSecurityLevel();
-}
-
-void SvtSecurityOptions::SetMacroSecurityLevel( sal_Int32 _nLevel )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetMacroSecurityLevel( _nLevel );
-}
-
-sal_Bool SvtSecurityOptions::IsMacroDisabled() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsMacroDisabled();
-}
-
-Sequence< SvtSecurityOptions::Certificate > SvtSecurityOptions::GetTrustedAuthors() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->GetTrustedAuthors();
-}
-
-void SvtSecurityOptions::SetTrustedAuthors( const Sequence< Certificate >& rAuthors )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetTrustedAuthors( rAuthors );
-}
-
-sal_Bool SvtSecurityOptions::IsTrustedAuthorsEnabled()
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsTrustedAuthorsEnabled();
-}
-
-bool SvtSecurityOptions::IsOptionSet( EOption eOption ) const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsOptionSet( eOption );
-}
-
-bool SvtSecurityOptions::SetOption( EOption eOption, bool bValue )
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->SetOption( eOption, bValue );
-}
-
-bool SvtSecurityOptions::IsOptionEnabled( EOption eOption ) const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsOptionEnabled( eOption );
-}
-
-Mutex& SvtSecurityOptions::GetInitMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be faster then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
-
-
-
-
-// xmlsec05 depricated
-
-EBasicSecurityMode SvtSecurityOptions_Impl::GetBasicMode() const
-{
- return m_eBasicMode;
-}
-
-void SvtSecurityOptions_Impl::SetBasicMode( EBasicSecurityMode eMode )
-{
- DBG_ASSERT(!m_bROBasicMode, "SvtSecurityOptions_Impl::SetBasicMode()\nYou tried to write on a readonly value!\n");
- if (!m_bROBasicMode && m_eBasicMode!=eMode)
- {
- m_eBasicMode = eMode;
- SetModified();
- }
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsExecutePlugins() const
-{
- return m_bExecutePlugins;
-}
-
-void SvtSecurityOptions_Impl::SetExecutePlugins( sal_Bool bSet )
-{
- DBG_ASSERT(!m_bROExecutePlugins, "SvtSecurityOptions_Impl::SetExecutePlugins()\nYou tried to write on a readonly value!\n");
- if (!m_bROExecutePlugins && m_bExecutePlugins!=bSet)
- {
- m_bExecutePlugins = bSet;
- SetModified();
- }
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsWarningEnabled() const
-{
- return m_bWarning;
-}
-
-void SvtSecurityOptions_Impl::SetWarningEnabled( sal_Bool bSet )
-{
- DBG_ASSERT(!m_bROWarning, "SvtSecurityOptions_Impl::SetWarningEnabled()\nYou tried to write on a readonly value!\n");
- if (!m_bROWarning && m_bWarning!=bSet)
- {
- m_bWarning = bSet;
- SetModified();
- }
-}
-
-sal_Bool SvtSecurityOptions_Impl::IsConfirmationEnabled() const
-{
- return m_bConfirmation;
-}
-
-void SvtSecurityOptions_Impl::SetConfirmationEnabled( sal_Bool bSet )
-{
- DBG_ASSERT(!m_bROConfirmation, "SvtSecurityOptions_Impl::SetConfirmationEnabled()\nYou tried to write on a readonly value!\n");
- if (!m_bROConfirmation && m_bConfirmation!=bSet)
- {
- m_bConfirmation = bSet;
- SetModified();
- }
-}
-
-
-sal_Bool SvtSecurityOptions::IsExecutePlugins() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsExecutePlugins();
-}
-
-void SvtSecurityOptions::SetExecutePlugins( sal_Bool bSet )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetExecutePlugins( bSet );
-}
-
-sal_Bool SvtSecurityOptions::IsWarningEnabled() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsWarningEnabled();
-}
-
-void SvtSecurityOptions::SetWarningEnabled( sal_Bool bSet )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetWarningEnabled( bSet );
-}
-
-sal_Bool SvtSecurityOptions::IsConfirmationEnabled() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->IsConfirmationEnabled();
-}
-
-void SvtSecurityOptions::SetConfirmationEnabled( sal_Bool bSet )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetConfirmationEnabled( bSet );
-}
-
-void SvtSecurityOptions::SetBasicMode( EBasicSecurityMode eMode )
-{
- MutexGuard aGuard( GetInitMutex() );
- m_pDataContainer->SetBasicMode( eMode );
-}
-
-EBasicSecurityMode SvtSecurityOptions::GetBasicMode() const
-{
- MutexGuard aGuard( GetInitMutex() );
- return m_pDataContainer->GetBasicMode();
-}
-
diff --git a/svtools/source/config/sourceviewconfig.cxx b/svtools/source/config/sourceviewconfig.cxx
deleted file mode 100644
index 40b41d571751..000000000000
--- a/svtools/source/config/sourceviewconfig.cxx
+++ /dev/null
@@ -1,281 +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: sourceviewconfig.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_svtools.hxx"
-#include <svtools/sourceviewconfig.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <rtl/instance.hxx>
-#include <svtools/smplhint.hxx>
-
-#include <itemholder1.hxx>
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-namespace svt
-{
-class SourceViewConfig_Impl : public utl::ConfigItem, public SfxBroadcaster
-{
-private:
- OUString m_sFontName;
- sal_Int16 m_nFontHeight;
- sal_Bool m_bProportionalFontOnly;
-
- void Load();
-
- static Sequence< OUString > GetPropertyNames();
-
-public:
- SourceViewConfig_Impl();
- ~SourceViewConfig_Impl();
-
- virtual void Notify( const Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
- const rtl::OUString& GetFontName() const
- {return m_sFontName;}
- void SetFontName(const rtl::OUString& rName)
- {
- if(rName != m_sFontName)
- {
- m_sFontName = rName;
- SetModified();
- }
- }
-
- sal_Int16 GetFontHeight() const
- {return m_nFontHeight;}
- void SetFontHeight(sal_Int16 nHeight)
- {
- if(m_nFontHeight != nHeight)
- {
- m_nFontHeight = nHeight;
- SetModified();
- }
- }
-
- sal_Bool IsShowProportionalFontsOnly() const
- {return m_bProportionalFontOnly;}
- void SetShowProportionalFontsOnly(sal_Bool bSet)
- {
- if(m_bProportionalFontOnly != bSet)
- {
- m_bProportionalFontOnly = bSet;
- SetModified();
- }
- }
-};
-// initialization of static members --------------------------------------
-SourceViewConfig_Impl* SourceViewConfig::m_pImplConfig = 0;
-sal_Int32 SourceViewConfig::m_nRefCount = 0;
-namespace { struct lclMutex : public rtl::Static< ::osl::Mutex, lclMutex > {}; }
-/* -----------------------------28.08.2002 16:45------------------------------
-
- ---------------------------------------------------------------------------*/
-SourceViewConfig_Impl::SourceViewConfig_Impl() :
- ConfigItem(OUString::createFromAscii("Office.Common/Font/SourceViewFont")),
- m_nFontHeight(12),
- m_bProportionalFontOnly(sal_False)
-{
- Load();
-}
-/* -----------------------------28.08.2002 16:45------------------------------
-
- ---------------------------------------------------------------------------*/
-SourceViewConfig_Impl::~SourceViewConfig_Impl()
-{
-}
-/* -----------------------------28.08.2002 16:25------------------------------
-
- ---------------------------------------------------------------------------*/
-Sequence< OUString > SourceViewConfig_Impl::GetPropertyNames()
-{
- //this list needs exactly to mach the enum PropertyNameIndex
- static const char* aPropNames[] =
- {
- "FontName" // 0
- ,"FontHeight" // 1
- ,"NonProportionalFontsOnly" // 2
- };
- const int nCount = sizeof( aPropNames ) / sizeof( const char* );
- Sequence< OUString > aNames( nCount );
- OUString* pNames = aNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
-
- return aNames;
-}
-
-/*-- 28.08.2002 16:37:59---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SourceViewConfig_Impl::Load()
-{
- Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- EnableNotification( aNames );
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- if ( aValues.getLength() == aNames.getLength() )
- {
- for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
- {
- if ( pValues[nProp].hasValue() )
- {
- switch( nProp )
- {
- case 0: pValues[nProp] >>= m_sFontName; break;
- case 1: pValues[nProp] >>= m_nFontHeight; break;
- case 2: pValues[nProp] >>= m_bProportionalFontOnly; break;
- }
- }
- }
- }
-}
-/*-- 28.08.2002 16:38:00---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SourceViewConfig_Impl::Notify( const Sequence< OUString >& )
-{
- Load();
-}
-/*-- 28.08.2002 16:38:00---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SourceViewConfig_Impl::Commit()
-{
- ClearModified();
- Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues( aNames.getLength() );
- Any* pValues = aValues.getArray();
- for ( int nProp = 0; nProp < aNames.getLength(); nProp++ )
- {
- switch( nProp )
- {
- case 0: pValues[nProp] <<= m_sFontName; break;
- case 1: pValues[nProp] <<= m_nFontHeight; break;
- case 2: pValues[nProp] <<= m_bProportionalFontOnly; break;
- default:
- DBG_ERRORFILE( "invalid index to save a user token" );
- }
- }
- PutProperties( aNames, aValues );
-
- //notify SfxListener
- {
- SfxSimpleHint aHint = SfxSimpleHint( SFX_HINT_DATACHANGED );
- Broadcast(aHint);
- }
-}
-/*-- 28.08.2002 16:32:19---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SourceViewConfig::SourceViewConfig()
-{
- {
- ::osl::MutexGuard aGuard( lclMutex::get() );
- if(!m_pImplConfig)
- {
- m_pImplConfig = new SourceViewConfig_Impl;
- ItemHolder1::holdConfigItem(E_SOURCEVIEWCONFIG);
- }
-
- ++m_nRefCount;
- }
- StartListening( *m_pImplConfig, TRUE );
-}
-/*-- 28.08.2002 16:32:19---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SourceViewConfig::~SourceViewConfig()
-{
- EndListening( *m_pImplConfig, TRUE );
- ::osl::MutexGuard aGuard( lclMutex::get() );
- if( !--m_nRefCount )
- {
- if( m_pImplConfig->IsModified() )
- m_pImplConfig->Commit();
- DELETEZ( m_pImplConfig );
- }
-}
-/*-- 28.08.2002 16:32:19---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-const OUString& SourceViewConfig::GetFontName() const
-{
- return m_pImplConfig->GetFontName();
-}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SourceViewConfig::SetFontName(const OUString& rName)
-{
- m_pImplConfig->SetFontName(rName);
-}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Int16 SourceViewConfig::GetFontHeight() const
-{
- return m_pImplConfig->GetFontHeight();
-}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SourceViewConfig::SetFontHeight(sal_Int16 nHeight)
-{
- m_pImplConfig->SetFontHeight(nHeight);
-}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SourceViewConfig::IsShowProportionalFontsOnly() const
-{
- return m_pImplConfig->IsShowProportionalFontsOnly();
-}
-/*-- 28.08.2002 16:32:20---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SourceViewConfig::SetShowProportionalFontsOnly(sal_Bool bSet)
-{
- m_pImplConfig->SetShowProportionalFontsOnly(bSet);
-}
-/* -----------------------------30.08.2002 10:40------------------------------
-
- ---------------------------------------------------------------------------*/
-void SourceViewConfig::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- Broadcast( rHint );
-}
-}//namespace svt
diff --git a/svtools/source/config/startoptions.cxx b/svtools/source/config/startoptions.cxx
deleted file mode 100644
index 08f4a7e0500e..000000000000
--- a/svtools/source/config/startoptions.cxx
+++ /dev/null
@@ -1,461 +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: startoptions.cxx,v $
- * $Revision: 1.16 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/startoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <rtl/logfile.hxx>
-#include "itemholder1.hxx"
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define DEFAULT_SHOWINTRO sal_True
-#define DEFAULT_CONNECTIONURL OUString()
-
-#define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/Office" ))
-#define PROPERTYNAME_SHOWINTRO OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupShowIntro" ))
-#define PROPERTYNAME_CONNECTIONURL OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupConnectionURL" ))
-
-#define PROPERTYHANDLE_SHOWINTRO 0
-#define PROPERTYHANDLE_CONNECTIONURL 1
-
-#define PROPERTYCOUNT 2
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-class SvtStartOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtStartOptions_Impl();
- ~SvtStartOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @ATTENTION We don't implement these method - because we support readonly values at runtime only!
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @ATTENTION We don't implement these method - because we support readonly values at runtime only!
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These method give us a chance to regulate acces to ouer internal values.
- It's not used in the moment - but it's possible for the feature!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- sal_Bool IsIntroEnabled ( ) const ;
- void EnableIntro ( sal_Bool bState ) ;
- OUString GetConnectionURL( ) const ;
- void SetConnectionURL( const OUString& sURL ) ;
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of fix key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management. We return well known key names only - because the "UserData" node
- is handled in a special way!
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- static Sequence< OUString > impl_GetPropertyNames();
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- sal_Bool m_bShowIntro ; /// cache "ShowIntro" of Start section
- OUString m_sConnectionURL ; /// cache "Connection" of Start section
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtStartOptions_Impl::SvtStartOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_START )
- // Init member then.
- , m_bShowIntro ( DEFAULT_SHOWINTRO )
-{
- // Use our static list of configuration keys to get his values.
- Sequence< OUString > seqNames = impl_GetPropertyNames();
- Sequence< Any > seqValues = GetProperties( seqNames ) ;
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- sal_Int32 nPropertyCount = seqValues.getLength() ;
- sal_Int32 nProperty = 0 ;
- for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- // Safe impossible cases.
- // Check any for valid value.
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nInvalid property value for property detected!\n" );
- switch( nProperty )
- {
- case PROPERTYHANDLE_SHOWINTRO : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nWho has changed the value type of \"Office.Common\\Start\\ShowIntro\"?" );
- seqValues[nProperty] >>= m_bShowIntro;
- }
- break;
-
- case PROPERTYHANDLE_CONNECTIONURL : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_STRING), "SvtStartOptions_Impl::SvtStartOptions_Impl()\nWho has changed the value type of \"Office.Common\\Start\\Connection\"?" );
- seqValues[nProperty] >>= m_sConnectionURL;
- }
- break;
- }
- }
-
- // Don't enable notification mechanism of ouer baseclass!
- // We support readonly variables in the moment.
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtStartOptions_Impl::~SvtStartOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtStartOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
-{
- // Use given list of updated properties to get his values from configuration directly!
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- // Safe impossible cases.
- // We need values from ALL notified configuration keys.
- DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtStartOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
- // Step over list of property names and get right value from coreesponding value list to set it on internal members!
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- if( seqPropertyNames[nProperty] == PROPERTYNAME_SHOWINTRO )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtStartOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Start\\ShowIntro\"?" );
- seqValues[nProperty] >>= m_bShowIntro;
- }
- else
- if( seqPropertyNames[nProperty] == PROPERTYNAME_CONNECTIONURL )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_STRING), "SvtStartOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\Start\\Connection\"?" );
- seqValues[nProperty] >>= m_sConnectionURL;
- }
- #if OSL_DEBUG_LEVEL > 1
- else DBG_ASSERT( sal_False, "SvtStartOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" );
- #endif
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtStartOptions_Impl::Commit()
-{
- // Get names of supported properties, create a list for values and copy current values to it.
- Sequence< OUString > seqNames = impl_GetPropertyNames();
- sal_Int32 nCount = seqNames.getLength();
- Sequence< Any > seqValues ( nCount );
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_SHOWINTRO : {
- seqValues[nProperty] <<= m_bShowIntro;
- }
- break;
- case PROPERTYHANDLE_CONNECTIONURL : {
- seqValues[nProperty] <<= m_sConnectionURL;
- }
- break;
- }
- }
- // Set properties in configuration.
- PutProperties( seqNames, seqValues );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtStartOptions_Impl::IsIntroEnabled() const
-{
- return m_bShowIntro;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtStartOptions_Impl::EnableIntro( sal_Bool bState )
-{
- m_bShowIntro = bState;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-OUString SvtStartOptions_Impl::GetConnectionURL() const
-{
- return m_sConnectionURL;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtStartOptions_Impl::SetConnectionURL( const OUString& sURL )
-{
- m_sConnectionURL = sURL;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtStartOptions_Impl::impl_GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_SHOWINTRO ,
- PROPERTYNAME_CONNECTIONURL ,
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtStartOptions_Impl* SvtStartOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtStartOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtStartOptions::SvtStartOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already!
- if( m_pDataContainer == NULL )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtStartOptions_Impl::ctor()");
- m_pDataContainer = new SvtStartOptions_Impl();
-
- ItemHolder1::holdConfigItem(E_STARTOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtStartOptions::~SvtStartOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtStartOptions::IsIntroEnabled() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->IsIntroEnabled();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtStartOptions::EnableIntro( sal_Bool bState )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->EnableIntro( bState );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-OUString SvtStartOptions::GetConnectionURL() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetConnectionURL();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtStartOptions::SetConnectionURL( const OUString& sURL )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetConnectionURL( sURL );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtStartOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/syslocaleoptions.cxx b/svtools/source/config/syslocaleoptions.cxx
deleted file mode 100644
index a75c63e34af0..000000000000
--- a/svtools/source/config/syslocaleoptions.cxx
+++ /dev/null
@@ -1,637 +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: syslocaleoptions.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include <svtools/syslocaleoptions.hxx>
-#include <broadcast.hxx>
-#include <listener.hxx>
-#include <svtools/smplhint.hxx>
-#include <i18npool/mslangid.hxx>
-#include <tools/string.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/instance.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/svapp.hxx>
-
-#include <rtl/logfile.hxx>
-
-#include "itemholder2.hxx"
-
-
-#define CFG_READONLY_DEFAULT sal_False
-
-using namespace osl;
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::lang;
-
-
-SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = NULL;
-sal_Int32 SvtSysLocaleOptions::nRefCount = 0;
-namespace
-{
- struct CurrencyChangeLink
- : public rtl::Static<Link, CurrencyChangeLink> {};
-}
-
-class SvtSysLocaleOptions_Impl : public utl::ConfigItem
-{
- OUString m_aLocaleString; // en-US or de-DE or empty for SYSTEM
- LanguageType m_eLocaleLanguageType; // same for convenience access
- OUString m_aCurrencyString; // USD-en-US or EUR-de-DE
- SvtBroadcaster m_aBroadcaster;
- ULONG m_nBlockedHint; // pending hints
- sal_Int32 m_nBroadcastBlocked; // broadcast only if this is 0
- sal_Bool m_bDecimalSeparator; //use decimal separator same as locale
-
-
- sal_Bool m_bROLocale;
- sal_Bool m_bROCurrency;
- sal_Bool m_bRODecimalSeparator;
-
- static const Sequence< /* const */ OUString > GetPropertyNames();
-
- void UpdateMiscSettings_Impl();
- ULONG ChangeLocaleSettings();
- void ChangeDefaultCurrency() const;
- void Broadcast( ULONG nHint );
-
-public:
- SvtSysLocaleOptions_Impl();
- virtual ~SvtSysLocaleOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
-
- const OUString& GetLocaleString() const
- { return m_aLocaleString; }
- void SetLocaleString( const OUString& rStr );
- LanguageType GetLocaleLanguageType() const
- { return m_eLocaleLanguageType; }
-
- const OUString& GetCurrencyString() const
- { return m_aCurrencyString; }
- void SetCurrencyString( const OUString& rStr );
-
- sal_Bool IsDecimalSeparatorAsLocale() const { return m_bDecimalSeparator;}
- void SetDecimalSeparatorAsLocale( sal_Bool bSet);
-
- SvtBroadcaster& GetBroadcaster()
- { return m_aBroadcaster; }
- void BlockBroadcasts( BOOL bBlock );
- sal_Bool IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const;
-};
-
-
-#define ROOTNODE_SYSLOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("Setup/L10N"))
-
-#define PROPERTYNAME_LOCALE OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupSystemLocale"))
-#define PROPERTYNAME_CURRENCY OUString(RTL_CONSTASCII_USTRINGPARAM("ooSetupCurrency"))
-#define PROPERTYNAME_DECIMALSEPARATOR OUString(RTL_CONSTASCII_USTRINGPARAM("DecimalSeparatorAsLocale"))
-
-#define PROPERTYHANDLE_LOCALE 0
-#define PROPERTYHANDLE_CURRENCY 1
-#define PROPERTYHANDLE_DECIMALSEPARATOR 2
-
-#define PROPERTYCOUNT 3
-
-const Sequence< OUString > SvtSysLocaleOptions_Impl::GetPropertyNames()
-{
- static const OUString pProperties[] =
- {
- PROPERTYNAME_LOCALE,
- PROPERTYNAME_CURRENCY,
- PROPERTYNAME_DECIMALSEPARATOR
- };
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- return seqPropertyNames;
-}
-
-
-// -----------------------------------------------------------------------
-
-SvtSysLocaleOptions_Impl::SvtSysLocaleOptions_Impl()
- : ConfigItem( ROOTNODE_SYSLOCALE )
- , m_nBlockedHint( 0 )
- , m_nBroadcastBlocked( 0 )
- , m_bDecimalSeparator( sal_True )
- , m_bROLocale(CFG_READONLY_DEFAULT)
- , m_bROCurrency(CFG_READONLY_DEFAULT)
- , m_bRODecimalSeparator(sal_False)
-
-{
- if ( !IsValidConfigMgr() )
- ChangeLocaleSettings(); // assume SYSTEM defaults during Setup
- else
- {
- const Sequence< OUString > aNames = GetPropertyNames();
- Sequence< Any > aValues = GetProperties( aNames );
- Sequence< sal_Bool > aROStates = GetReadOnlyStates( aNames );
- const Any* pValues = aValues.getConstArray();
- const sal_Bool* pROStates = aROStates.getConstArray();
- DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" );
- DBG_ASSERT( aROStates.getLength() == aNames.getLength(), "GetReadOnlyStates failed" );
- if ( aValues.getLength() == aNames.getLength() && aROStates.getLength() == aNames.getLength() )
- {
- for ( sal_Int32 nProp = 0; nProp < aNames.getLength(); nProp++ )
- {
- DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
- if ( pValues[nProp].hasValue() )
- {
- switch ( nProp )
- {
- case PROPERTYHANDLE_LOCALE :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aLocaleString = aStr;
- else
- {
- DBG_ERRORFILE( "Wrong property type!" );
- }
- m_bROLocale = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_CURRENCY :
- {
- OUString aStr;
- if ( pValues[nProp] >>= aStr )
- m_aCurrencyString = aStr;
- else
- {
- DBG_ERRORFILE( "Wrong property type!" );
- }
- m_bROCurrency = pROStates[nProp];
- }
- break;
- case PROPERTYHANDLE_DECIMALSEPARATOR:
- {
- sal_Bool bValue = sal_Bool();
- if ( pValues[nProp] >>= bValue )
- m_bDecimalSeparator = bValue;
- else
- {
- DBG_ERRORFILE( "Wrong property type!" );
- }
- m_bRODecimalSeparator = pROStates[nProp];
- }
- break;
- default:
- DBG_ERRORFILE( "Wrong property type!" );
- }
- }
- }
- }
- UpdateMiscSettings_Impl();
- ChangeLocaleSettings();
- EnableNotification( aNames );
- }
-}
-
-
-SvtSysLocaleOptions_Impl::~SvtSysLocaleOptions_Impl()
-{
- if ( IsModified() )
- Commit();
-}
-
-
-void SvtSysLocaleOptions_Impl::BlockBroadcasts( BOOL bBlock )
-{
- if ( bBlock )
- ++m_nBroadcastBlocked;
- else if ( m_nBroadcastBlocked )
- {
- if ( --m_nBroadcastBlocked == 0 )
- Broadcast( 0 );
- }
-}
-
-sal_Bool SvtSysLocaleOptions_Impl::IsReadOnly( SvtSysLocaleOptions::EOption eOption ) const
-{
- sal_Bool bReadOnly = CFG_READONLY_DEFAULT;
- switch(eOption)
- {
- case SvtSysLocaleOptions::E_LOCALE :
- {
- bReadOnly = m_bROLocale;
- break;
- }
- case SvtSysLocaleOptions::E_CURRENCY :
- {
- bReadOnly = m_bROCurrency;
- break;
- }
- }
- return bReadOnly;
-}
-
-
-void SvtSysLocaleOptions_Impl::Broadcast( ULONG nHint )
-{
- if ( m_nBroadcastBlocked )
- m_nBlockedHint |= nHint;
- else
- {
- nHint |= m_nBlockedHint;
- m_nBlockedHint = 0;
- if ( nHint )
- {
- if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY )
- ChangeDefaultCurrency();
- SfxSimpleHint aHint( nHint );
- GetBroadcaster().Broadcast( aHint );
- }
- }
-}
-
-
-void SvtSysLocaleOptions_Impl::Commit()
-{
- const Sequence< OUString > aOrgNames = GetPropertyNames();
- sal_Int32 nOrgCount = aOrgNames.getLength();
-
- Sequence< OUString > aNames( nOrgCount );
- Sequence< Any > aValues( nOrgCount );
-
- OUString* pNames = aNames.getArray();
- Any* pValues = aValues.getArray();
- sal_Int32 nRealCount = 0;
-
- for ( sal_Int32 nProp = 0; nProp < nOrgCount; nProp++ )
- {
- switch ( nProp )
- {
- case PROPERTYHANDLE_LOCALE :
- {
- if (!m_bROLocale)
- {
- pNames[nRealCount] = aOrgNames[nProp];
- pValues[nRealCount] <<= m_aLocaleString;
- ++nRealCount;
- }
- }
- break;
- case PROPERTYHANDLE_CURRENCY :
- {
- if (!m_bROLocale)
- {
- pNames[nRealCount] = aOrgNames[nProp];
- pValues[nRealCount] <<= m_aCurrencyString;
- ++nRealCount;
- }
- }
- break;
- case PROPERTYHANDLE_DECIMALSEPARATOR:
- if( !m_bRODecimalSeparator )
- {
- pNames[nRealCount] = aOrgNames[nProp];
- pValues[nRealCount] <<= m_bDecimalSeparator;
- ++nRealCount;
- }
- break;
- default:
- DBG_ERRORFILE( "invalid index to save a path" );
- }
- }
- aNames.realloc(nRealCount);
- aValues.realloc(nRealCount);
- PutProperties( aNames, aValues );
- ClearModified();
-}
-
-
-void SvtSysLocaleOptions_Impl::SetLocaleString( const OUString& rStr )
-{
- if (!m_bROLocale && rStr != m_aLocaleString )
- {
- m_aLocaleString = rStr;
- SetModified();
- ULONG nHint = SYSLOCALEOPTIONS_HINT_LOCALE;
- nHint |= ChangeLocaleSettings();
- Broadcast( nHint );
- }
-}
-
-
-ULONG SvtSysLocaleOptions_Impl::ChangeLocaleSettings()
-{
- // An empty config value denotes SYSTEM locale
- if ( m_aLocaleString.getLength() )
- m_eLocaleLanguageType = MsLangId::convertIsoStringToLanguage( m_aLocaleString );
- else
- m_eLocaleLanguageType = LANGUAGE_SYSTEM;
- ULONG nHint = 0;
- // new locale and no fixed currency => locale default currency might change
- if ( !m_aCurrencyString.getLength() )
- nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY;
- return nHint;
-}
-
-
-void SvtSysLocaleOptions_Impl::SetCurrencyString( const OUString& rStr )
-{
- if (!m_bROCurrency && rStr != m_aCurrencyString )
- {
- m_aCurrencyString = rStr;
- SetModified();
- Broadcast( SYSLOCALEOPTIONS_HINT_CURRENCY );
- }
-}
-
-void SvtSysLocaleOptions_Impl::SetDecimalSeparatorAsLocale( sal_Bool bSet)
-{
- if(bSet != m_bDecimalSeparator)
- {
- m_bDecimalSeparator = bSet;
- SetModified();
- UpdateMiscSettings_Impl();
- }
-}
-
-
-void SvtSysLocaleOptions_Impl::ChangeDefaultCurrency() const
-{
- const Link& rLink = SvtSysLocaleOptions::GetCurrencyChangeLink();
- if ( rLink.IsSet() )
- rLink.Call( NULL );
-}
-
-
-void SvtSysLocaleOptions_Impl::Notify( const Sequence< rtl::OUString >& seqPropertyNames )
-{
- ULONG nHint = 0;
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- Sequence< sal_Bool > seqROStates = GetReadOnlyStates( seqPropertyNames );
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProp = 0; nProp < nCount; ++nProp )
- {
- if( seqPropertyNames[nProp] == PROPERTYNAME_LOCALE )
- {
- DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Locale property type" );
- seqValues[nProp] >>= m_aLocaleString;
- m_bROLocale = seqROStates[nProp];
- nHint |= SYSLOCALEOPTIONS_HINT_LOCALE;
- nHint |= ChangeLocaleSettings();
- }
- else if( seqPropertyNames[nProp] == PROPERTYNAME_CURRENCY )
- {
- DBG_ASSERT( seqValues[nProp].getValueTypeClass() == TypeClass_STRING, "Currency property type" );
- seqValues[nProp] >>= m_aCurrencyString;
- m_bROCurrency = seqROStates[nProp];
- nHint |= SYSLOCALEOPTIONS_HINT_CURRENCY;
- }
- else if( seqPropertyNames[nProp] == PROPERTYNAME_DECIMALSEPARATOR )
- {
- seqValues[nProp] >>= m_bDecimalSeparator;
- m_bRODecimalSeparator = seqROStates[nProp];
- UpdateMiscSettings_Impl();
- }
- }
- if ( nHint )
- Broadcast( nHint );
-}
-/* -----------------10.02.2004 15:25-----------------
-
- --------------------------------------------------*/
-void SvtSysLocaleOptions_Impl::UpdateMiscSettings_Impl()
-{
- AllSettings aAllSettings( Application::GetSettings() );
- MiscSettings aMiscSettings = aAllSettings.GetMiscSettings();
- aMiscSettings.SetEnableLocalizedDecimalSep(m_bDecimalSeparator);
- aAllSettings.SetMiscSettings( aMiscSettings );
- Application::SetSettings( aAllSettings );
-}
-
-// ====================================================================
-
-SvtSysLocaleOptions::SvtSysLocaleOptions()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !pOptions )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtSysLocaleOptions_Impl::ctor()");
- pOptions = new SvtSysLocaleOptions_Impl;
-
- ItemHolder2::holdConfigItem(E_SYSLOCALEOPTIONS);
- }
- ++nRefCount;
-}
-
-
-SvtSysLocaleOptions::~SvtSysLocaleOptions()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !--nRefCount )
- {
- delete pOptions;
- pOptions = NULL;
- }
-}
-
-
-// static
-Mutex& SvtSysLocaleOptions::GetMutex()
-{
- static Mutex* pMutex = NULL;
- if( !pMutex )
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if( !pMutex )
- {
- // #i77768# Due to a static reference in the toolkit lib
- // we need a mutex that lives longer than the svtools library.
- // Otherwise the dtor would use a destructed mutex!!
- pMutex = new Mutex;
- }
- }
- return *pMutex;
-}
-
-
-sal_Bool SvtSysLocaleOptions::IsModified()
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->IsModified();
-}
-
-
-void SvtSysLocaleOptions::Commit()
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->Commit();
-}
-
-
-BOOL SvtSysLocaleOptions::AddListener( SvtListener& rLst )
-{
- MutexGuard aGuard( GetMutex() );
- return rLst.StartListening( pOptions->GetBroadcaster() );
-}
-
-
-BOOL SvtSysLocaleOptions::RemoveListener( SvtListener& rLst )
-{
- MutexGuard aGuard( GetMutex() );
- return rLst.EndListening( pOptions->GetBroadcaster() );
-}
-
-
-void SvtSysLocaleOptions::BlockBroadcasts( BOOL bBlock )
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->BlockBroadcasts( bBlock );
-}
-
-
-const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->GetLocaleString();
-}
-
-
-void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr )
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->SetLocaleString( rStr );
-}
-
-
-const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->GetCurrencyString();
-}
-
-
-void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr )
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->SetCurrencyString( rStr );
-}
-
-
-LanguageType SvtSysLocaleOptions::GetLocaleLanguageType() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->GetLocaleLanguageType();
-}
-
-/*-- 11.02.2004 13:31:41---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->IsDecimalSeparatorAsLocale();
-}
-/*-- 11.02.2004 13:31:41---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( sal_Bool bSet)
-{
- MutexGuard aGuard( GetMutex() );
- pOptions->SetDecimalSeparatorAsLocale(bSet);
-}
-
-
-sal_Bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const
-{
- MutexGuard aGuard( GetMutex() );
- return pOptions->IsReadOnly( eOption );
-}
-
-// static
-void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( String& rAbbrev,
- LanguageType& eLang, const ::rtl::OUString& rConfigString )
-{
- sal_Int32 nDelim = rConfigString.indexOf( '-' );
- if ( nDelim >= 0 )
- {
- rAbbrev = rConfigString.copy( 0, nDelim );
- String aIsoStr( rConfigString.copy( nDelim+1 ) );
- eLang = MsLangId::convertIsoStringToLanguage( aIsoStr );
- }
- else
- {
- rAbbrev = rConfigString;
- eLang = (rAbbrev.Len() ? LANGUAGE_NONE : LANGUAGE_SYSTEM);
- }
-}
-
-
-// static
-::rtl::OUString SvtSysLocaleOptions::CreateCurrencyConfigString(
- const String& rAbbrev, LanguageType eLang )
-{
- String aIsoStr( MsLangId::convertLanguageToIsoString( eLang ) );
- if ( aIsoStr.Len() )
- {
- ::rtl::OUStringBuffer aStr( rAbbrev.Len() + 1 + aIsoStr.Len() );
- aStr.append( rAbbrev.GetBuffer(), rAbbrev.Len() );
- aStr.append( sal_Unicode('-') );
- aStr.append( aIsoStr.GetBuffer(), aIsoStr.Len() );
- return aStr.makeStringAndClear();
- }
- else
- return rAbbrev;
-}
-
-
-// static
-void SvtSysLocaleOptions::SetCurrencyChangeLink( const Link& rLink )
-{
- MutexGuard aGuard( GetMutex() );
- DBG_ASSERT( !CurrencyChangeLink::get().IsSet(), "SvtSysLocaleOptions::SetCurrencyChangeLink: already set" );
- CurrencyChangeLink::get() = rLink;
-}
-
-
-// static
-const Link& SvtSysLocaleOptions::GetCurrencyChangeLink()
-{
- MutexGuard aGuard( GetMutex() );
- return CurrencyChangeLink::get();
-}
-
diff --git a/svtools/source/config/test/test.cxx b/svtools/source/config/test/test.cxx
index 4090f7cb8bf5..1ac0038b5131 100644
--- a/svtools/source/config/test/test.cxx
+++ b/svtools/source/config/test/test.cxx
@@ -42,7 +42,7 @@
// my own includes
//_________________________________________________________________________________________________________________
-#include <svtools/dynamicmenuoptions.hxx>
+#include <unotools/dynamicmenuoptions.hxx>
//_________________________________________________________________________________________________________________
// interface includes
diff --git a/svtools/source/config/undoopt.cxx b/svtools/source/config/undoopt.cxx
deleted file mode 100644
index a0c74ef84aac..000000000000
--- a/svtools/source/config/undoopt.cxx
+++ /dev/null
@@ -1,220 +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: undoopt.cxx,v $
- * $Revision: 1.14 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include <svtools/undoopt.hxx>
-#include "rtl/instance.hxx"
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <vos/mutex.hxx>
-#include <svtools/smplhint.hxx>
-#include <vcl/svapp.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/logfile.hxx>
-#include "itemholder2.hxx"
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star::uno;
-
-static SvtUndoOptions_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-#define STEPS 0
-
-class SvtUndoOptions_Impl : public utl::ConfigItem, public SfxBroadcaster
-{
- sal_Int32 nUndoCount;
- Sequence< rtl::OUString > m_aPropertyNames;
-
-public:
- SvtUndoOptions_Impl();
-
- virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
- virtual void Commit();
- void Load();
-
- void SetUndoCount( sal_Int32 n ) { nUndoCount = n; SetModified(); }
- sal_Int32 GetUndoCount() const { return nUndoCount; }
-};
-
-// -----------------------------------------------------------------------
-
-SvtUndoOptions_Impl::SvtUndoOptions_Impl()
- : ConfigItem( OUString::createFromAscii("Office.Common/Undo") )
- , nUndoCount( 20 )
-{
- Load();
-}
-
-void SvtUndoOptions_Impl::Commit()
-{
- Sequence< Any > aValues( m_aPropertyNames.getLength() );
- Any* pValues = aValues.getArray();
- for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ )
- {
- switch ( nProp )
- {
- case STEPS :
- pValues[nProp] <<= nUndoCount;
- break;
- default:
- DBG_ERRORFILE( "invalid index to save a path" );
- }
- }
-
- PutProperties( m_aPropertyNames, aValues );
- //broadcast changes
- Broadcast(SfxSimpleHint(SFX_HINT_UNDO_OPTIONS_CHANGED));
-}
-
-// -----------------------------------------------------------------------
-void SvtUndoOptions_Impl::Load()
-{
- if(!m_aPropertyNames.getLength())
- {
- static const char* aPropNames[] =
- {
- "Steps",
- };
-
- const int nCount = sizeof( aPropNames ) / sizeof( const char* );
- m_aPropertyNames.realloc(nCount);
- OUString* pNames = m_aPropertyNames.getArray();
- for ( int i = 0; i < nCount; i++ )
- pNames[i] = OUString::createFromAscii( aPropNames[i] );
- EnableNotification( m_aPropertyNames );
- }
-
- Sequence< Any > aValues = GetProperties( m_aPropertyNames );
- const Any* pValues = aValues.getConstArray();
- DBG_ASSERT( aValues.getLength() == m_aPropertyNames.getLength(), "GetProperties failed" );
- if ( aValues.getLength() == m_aPropertyNames.getLength() )
- {
- for ( int nProp = 0; nProp < m_aPropertyNames.getLength(); nProp++ )
- {
- DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" );
- if ( pValues[nProp].hasValue() )
- {
- switch ( nProp )
- {
- case STEPS :
- {
- sal_Int32 nTemp = 0;
- if ( pValues[nProp] >>= nTemp )
- nUndoCount = nTemp;
- else
- {
- DBG_ERROR( "Wrong Type!" );
- }
- break;
- }
-
- default:
- DBG_ERROR( "Wrong Type!" );
- break;
- }
- }
- }
- }
-}
-// -----------------------------------------------------------------------
-void SvtUndoOptions_Impl::Notify( const Sequence<rtl::OUString>& )
-{
- Load();
- //broadcast changes
- Broadcast(SfxSimpleHint(SFX_HINT_UNDO_OPTIONS_CHANGED));
-}
-
-// -----------------------------------------------------------------------
-namespace
-{
- class LocalSingleton : public rtl::Static< osl::Mutex, LocalSingleton >
- {
- };
-}
-
-// -----------------------------------------------------------------------
-SvtUndoOptions::SvtUndoOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( LocalSingleton::get() );
- if ( !pOptions )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtUndoOptions_Impl::ctor()");
- pOptions = new SvtUndoOptions_Impl;
-
- ItemHolder2::holdConfigItem(E_UNDOOPTIONS);
- }
- ++nRefCount;
- pImp = pOptions;
- StartListening(*pImp);
-}
-
-// -----------------------------------------------------------------------
-
-SvtUndoOptions::~SvtUndoOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( LocalSingleton::get() );
- EndListening(*pImp);
- if ( !--nRefCount )
- {
- if ( pOptions->IsModified() )
- pOptions->Commit();
- DELETEZ( pOptions );
- }
-}
-
-void SvtUndoOptions::SetUndoCount( sal_Int32 n )
-{
- pImp->SetUndoCount( n );
-}
-
-sal_Int32 SvtUndoOptions::GetUndoCount() const
-{
- return pImp->GetUndoCount();
-}
-
-void SvtUndoOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
- Broadcast( rHint );
-}
-
diff --git a/svtools/source/config/useroptions.cxx b/svtools/source/config/useroptions.cxx
deleted file mode 100644
index 4eafbefe54a3..000000000000
--- a/svtools/source/config/useroptions.cxx
+++ /dev/null
@@ -1,1313 +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: useroptions.cxx,v $
- * $Revision: 1.24.238.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifdef SVL_DLLIMPLEMENTATION
-#undef SVL_DLLIMPLEMENTATION
-#endif
-#define SVT_DLLIMPLEMENTATION
-
-#include <svtools/useroptions.hxx>
-#include "configitems/useroptions_const.hxx"
-
-#include <unotools/configmgr.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <svtools/smplhint.hxx>
-#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <rtl/instance.hxx>
-#include <rtl/logfile.hxx>
-#include "itemholder2.hxx"
-
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/util/XChangesListener.hpp>
-#include <com/sun/star/util/XChangesNotifier.hpp>
-#include <com/sun/star/util/ChangesEvent.hpp>
-#include <comphelper/configurationhelper.hxx>
-#include <unotools/processfactory.hxx>
-#include <loghelper.hxx>
-
-using namespace utl;
-using namespace rtl;
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-
-namespace css = ::com::sun::star;
-
-// class SvtUserOptions_Impl ---------------------------------------------
-class SvtUserOptions_Impl;
-class SvtUserConfigChangeListener_Impl : public cppu::WeakImplHelper1
-<
- com::sun::star::util::XChangesListener
->
-{
- SvtUserOptions_Impl& m_rParent;
- public:
- SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent);
- ~SvtUserConfigChangeListener_Impl();
-
- //XChangesListener
- virtual void SAL_CALL changesOccurred( const util::ChangesEvent& Event ) throw(RuntimeException);
- //XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw(RuntimeException);
-};
-
-class SvtUserOptions_Impl : public SfxBroadcaster
-{
-public:
- SvtUserOptions_Impl();
- ~SvtUserOptions_Impl();
-
- // get the user token
- ::rtl::OUString GetCompany() const;
- ::rtl::OUString GetFirstName() const;
- ::rtl::OUString GetLastName() const;
- ::rtl::OUString GetID() const;
- ::rtl::OUString GetStreet() const;
- ::rtl::OUString GetCity() const;
- ::rtl::OUString GetState() const;
- ::rtl::OUString GetZip() const;
- ::rtl::OUString GetCountry() const;
- ::rtl::OUString GetPosition() const;
- ::rtl::OUString GetTitle() const;
- ::rtl::OUString GetTelephoneHome() const;
- ::rtl::OUString GetTelephoneWork() const;
- ::rtl::OUString GetFax() const;
- ::rtl::OUString GetEmail() const;
- ::rtl::OUString GetCustomerNumber() const;
- ::rtl::OUString GetFathersName() const;
- ::rtl::OUString GetApartment() const;
-
- ::rtl::OUString GetFullName() const;
- ::rtl::OUString GetLocale() const { return m_aLocale; }
-
- // set the address token
- void SetCompany( const ::rtl::OUString& rNewToken );
- void SetFirstName( const ::rtl::OUString& rNewToken );
- void SetLastName( const ::rtl::OUString& rNewToken );
- void SetID( const ::rtl::OUString& rNewToken );
- void SetStreet( const ::rtl::OUString& rNewToken );
- void SetCity( const ::rtl::OUString& rNewToken );
- void SetState( const ::rtl::OUString& rNewToken );
- void SetZip( const ::rtl::OUString& rNewToken );
- void SetCountry( const ::rtl::OUString& rNewToken );
- void SetPosition( const ::rtl::OUString& rNewToken );
- void SetTitle( const ::rtl::OUString& rNewToken );
- void SetTelephoneHome( const ::rtl::OUString& rNewToken );
- void SetTelephoneWork( const ::rtl::OUString& rNewToken );
- void SetFax( const ::rtl::OUString& rNewToken );
- void SetEmail( const ::rtl::OUString& rNewToken );
- void SetCustomerNumber( const ::rtl::OUString& rNewToken );
- void SetFathersName( const ::rtl::OUString& rNewToken );
- void SetApartment( const ::rtl::OUString& rNewToken );
-
- sal_Bool IsTokenReadonly( USHORT nToken ) const;
- ::rtl::OUString GetToken(USHORT nToken) const;
- void Notify();
-
-private:
- uno::Reference< util::XChangesListener > m_xChangeListener;
- css::uno::Reference< css::container::XNameAccess > m_xCfg;
- css::uno::Reference< css::beans::XPropertySet > m_xData;
- ::rtl::OUString m_aLocale;
-};
-
-// global ----------------------------------------------------------------
-
-static SvtUserOptions_Impl* pOptions = NULL;
-static sal_Int32 nRefCount = 0;
-
-#define READONLY_DEFAULT sal_False
-
-/*-- 16.06.2009 14:22:56---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SvtUserConfigChangeListener_Impl::SvtUserConfigChangeListener_Impl(SvtUserOptions_Impl& rParent) :
- m_rParent( rParent )
-{
-}
-/*-- 16.06.2009 14:22:56---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SvtUserConfigChangeListener_Impl::~SvtUserConfigChangeListener_Impl()
-{
-}
-/*-- 16.06.2009 14:22:56---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtUserConfigChangeListener_Impl::changesOccurred( const util::ChangesEvent& rEvent ) throw(RuntimeException)
-{
- if(rEvent.Changes.getLength())
- m_rParent.Notify();
-}
-/*-- 16.06.2009 14:22:56---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SvtUserConfigChangeListener_Impl::disposing( const lang::EventObject& rSource ) throw(RuntimeException)
-{
- try
- {
- uno::Reference< util::XChangesNotifier > xChgNot( rSource.Source, UNO_QUERY_THROW);
- xChgNot->removeChangesListener(this);
- }
- catch(Exception& )
- {
- }
-}
-
-// class SvtUserOptions_Impl ---------------------------------------------
-
-// -----------------------------------------------------------------------
-SvtUserOptions_Impl::SvtUserOptions_Impl() :
- m_xChangeListener( new SvtUserConfigChangeListener_Impl(*this) )
-{
- try
- {
- m_xCfg = Reference< css::container::XNameAccess > (
- ::comphelper::ConfigurationHelper::openConfig(
- utl::getProcessServiceFactory(),
- s_sData,
- ::comphelper::ConfigurationHelper::E_STANDARD),
- css::uno::UNO_QUERY );
-
- m_xData = css::uno::Reference< css::beans::XPropertySet >(m_xCfg, css::uno::UNO_QUERY);
- uno::Reference< util::XChangesNotifier > xChgNot( m_xCfg, UNO_QUERY);
- try
- {
- xChgNot->addChangesListener( m_xChangeListener );
- }
- catch(RuntimeException& )
- {
- }
- }
- catch(const css::uno::Exception& ex)
- {
- m_xCfg.clear();
- LogHelper::logIt(ex);
- }
-
- Any aAny = ConfigManager::GetConfigManager()->GetDirectConfigProperty( ConfigManager::LOCALE );
- ::rtl::OUString aLocale;
- if ( aAny >>= aLocale )
- m_aLocale = aLocale;
- else
- {
- DBG_ERRORFILE( "SvtUserOptions_Impl::SvtUserOptions_Impl(): no locale found" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-SvtUserOptions_Impl::~SvtUserOptions_Impl()
-{
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetCompany() const
-{
- ::rtl::OUString sCompany;
-
- try
- {
- m_xData->getPropertyValue(s_so) >>= sCompany;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sCompany;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetFirstName() const
-{
- ::rtl::OUString sFirstName;
-
- try
- {
- m_xData->getPropertyValue(s_sgivenname) >>= sFirstName;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sFirstName;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetLastName() const
-{
- ::rtl::OUString sLastName;
-
- try
- {
- m_xData->getPropertyValue(s_ssn) >>= sLastName;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sLastName;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetID() const
-{
- ::rtl::OUString sID;
-
- try
- {
- m_xData->getPropertyValue(s_sinitials) >>= sID;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sID;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetStreet() const
-{
- ::rtl::OUString sStreet;
-
- try
- {
- m_xData->getPropertyValue(s_sstreet) >>= sStreet;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sStreet;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetCity() const
-{
- ::rtl::OUString sCity;
-
- try
- {
- m_xData->getPropertyValue(s_sl) >>= sCity;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sCity;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetState() const
-{
- ::rtl::OUString sState;
-
- try
- {
- m_xData->getPropertyValue(s_sst) >>= sState;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sState;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetZip() const
-{
- ::rtl::OUString sZip;
-
- try
- {
- m_xData->getPropertyValue(s_spostalcode) >>= sZip;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sZip;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetCountry() const
-{
- ::rtl::OUString sCountry;
-
- try
- {
- m_xData->getPropertyValue(s_sc) >>= sCountry;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sCountry;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetPosition() const
-{
- ::rtl::OUString sPosition;
-
- try
- {
- m_xData->getPropertyValue(s_sposition) >>= sPosition;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sPosition;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetTitle() const
-{
- ::rtl::OUString sTitle;
-
- try
- {
- m_xData->getPropertyValue(s_stitle) >>= sTitle;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sTitle;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetTelephoneHome() const
-{
- ::rtl::OUString sTelephoneHome;
-
- try
- {
- m_xData->getPropertyValue(s_shomephone) >>= sTelephoneHome;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sTelephoneHome;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetTelephoneWork() const
-{
- ::rtl::OUString sTelephoneWork;
-
- try
- {
- m_xData->getPropertyValue(s_stelephonenumber) >>= sTelephoneWork;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sTelephoneWork;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetFax() const
-{
- ::rtl::OUString sFax;
-
- try
- {
- m_xData->getPropertyValue(s_sfacsimiletelephonenumber) >>= sFax;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sFax;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetEmail() const
-{
- ::rtl::OUString sEmail;
-
- try
- {
- m_xData->getPropertyValue(s_smail) >>= sEmail;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sEmail;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetCustomerNumber() const
-{
- ::rtl::OUString sCustomerNumber;
-
- try
- {
- m_xData->getPropertyValue(s_scustomernumber) >>= sCustomerNumber;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sCustomerNumber;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetFathersName() const
-{
- ::rtl::OUString sFathersName;
-
- try
- {
- m_xData->getPropertyValue(s_sfathersname) >>= sFathersName;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sFathersName;
-}
-
-::rtl::OUString SvtUserOptions_Impl::GetApartment() const
-{
- ::rtl::OUString sApartment;
-
- try
- {
- m_xData->getPropertyValue(s_sapartment) >>= sApartment;
- }
- catch ( const css::uno::Exception& ex )
- {
- LogHelper::logIt(ex);
- }
-
- return sApartment;
-}
-
-void SvtUserOptions_Impl::SetCompany( const ::rtl::OUString& sCompany )
-{
- try
- {
- m_xData->setPropertyValue(s_so, css::uno::makeAny(::rtl::OUString(sCompany)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetFirstName( const ::rtl::OUString& sFirstName )
-{
- try
- {
- m_xData->setPropertyValue(s_sgivenname, css::uno::makeAny(::rtl::OUString(sFirstName)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetLastName( const ::rtl::OUString& sLastName )
-{
- try
- {
- m_xData->setPropertyValue(s_ssn, css::uno::makeAny(::rtl::OUString(sLastName)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-void SvtUserOptions_Impl::SetID( const ::rtl::OUString& sID )
-{
- try
- {
- m_xData->setPropertyValue(s_sinitials, css::uno::makeAny(::rtl::OUString(sID)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetStreet( const ::rtl::OUString& sStreet )
-{
- try
- {
- m_xData->setPropertyValue(s_sstreet, css::uno::makeAny(::rtl::OUString(sStreet)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetCity( const ::rtl::OUString& sCity )
-{
- try
- {
- m_xData->setPropertyValue(s_sl, css::uno::makeAny(::rtl::OUString(sCity)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetState( const ::rtl::OUString& sState )
-{
- try
- {
- m_xData->setPropertyValue(s_sst, css::uno::makeAny(::rtl::OUString(sState)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetZip( const ::rtl::OUString& sZip )
-{
- try
- {
- m_xData->setPropertyValue(s_spostalcode, css::uno::makeAny(::rtl::OUString(sZip)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetCountry( const ::rtl::OUString& sCountry )
-{
- try
- {
- m_xData->setPropertyValue(s_sc, css::uno::makeAny(::rtl::OUString(sCountry)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetPosition( const ::rtl::OUString& sPosition )
-{
- try
- {
- m_xData->setPropertyValue(s_sposition, css::uno::makeAny(::rtl::OUString(sPosition)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetTitle( const ::rtl::OUString& sTitle )
-{
- try
- {
- m_xData->setPropertyValue(s_stitle, css::uno::makeAny(::rtl::OUString(sTitle)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetTelephoneHome( const ::rtl::OUString& sTelephoneHome )
-{
- try
- {
- m_xData->setPropertyValue(s_shomephone, css::uno::makeAny(::rtl::OUString(sTelephoneHome)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetTelephoneWork( const ::rtl::OUString& sTelephoneWork )
-{
- try
- {
- m_xData->setPropertyValue(s_stelephonenumber, css::uno::makeAny(::rtl::OUString(sTelephoneWork)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetFax( const ::rtl::OUString& sFax )
-{
- try
- {
- m_xData->setPropertyValue(s_sfacsimiletelephonenumber, css::uno::makeAny(::rtl::OUString(sFax)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetEmail( const ::rtl::OUString& sEmail )
-{
- try
- {
- m_xData->setPropertyValue(s_smail, css::uno::makeAny(::rtl::OUString(sEmail)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetCustomerNumber( const ::rtl::OUString& sCustomerNumber )
-{
- try
- {
- m_xData->setPropertyValue(s_scustomernumber, css::uno::makeAny(::rtl::OUString(sCustomerNumber)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetFathersName( const ::rtl::OUString& sFathersName )
-{
- try
- {
- m_xData->setPropertyValue(s_sfathersname, css::uno::makeAny(::rtl::OUString(sFathersName)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-void SvtUserOptions_Impl::SetApartment( const ::rtl::OUString& sApartment )
-{
- try
- {
- m_xData->setPropertyValue(s_sapartment, css::uno::makeAny(::rtl::OUString(sApartment)));
- ::comphelper::ConfigurationHelper::flush(m_xCfg);
- }
- catch ( const css::uno::Exception& ex)
- {
- LogHelper::logIt(ex);
- }
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions_Impl::GetFullName() const
-{
- ::rtl::OUString sFullName;
-
- sFullName = GetFirstName();
- sFullName.trim();
- if ( sFullName.getLength() )
- sFullName += ::rtl::OUString::createFromAscii(" ");
- sFullName += GetLastName();
- sFullName.trim();
-
- return sFullName;
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions_Impl::Notify()
-{
- Broadcast( SfxSimpleHint( SFX_HINT_USER_OPTIONS_CHANGED ) );
-}
-// -----------------------------------------------------------------------
-
-sal_Bool SvtUserOptions_Impl::IsTokenReadonly( USHORT nToken ) const
-{
- css::uno::Reference< css::beans::XPropertySet > xData(m_xCfg, css::uno::UNO_QUERY);
- css::uno::Reference< css::beans::XPropertySetInfo > xInfo = xData->getPropertySetInfo();
- css::beans::Property aProp;
- sal_Bool bRet = sal_False;
-
- switch ( nToken )
- {
- case USER_OPT_COMPANY:
- {
- aProp = xInfo->getPropertyByName(s_so);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_FIRSTNAME:
- {
- aProp = xInfo->getPropertyByName(s_sgivenname);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_LASTNAME:
- {
- aProp = xInfo->getPropertyByName(s_ssn);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_ID:
- {
- aProp = xInfo->getPropertyByName(s_sinitials);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_STREET:
- {
- aProp = xInfo->getPropertyByName(s_sstreet);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_CITY:
- {
- aProp = xInfo->getPropertyByName(s_sl);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_STATE:
- {
- aProp = xInfo->getPropertyByName(s_sst);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_ZIP:
- {
- aProp = xInfo->getPropertyByName(s_spostalcode);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_COUNTRY:
- {
- aProp = xInfo->getPropertyByName(s_sc);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_POSITION:
- {
- aProp = xInfo->getPropertyByName(s_sposition);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_TITLE:
- {
- aProp = xInfo->getPropertyByName(s_stitle);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_TELEPHONEHOME:
- {
- aProp = xInfo->getPropertyByName(s_shomephone);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_TELEPHONEWORK:
- {
- aProp = xInfo->getPropertyByName(s_stelephonenumber);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_FAX:
- {
- aProp = xInfo->getPropertyByName(s_sfacsimiletelephonenumber);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_EMAIL:
- {
- aProp = xInfo->getPropertyByName(s_smail);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_FATHERSNAME:
- {
- aProp = xInfo->getPropertyByName(s_sfathersname);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- case USER_OPT_APARTMENT:
- {
- aProp = xInfo->getPropertyByName(s_sapartment);
- bRet = ((aProp.Attributes & css::beans::PropertyAttribute::READONLY) == css::beans::PropertyAttribute::READONLY);
- break;
- }
- default:
- DBG_ERRORFILE( "SvtUserOptions_Impl::IsTokenReadonly(): invalid token" );
- }
-
- return bRet;
-}
-
-//------------------------------------------------------------------------
-::rtl::OUString SvtUserOptions_Impl::GetToken(USHORT nToken) const
-{
- ::rtl::OUString pRet;
- switch(nToken)
- {
- case USER_OPT_COMPANY: pRet = GetCompany(); break;
- case USER_OPT_FIRSTNAME: pRet = GetFirstName(); break;
- case USER_OPT_LASTNAME: pRet = GetLastName(); break;
- case USER_OPT_ID: pRet = GetID(); break;
- case USER_OPT_STREET: pRet = GetStreet(); break;
- case USER_OPT_CITY: pRet = GetCity(); break;
- case USER_OPT_STATE: pRet = GetState(); break;
- case USER_OPT_ZIP: pRet = GetZip(); break;
- case USER_OPT_COUNTRY: pRet = GetCountry(); break;
- case USER_OPT_POSITION: pRet = GetPosition(); break;
- case USER_OPT_TITLE: pRet = GetTitle(); break;
- case USER_OPT_TELEPHONEHOME: pRet = GetTelephoneHome(); break;
- case USER_OPT_TELEPHONEWORK: pRet = GetTelephoneWork(); break;
- case USER_OPT_FAX: pRet = GetFax(); break;
- case USER_OPT_EMAIL: pRet = GetEmail(); break;
- case USER_OPT_FATHERSNAME: pRet = GetFathersName(); break;
- case USER_OPT_APARTMENT: pRet = GetApartment(); break;
- default:
- DBG_ERRORFILE( "SvtUserOptions_Impl::GetToken(): invalid token" );
- }
- return pRet;
-}
-
-// class SvtUserOptions --------------------------------------------------
-
-SvtUserOptions::SvtUserOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( GetInitMutex() );
-
- if ( !pOptions )
- {
- RTL_LOGFILE_CONTEXT(aLog, "svtools ( ??? ) ::SvtUserOptions_Impl::ctor()");
- pOptions = new SvtUserOptions_Impl;
-
- ItemHolder2::holdConfigItem(E_USEROPTIONS);
- }
- ++nRefCount;
- pImp = pOptions;
- StartListening( *pImp);
-}
-
-// -----------------------------------------------------------------------
-
-SvtUserOptions::~SvtUserOptions()
-{
- // Global access, must be guarded (multithreading)
- ::osl::MutexGuard aGuard( GetInitMutex() );
-
- if ( !--nRefCount )
- {
- //if ( pOptions->IsModified() )
- // pOptions->Commit();
- DELETEZ( pOptions );
- }
-}
-
-// -----------------------------------------------------------------------
-
-::osl::Mutex& SvtUserOptions::GetInitMutex()
-{
- // Initialize static mutex only for one time!
- static ::osl::Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if ( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again -
- // because another instance of our class will be faster then this instance!
- if ( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetCompany() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetCompany();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetFirstName() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetFirstName();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetLastName() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetLastName();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetID() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetID();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetStreet() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetStreet();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetCity() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetCity();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetState() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetState();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetZip() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetZip();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetCountry() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetCountry();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetPosition() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetPosition();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetTitle() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetTitle();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetTelephoneHome() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetTelephoneHome();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetTelephoneWork() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetTelephoneWork();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetFax() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetFax();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetEmail() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetEmail();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetCustomerNumber() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetCustomerNumber();
-}
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetFathersName() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetFathersName() ;
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetApartment() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetApartment();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetFullName() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetFullName();
-}
-
-// -----------------------------------------------------------------------
-
-::rtl::OUString SvtUserOptions::GetLocale() const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetLocale();
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetCompany( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetCompany( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetFirstName( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetFirstName( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetLastName( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetLastName( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetID( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetID( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetStreet( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetStreet( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetCity( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetCity( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetState( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetState( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetZip( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetZip( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetCountry( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetCountry( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetPosition( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetPosition( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetTitle( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetTitle( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetTelephoneHome( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetTelephoneHome( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetTelephoneWork( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetTelephoneWork( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetFax( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetFax( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetEmail( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetEmail( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetCustomerNumber( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetCustomerNumber( rNewToken );
-}
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetFathersName( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetFathersName( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-void SvtUserOptions::SetApartment( const ::rtl::OUString& rNewToken )
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- pImp->SetApartment( rNewToken );
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool SvtUserOptions::IsTokenReadonly( USHORT nToken ) const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->IsTokenReadonly( nToken );
-}
-//------------------------------------------------------------------------
-::rtl::OUString SvtUserOptions::GetToken(USHORT nToken) const
-{
- ::osl::MutexGuard aGuard( GetInitMutex() );
- return pImp->GetToken( nToken );
-}
-/* -----------------07.07.2003 09:30-----------------
-
- --------------------------------------------------*/
-void SvtUserOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
-{
- vos::OGuard aVclGuard( Application::GetSolarMutex() );
- Broadcast( rHint );
-}
diff --git a/svtools/source/config/viewoptions.cxx b/svtools/source/config/viewoptions.cxx
deleted file mode 100644
index d4c8d65dbe04..000000000000
--- a/svtools/source/config/viewoptions.cxx
+++ /dev/null
@@ -1,1304 +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: viewoptions.cxx,v $
- * $Revision: 1.29.236.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/viewoptions.hxx>
-#include <com/sun/star/uno/Any.hxx>
-
-#include <hash_map>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <rtl/ustrbuf.hxx>
-#include <unotools/configpathes.hxx>
-#include <comphelper/configurationhelper.hxx>
-#include <unotools/processfactory.hxx>
-
-#include <itemholder1.hxx>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-namespace css = ::com::sun::star;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#ifdef CONST_ASCII
- #error "Who define CONST_ASCII before! I use it to create const ascii strings ..."
-#else
- #define CONST_ASCII(SASCIIVALUE) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SASCIIVALUE))
-#endif
-
-#define PATHSEPERATOR CONST_ASCII("/")
-
-#define PACKAGE_VIEWS CONST_ASCII("org.openoffice.Office.Views")
-
-#define LIST_DIALOGS CONST_ASCII("Dialogs" )
-#define LIST_TABDIALOGS CONST_ASCII("TabDialogs")
-#define LIST_TABPAGES CONST_ASCII("TabPages" )
-#define LIST_WINDOWS CONST_ASCII("Windows" )
-
-#define PROPERTY_WINDOWSTATE CONST_ASCII("WindowState")
-#define PROPERTY_PAGEID CONST_ASCII("PageID" )
-#define PROPERTY_VISIBLE CONST_ASCII("Visible" )
-#define PROPERTY_USERDATA CONST_ASCII("UserData" )
-
-#define PROPCOUNT_DIALOGS 1
-#define PROPCOUNT_TABDIALOGS 2
-#define PROPCOUNT_TABPAGES 1
-#define PROPCOUNT_WINDOWS 2
-
-#define DEFAULT_WINDOWSTATE ::rtl::OUString()
-#define DEFAULT_USERDATA css::uno::Sequence< css::beans::NamedValue >()
-#define DEFAULT_PAGEID 0
-#define DEFAULT_VISIBLE sal_False
-
-//#define DEBUG_VIEWOPTIONS
-
-#ifdef DEBUG_VIEWOPTIONS
- #define _LOG_COUNTER_( _SVIEW_, _NREAD_, _NWRITE_ ) \
- { \
- FILE* pFile = fopen( "viewdbg.txt", "a" ); \
- fprintf( pFile, "%s[%d, %d]\n", ::rtl::OUStringToOString(_SVIEW_, RTL_TEXTENCODING_UTF8).getStr(), _NREAD_, _NWRITE_ ); \
- fclose( pFile ); \
- }
-#endif // DEBUG_VIEWOPTIONS
-
-#define SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION) \
- { \
- ::rtl::OUStringBuffer sMsg(256); \
- sMsg.appendAscii("Unexpected exception catched. Original message was:\n\"" ); \
- sMsg.append (SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION_PARAM_EXCEPTION.Message); \
- sMsg.appendAscii("\"" ); \
- OSL_ENSURE(sal_False, ::rtl::OUStringToOString(sMsg.makeStringAndClear(), RTL_TEXTENCODING_UTF8).getStr()); \
- }
-
-//_________________________________________________________________________________________________________________
-// initialization!
-//_________________________________________________________________________________________________________________
-
-SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Dialogs = NULL ;
-sal_Int32 SvtViewOptions::m_nRefCount_Dialogs = 0 ;
-SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_TabDialogs = NULL ;
-sal_Int32 SvtViewOptions::m_nRefCount_TabDialogs = 0 ;
-SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_TabPages = NULL ;
-sal_Int32 SvtViewOptions::m_nRefCount_TabPages = 0 ;
-SvtViewOptionsBase_Impl* SvtViewOptions::m_pDataContainer_Windows = NULL ;
-sal_Int32 SvtViewOptions::m_nRefCount_Windows = 0 ;
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-/*-************************************************************************************************************//**
- @descr declare one configuration item
- These struct hold information about one view item. But not all member are used for all entries!
- User must decide which information are usefull and which not. We are a container iztem only and doesnt
- know anything about the context.
- But; we support a feature:
- decision between items with default values (should not realy exist in configuration!)
- and items with real values - changed by user. So user can suppress saving of realy unused items
- to disk - because; defaulted items could be restored on runtime without reading from disk!!!
- And if only items with valid information was written to cfg - we mustn't read so much and save time.
- So we start with an member m_bDefault=True and reset it to False after first set-call.
- Deficiencies of these solution - we cant allow direct read/write access to our member. We must
- support it by set/get-methods ...
-*//*-*************************************************************************************************************/
-class IMPL_TViewData
-{
- public:
- //---------------------------------------------------------------------------------------------------------
- // create "default" item
- IMPL_TViewData()
- {
- m_sWindowState = DEFAULT_WINDOWSTATE ;
- m_lUserData = DEFAULT_USERDATA ;
- m_nPageID = DEFAULT_PAGEID ;
- m_bVisible = DEFAULT_VISIBLE ;
-
- m_bDefault = sal_True ;
- }
-
- //---------------------------------------------------------------------------------------------------------
- // write access - with reseting of default state
- void setWindowState( const ::rtl::OUString& sValue )
- {
- m_bDefault = (
- ( m_bDefault == sal_True ) &&
- ( sValue == DEFAULT_WINDOWSTATE )
- );
- m_sWindowState = sValue;
- }
-
- //---------------------------------------------------------------------------------------------------------
- void setUserData( const css::uno::Sequence< css::beans::NamedValue >& lValue )
- {
- m_bDefault = (
- ( m_bDefault == sal_True ) &&
- ( lValue == DEFAULT_USERDATA )
- );
- m_lUserData = lValue;
- }
-
- //---------------------------------------------------------------------------------------------------------
- void setPageID( sal_Int32 nValue )
- {
- m_bDefault = (
- ( m_bDefault == sal_True ) &&
- ( nValue == DEFAULT_PAGEID )
- );
- m_nPageID = nValue;
- }
-
- //---------------------------------------------------------------------------------------------------------
- void setVisible( sal_Bool bValue )
- {
- m_bDefault = (
- ( m_bDefault == sal_True ) &&
- ( bValue == DEFAULT_VISIBLE )
- );
- m_bVisible = bValue;
- }
-
- //---------------------------------------------------------------------------------------------------------
- // read access
- ::rtl::OUString getWindowState() { return m_sWindowState; }
- css::uno::Sequence< css::beans::NamedValue > getUserData () { return m_lUserData ; }
- sal_Int32 getPageID () { return m_nPageID ; }
- sal_Bool getVisible () { return m_bVisible ; }
-
- //---------------------------------------------------------------------------------------------------------
- // special operation for easy access on user data
- void setUserItem( const ::rtl::OUString& sName ,
- const css::uno::Any& aValue )
- {
- // we change UserData in every case!
- // a) we change already existing item
- // or b) we add a new one
- m_bDefault = sal_False;
-
- sal_Bool bExist = sal_False;
- sal_Int32 nCount = m_lUserData.getLength();
-
- // change it, if it already exist ...
- for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
- {
- if( m_lUserData[nStep].Name == sName )
- {
- m_lUserData[nStep].Value = aValue ;
- bExist = sal_True;
- break;
- }
- }
-
- // ... or create new list item
- if( bExist == sal_False )
- {
- m_lUserData.realloc( nCount+1 );
- m_lUserData[nCount].Name = sName ;
- m_lUserData[nCount].Value = aValue ;
- }
- }
-
- //---------------------------------------------------------------------------------------------------------
- css::uno::Any getUserItem( const ::rtl::OUString& sName )
- {
- // default value - if item not exist!
- css::uno::Any aValue;
-
- sal_Int32 nCount = m_lUserData.getLength();
- for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
- {
- if( m_lUserData[nStep].Name == sName )
- {
- aValue = m_lUserData[nStep].Value;
- break;
- }
- }
- return aValue;
- }
-
- //---------------------------------------------------------------------------------------------------------
- // check for default items
- sal_Bool isDefault() { return m_bDefault; }
-
- private:
- ::rtl::OUString m_sWindowState ;
- css::uno::Sequence< css::beans::NamedValue > m_lUserData ;
- sal_Int32 m_nPageID ;
- sal_Bool m_bVisible ;
-
- sal_Bool m_bDefault ;
-};
-
-struct IMPL_TStringHashCode
-{
- size_t operator()(const ::rtl::OUString& sString) const
- {
- return sString.hashCode();
- }
-};
-
-typedef ::std::hash_map< ::rtl::OUString ,
- IMPL_TViewData ,
- IMPL_TStringHashCode ,
- ::std::equal_to< ::rtl::OUString > > IMPL_TViewHash;
-
-/*-************************************************************************************************************//**
- @descr Implement base data container for view options elements.
- Every item support ALL possible configuration informations.
- But not every superclass should use them! Because some view types don't
- have it realy.
-
- @attention We implement a write-througt-cache! We use it for reading - but write all changes directly to
- configuration. (changes are made on internal cache too!). So it's easier to distinguish
- between added/changed/removed elements without any complex mask or bool flag informations.
- Caches from configuration and our own one are synchronized every time - if we do so.
-*//*-*************************************************************************************************************/
-class SvtViewOptionsBase_Impl
-{
- //-------------------------------------------------------------------------------------------------------------
- public:
- SvtViewOptionsBase_Impl ( const ::rtl::OUString& sList );
- virtual ~SvtViewOptionsBase_Impl ( );
- sal_Bool Exists ( const ::rtl::OUString& sName );
- sal_Bool Delete ( const ::rtl::OUString& sName );
- ::rtl::OUString GetWindowState ( const ::rtl::OUString& sName );
- void SetWindowState ( const ::rtl::OUString& sName ,
- const ::rtl::OUString& sState );
- css::uno::Sequence< css::beans::NamedValue > GetUserData ( const ::rtl::OUString& sName );
- void SetUserData ( const ::rtl::OUString& sName ,
- const css::uno::Sequence< css::beans::NamedValue >& lData );
- sal_Int32 GetPageID ( const ::rtl::OUString& sName );
- void SetPageID ( const ::rtl::OUString& sName ,
- sal_Int32 nID );
- sal_Bool GetVisible ( const ::rtl::OUString& sName );
- void SetVisible ( const ::rtl::OUString& sName ,
- sal_Bool bVisible );
- css::uno::Any GetUserItem ( const ::rtl::OUString& sName ,
- const ::rtl::OUString& sItem );
- void SetUserItem ( const ::rtl::OUString& sName ,
- const ::rtl::OUString& sItem ,
- const css::uno::Any& aValue );
-
- //-------------------------------------------------------------------------------------------------------------
- private:
- css::uno::Reference< css::uno::XInterface > impl_getSetNode( const ::rtl::OUString& sNode ,
- sal_Bool bCreateIfMissing);
-
- //-------------------------------------------------------------------------------------------------------------
- private:
- ::rtl::OUString m_sListName;
- css::uno::Reference< css::container::XNameAccess > m_xRoot;
- css::uno::Reference< css::container::XNameAccess > m_xSet;
-
- #ifdef DEBUG_VIEWOPTIONS
- sal_Int32 m_nReadCount ;
- sal_Int32 m_nWriteCount ;
- #endif
-};
-
-/*-************************************************************************************************************//**
- @descr Implement the base data container.
-*//*-*************************************************************************************************************/
-
-/*-************************************************************************************************************//**
- @short ctor
- @descr We use it to open right configuration file and let configuration objects fill her caches.
- Then we read all existing entries from right list and cached it inside our object too.
- Normaly we should enable notifications for changes on these values too ... but these feature
- isn't full implemented in the moment.
-
- @seealso baseclass ::utl::ConfigItem
- @seealso method Notify()
-
- @param -
- @return -
-
- @last change 19.10.2001 07:54
-*//*-*************************************************************************************************************/
-SvtViewOptionsBase_Impl::SvtViewOptionsBase_Impl( const ::rtl::OUString& sList )
- : m_sListName ( sList ) // we must know, which view type we must support
- #ifdef DEBUG_VIEWOPTIONS
- , m_nReadCount ( 0 )
- , m_nWriteCount( 0 )
- #endif
-{
- try
- {
- m_xRoot = css::uno::Reference< css::container::XNameAccess >(
- ::comphelper::ConfigurationHelper::openConfig(
- ::utl::getProcessServiceFactory(),
- PACKAGE_VIEWS,
- ::comphelper::ConfigurationHelper::E_STANDARD),
- css::uno::UNO_QUERY);
- if (m_xRoot.is())
- m_xRoot->getByName(sList) >>= m_xSet;
- }
- catch(const css::uno::Exception& ex)
- {
- m_xRoot.clear();
- m_xSet.clear();
-
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-}
-
-/*-************************************************************************************************************//**
- @short dtor
- @descr clean up something
-
- @attention We implement a write through cache! So we mustn't do it realy. All changes was written to cfg directly.
- Commit isn't neccessary then.
-
- @seealso baseclass ::utl::ConfigItem
- @seealso method IsModified()
- @seealso method SetModified()
- @seealso method Commit()
-
- @param -
- @return -
-
- @last change 19.10.2001 08:02
-*//*-*************************************************************************************************************/
-SvtViewOptionsBase_Impl::~SvtViewOptionsBase_Impl()
-{
- // dont flush configuration changes here to m_xRoot.
- // That must be done inside every SetXXX() method already !
- // Here its to late - DisposedExceptions from used configuration access can occure otherwise.
-
- m_xRoot.clear();
- m_xSet.clear();
-
- #ifdef DEBUG_VIEWOPTIONS
- _LOG_COUNTER_( m_sListName, m_nReadCount, m_nWriteCount )
- #endif // DEBUG_VIEWOPTIONS
-}
-
-/*-************************************************************************************************************//**
- @short checks for already existing entries
- @descr If user don't know, if an entry already exist - he can get this information by calling this method.
-
- @seealso member m_aList
-
- @param "sName", name of entry to check exist state
- @return true , if item exist
- false, otherwise
-*//*-*************************************************************************************************************/
-sal_Bool SvtViewOptionsBase_Impl::Exists( const ::rtl::OUString& sName )
-{
- sal_Bool bExists = sal_False;
-
- try
- {
- if (m_xSet.is())
- bExists = m_xSet->hasByName(sName);
- }
- catch(const css::uno::Exception& ex)
- {
- bExists = sal_False;
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return bExists;
-}
-
-/*-************************************************************************************************************//**
- @short delete entry
- @descr Use it to delete set entry by given name.
-
- @seealso member m_aList
-
- @param "sName", name of entry to delete it
- @return true , if item not exist(!) or could be deleted (should be the same!)
- false, otherwise
-*//*-*************************************************************************************************************/
-sal_Bool SvtViewOptionsBase_Impl::Delete( const ::rtl::OUString& sName )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nWriteCount;
- #endif
-
- sal_Bool bDeleted = sal_False;
- try
- {
- css::uno::Reference< css::container::XNameContainer > xSet(m_xSet, css::uno::UNO_QUERY_THROW);
- xSet->removeByName(sName);
- bDeleted = sal_True;
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::container::NoSuchElementException&)
- { bDeleted = sal_True; }
- catch(const css::uno::Exception& ex)
- {
- bDeleted = sal_False;
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return bDeleted;
-}
-
-/*-************************************************************************************************************//**
- @short read/write access to cache view items and her properties
- @descr Follow methods support read/write access to all cache view items.
-
- @seealso member m_sList
-
- @param -
- @return -
-*//*-*************************************************************************************************************/
-::rtl::OUString SvtViewOptionsBase_Impl::GetWindowState( const ::rtl::OUString& sName )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nReadCount;
- #endif
-
- ::rtl::OUString sWindowState;
- try
- {
- css::uno::Reference< css::beans::XPropertySet > xNode(
- impl_getSetNode(sName, sal_False),
- css::uno::UNO_QUERY);
- if (xNode.is())
- xNode->getPropertyValue(PROPERTY_WINDOWSTATE) >>= sWindowState;
- }
- catch(const css::uno::Exception& ex)
- {
- sWindowState = ::rtl::OUString();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return sWindowState;
-}
-
-//*****************************************************************************************************************
-void SvtViewOptionsBase_Impl::SetWindowState( const ::rtl::OUString& sName ,
- const ::rtl::OUString& sState )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nWriteCount;
- #endif
-
- try
- {
- css::uno::Reference< css::beans::XPropertySet > xNode(
- impl_getSetNode(sName, sal_True),
- css::uno::UNO_QUERY_THROW);
- xNode->setPropertyValue(PROPERTY_WINDOWSTATE, css::uno::makeAny(sState));
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-}
-
-//*****************************************************************************************************************
-css::uno::Sequence< css::beans::NamedValue > SvtViewOptionsBase_Impl::GetUserData( const ::rtl::OUString& sName )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nReadCount;
- #endif
-
- try
- {
- css::uno::Reference< css::container::XNameAccess > xNode(
- impl_getSetNode(sName, sal_False),
- css::uno::UNO_QUERY); // no _THROW ! because we dont create missing items here. So we have to live with zero references .-)
- css::uno::Reference< css::container::XNameAccess > xUserData;
- if (xNode.is())
- xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
- if (xUserData.is())
- {
- const css::uno::Sequence< ::rtl::OUString > lNames = xUserData->getElementNames();
- const ::rtl::OUString* pNames = lNames.getConstArray();
- sal_Int32 c = lNames.getLength();
- sal_Int32 i = 0;
- css::uno::Sequence< css::beans::NamedValue > lUserData(c);
-
- for (i=0; i<c; ++i)
- {
- lUserData[i].Name = pNames[i];
- lUserData[i].Value = xUserData->getByName(pNames[i]);
- }
-
- return lUserData;
- }
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return css::uno::Sequence< css::beans::NamedValue >();
-}
-
-//*****************************************************************************************************************
-void SvtViewOptionsBase_Impl::SetUserData( const ::rtl::OUString& sName ,
- const css::uno::Sequence< css::beans::NamedValue >& lData )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nWriteCount;
- #endif
-
- try
- {
- css::uno::Reference< css::container::XNameAccess > xNode(
- impl_getSetNode(sName, sal_True),
- css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::container::XNameContainer > xUserData;
- xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
- if (xUserData.is())
- {
- const css::beans::NamedValue* pData = lData.getConstArray();
- sal_Int32 c = lData.getLength();
- sal_Int32 i = 0;
- for (i=0; i<c; ++i)
- {
- if (xUserData->hasByName(pData[i].Name))
- xUserData->replaceByName(pData[i].Name, pData[i].Value);
- else
- xUserData->insertByName(pData[i].Name, pData[i].Value);
- }
- }
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-}
-
-//*****************************************************************************************************************
-css::uno::Any SvtViewOptionsBase_Impl::GetUserItem( const ::rtl::OUString& sName ,
- const ::rtl::OUString& sItem )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nReadCount;
- #endif
-
- css::uno::Any aItem;
- try
- {
- css::uno::Reference< css::container::XNameAccess > xNode(
- impl_getSetNode(sName, sal_False),
- css::uno::UNO_QUERY);
- css::uno::Reference< css::container::XNameAccess > xUserData;
- if (xNode.is())
- xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
- if (xUserData.is())
- aItem = xUserData->getByName(sItem);
- }
- catch(const css::container::NoSuchElementException&)
- { aItem.clear(); }
- catch(const css::uno::Exception& ex)
- {
- aItem.clear();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return aItem;
-}
-
-//*****************************************************************************************************************
-void SvtViewOptionsBase_Impl::SetUserItem( const ::rtl::OUString& sName ,
- const ::rtl::OUString& sItem ,
- const css::uno::Any& aValue )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nWriteCount;
- #endif
-
- try
- {
- css::uno::Reference< css::container::XNameAccess > xNode(
- impl_getSetNode(sName, sal_True),
- css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::container::XNameContainer > xUserData;
- xNode->getByName(PROPERTY_USERDATA) >>= xUserData;
- if (xUserData.is())
- {
- if (xUserData->hasByName(sItem))
- xUserData->replaceByName(sItem, aValue);
- else
- xUserData->insertByName(sItem, aValue);
- }
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-}
-
-//*****************************************************************************************************************
-sal_Int32 SvtViewOptionsBase_Impl::GetPageID( const ::rtl::OUString& sName )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nReadCount;
- #endif
-
- sal_Int32 nID = 0;
- try
- {
- css::uno::Reference< css::beans::XPropertySet > xNode(
- impl_getSetNode(sName, sal_False),
- css::uno::UNO_QUERY);
- if (xNode.is())
- xNode->getPropertyValue(PROPERTY_PAGEID) >>= nID;
- }
- catch(const css::uno::Exception& ex)
- {
- nID = 0;
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return nID;
-}
-
-//*****************************************************************************************************************
-void SvtViewOptionsBase_Impl::SetPageID( const ::rtl::OUString& sName ,
- sal_Int32 nID )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nWriteCount;
- #endif
-
- try
- {
- css::uno::Reference< css::beans::XPropertySet > xNode(
- impl_getSetNode(sName, sal_True),
- css::uno::UNO_QUERY_THROW);
- xNode->setPropertyValue(PROPERTY_PAGEID, css::uno::makeAny(nID));
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-}
-
-//*****************************************************************************************************************
-sal_Bool SvtViewOptionsBase_Impl::GetVisible( const ::rtl::OUString& sName )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nReadCount;
- #endif
-
- sal_Bool bVisible = sal_False;
- try
- {
- css::uno::Reference< css::beans::XPropertySet > xNode(
- impl_getSetNode(sName, sal_False),
- css::uno::UNO_QUERY);
- if (xNode.is())
- xNode->getPropertyValue(PROPERTY_VISIBLE) >>= bVisible;
- }
- catch(const css::uno::Exception& ex)
- {
- bVisible = sal_False;
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return bVisible;
-}
-
-//*****************************************************************************************************************
-void SvtViewOptionsBase_Impl::SetVisible( const ::rtl::OUString& sName ,
- sal_Bool bVisible )
-{
- #ifdef DEBUG_VIEWOPTIONS
- ++m_nWriteCount;
- #endif
-
- try
- {
- css::uno::Reference< css::beans::XPropertySet > xNode(
- impl_getSetNode(sName, sal_True),
- css::uno::UNO_QUERY_THROW);
- xNode->setPropertyValue(PROPERTY_VISIBLE, css::uno::makeAny(bVisible));
- ::comphelper::ConfigurationHelper::flush(m_xRoot);
- }
- catch(const css::uno::Exception& ex)
- {
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-}
-
-/*-************************************************************************************************************//**
- @short create new set node with default values on disk
- @descr To create a new UserData item - the super node of these property must already exist!
- You can call this method to create these new entry with default values and change UserData then.
-
- @seealso method impl_writeDirectProp()
-
- @param "sNode", name of new entry
- @return -
-
- @last change 19.10.2001 08:42
-*//*-*************************************************************************************************************/
-css::uno::Reference< css::uno::XInterface > SvtViewOptionsBase_Impl::impl_getSetNode( const ::rtl::OUString& sNode ,
- sal_Bool bCreateIfMissing)
-{
- css::uno::Reference< css::uno::XInterface > xNode;
-
- try
- {
- if (bCreateIfMissing)
- xNode = ::comphelper::ConfigurationHelper::makeSureSetNodeExists(m_xRoot, m_sListName, sNode);
- else
- {
- if (m_xSet.is())
- m_xSet->getByName(sNode) >>= xNode;
- }
- }
- catch(const css::container::NoSuchElementException&)
- { xNode.clear(); }
- catch(const css::uno::Exception& ex)
- {
- xNode.clear();
- SVTVIEWOPTIONS_LOG_UNEXPECTED_EXCEPTION(ex)
- }
-
- return xNode;
-}
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtViewOptions::SvtViewOptions( EViewType eType ,
- const ::rtl::OUString& sViewName )
- : m_eViewType ( eType )
- , m_sViewName ( sViewName )
-{
- // Global access, must be guarded (multithreading!)
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- // Search for right dat container for this view type and initialize right data container or set right ref count!
- switch( eType )
- {
- case E_DIALOG : {
- // Increase ref count for dialog data container first.
- ++m_nRefCount_Dialogs;
- // If these instance the first user of the dialog data container - create these impl static container!
- if( m_nRefCount_Dialogs == 1 )
- {
- //m_pDataContainer_Dialogs = new SvtViewDialogOptions_Impl( LIST_DIALOGS );
- m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG);
- }
- }
- break;
- case E_TABDIALOG : {
- // Increase ref count for tab-dialog data container first.
- ++m_nRefCount_TabDialogs;
- // If these instance the first user of the tab-dialog data container - create these impl static container!
- if( m_nRefCount_TabDialogs == 1 )
- {
- m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG);
- }
- }
- break;
- case E_TABPAGE : {
- // Increase ref count for tab-page data container first.
- ++m_nRefCount_TabPages;
- // If these instance the first user of the tab-page data container - create these impl static container!
- if( m_nRefCount_TabPages == 1 )
- {
- m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE);
- }
- }
- break;
- case E_WINDOW : {
- // Increase ref count for window data container first.
- ++m_nRefCount_Windows;
- // If these instance the first user of the window data container - create these impl static container!
- if( m_nRefCount_Windows == 1 )
- {
- m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW);
- }
- }
- break;
- default : OSL_ENSURE( sal_False, "SvtViewOptions::SvtViewOptions()\nThese view type is unknown! All following calls at these instance will do nothing!\n" );
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtViewOptions::~SvtViewOptions()
-{
- // Global access, must be guarded (multithreading!)
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- // Search for right dat container for this view type and deinitialize right data container or set right ref count!
- switch( m_eViewType )
- {
- case E_DIALOG : {
- // Decrease ref count for dialog data container first.
- --m_nRefCount_Dialogs;
- // If these instance the last user of the dialog data container - delete these impl static container!
- if( m_nRefCount_Dialogs == 0 )
- {
- delete m_pDataContainer_Dialogs;
- m_pDataContainer_Dialogs = NULL;
- }
- }
- break;
- case E_TABDIALOG : {
- // Decrease ref count for tab-dialog data container first.
- --m_nRefCount_TabDialogs;
- // If these instance the last user of the tab-dialog data container - delete these impl static container!
- if( m_nRefCount_TabDialogs == 0 )
- {
- delete m_pDataContainer_TabDialogs;
- m_pDataContainer_TabDialogs = NULL;
- }
- }
- break;
- case E_TABPAGE : {
- // Decrease ref count for tab-page data container first.
- --m_nRefCount_TabPages;
- // If these instance the last user of the tab-page data container - delete these impl static container!
- if( m_nRefCount_TabPages == 0 )
- {
- delete m_pDataContainer_TabPages;
- m_pDataContainer_TabPages = NULL;
- }
- }
- break;
- case E_WINDOW : {
- // Decrease ref count for window data container first.
- --m_nRefCount_Windows;
- // If these instance the last user of the window data container - delete these impl static container!
- if( m_nRefCount_Windows == 0 )
- {
- delete m_pDataContainer_Windows;
- m_pDataContainer_Windows = NULL;
- }
- }
- break;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtViewOptions::Exists() const
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- sal_Bool bExists = sal_False;
- switch( m_eViewType )
- {
- case E_DIALOG : {
- bExists = m_pDataContainer_Dialogs->Exists( m_sViewName );
- }
- break;
- case E_TABDIALOG : {
- bExists = m_pDataContainer_TabDialogs->Exists( m_sViewName );
- }
- break;
- case E_TABPAGE : {
- bExists = m_pDataContainer_TabPages->Exists( m_sViewName );
- }
- break;
- case E_WINDOW : {
- bExists = m_pDataContainer_Windows->Exists( m_sViewName );
- }
- break;
- }
- return bExists;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtViewOptions::Delete()
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- sal_Bool bState = sal_False;
- switch( m_eViewType )
- {
- case E_DIALOG : {
- bState = m_pDataContainer_Dialogs->Delete( m_sViewName );
- }
- break;
- case E_TABDIALOG : {
- bState = m_pDataContainer_TabDialogs->Delete( m_sViewName );
- }
- break;
- case E_TABPAGE : {
- bState = m_pDataContainer_TabPages->Delete( m_sViewName );
- }
- break;
- case E_WINDOW : {
- bState = m_pDataContainer_Windows->Delete( m_sViewName );
- }
- break;
- }
- return bState;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-::rtl::OUString SvtViewOptions::GetWindowState() const
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- ::rtl::OUString sState;
- switch( m_eViewType )
- {
- case E_DIALOG : {
- sState = m_pDataContainer_Dialogs->GetWindowState( m_sViewName );
- }
- break;
- case E_TABDIALOG : {
- sState = m_pDataContainer_TabDialogs->GetWindowState( m_sViewName );
- }
- break;
- case E_TABPAGE : {
- sState = m_pDataContainer_TabPages->GetWindowState( m_sViewName );
- }
- break;
- case E_WINDOW : {
- sState = m_pDataContainer_Windows->GetWindowState( m_sViewName );
- }
- break;
- }
- return sState;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtViewOptions::SetWindowState( const ::rtl::OUString& sState )
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- switch( m_eViewType )
- {
- case E_DIALOG : {
- m_pDataContainer_Dialogs->SetWindowState( m_sViewName, sState );
- }
- break;
- case E_TABDIALOG : {
- m_pDataContainer_TabDialogs->SetWindowState( m_sViewName, sState );
- }
- break;
- case E_TABPAGE : {
- m_pDataContainer_TabPages->SetWindowState( m_sViewName, sState );
- }
- break;
- case E_WINDOW : {
- m_pDataContainer_Windows->SetWindowState( m_sViewName, sState );
- }
- break;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Int32 SvtViewOptions::GetPageID() const
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- // Safe impossible cases.
- // These call isn't allowed for dialogs, tab-pages or windows!
- OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::GetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" );
-
- sal_Int32 nID = 0;
- if( m_eViewType == E_TABDIALOG )
- nID = m_pDataContainer_TabDialogs->GetPageID( m_sViewName );
- return nID;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtViewOptions::SetPageID( sal_Int32 nID )
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- // Safe impossible cases.
- // These call isn't allowed for dialogs, tab-pages or windows!
- OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABPAGE||m_eViewType==E_WINDOW), "SvtViewOptions::SetPageID()\nCall not allowed for Dialogs, TabPages or Windows! I do nothing!\n" );
-
- if( m_eViewType == E_TABDIALOG )
- m_pDataContainer_TabDialogs->SetPageID( m_sViewName, nID );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-sal_Bool SvtViewOptions::IsVisible() const
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- // Safe impossible cases.
- // These call isn't allowed for dialogs, tab-dialogs or tab-pages!
- OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::IsVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" );
-
- sal_Bool bState = sal_False;
- if( m_eViewType == E_WINDOW )
- bState = m_pDataContainer_Windows->GetVisible( m_sViewName );
-
- return bState;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtViewOptions::SetVisible( sal_Bool bState )
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- // Safe impossible cases.
- // These call isn't allowed for dialogs, tab-dialogs or tab-pages!
- OSL_ENSURE( !(m_eViewType==E_DIALOG||m_eViewType==E_TABDIALOG||m_eViewType==E_TABPAGE), "SvtViewOptions::SetVisible()\nCall not allowed for Dialogs, TabDialogs or TabPages! I do nothing!\n" );
-
- if( m_eViewType == E_WINDOW )
- m_pDataContainer_Windows->SetVisible( m_sViewName, bState );
-}
-
-//*****************************************************************************************************************
-css::uno::Sequence< css::beans::NamedValue > SvtViewOptions::GetUserData() const
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- css::uno::Sequence< css::beans::NamedValue > lData;
- switch( m_eViewType )
- {
- case E_DIALOG : {
- lData = m_pDataContainer_Dialogs->GetUserData( m_sViewName );
- }
- break;
- case E_TABDIALOG : {
- lData = m_pDataContainer_TabDialogs->GetUserData( m_sViewName );
- }
- break;
- case E_TABPAGE : {
- lData = m_pDataContainer_TabPages->GetUserData( m_sViewName );
- }
- break;
- case E_WINDOW : {
- lData = m_pDataContainer_Windows->GetUserData( m_sViewName );
- }
- break;
- }
- return lData;
-}
-
-//*****************************************************************************************************************
-void SvtViewOptions::SetUserData( const css::uno::Sequence< css::beans::NamedValue >& lData )
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- switch( m_eViewType )
- {
- case E_DIALOG : {
- m_pDataContainer_Dialogs->SetUserData( m_sViewName, lData );
- }
- break;
- case E_TABDIALOG : {
- m_pDataContainer_TabDialogs->SetUserData( m_sViewName, lData );
- }
- break;
- case E_TABPAGE : {
- m_pDataContainer_TabPages->SetUserData( m_sViewName, lData );
- }
- break;
- case E_WINDOW : {
- m_pDataContainer_Windows->SetUserData( m_sViewName, lData );
- }
- break;
- }
-}
-
-//*****************************************************************************************************************
-css::uno::Any SvtViewOptions::GetUserItem( const ::rtl::OUString& sName ) const
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- css::uno::Any aItem;
- switch( m_eViewType )
- {
- case E_DIALOG : {
- aItem = m_pDataContainer_Dialogs->GetUserItem( m_sViewName, sName );
- }
- break;
- case E_TABDIALOG : {
- aItem = m_pDataContainer_TabDialogs->GetUserItem( m_sViewName, sName );
- }
- break;
- case E_TABPAGE : {
- aItem = m_pDataContainer_TabPages->GetUserItem( m_sViewName, sName );
- }
- break;
- case E_WINDOW : {
- aItem = m_pDataContainer_Windows->GetUserItem( m_sViewName, sName );
- }
- break;
- }
- return aItem;
-}
-
-//*****************************************************************************************************************
-void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName ,
- const css::uno::Any& aValue )
-{
- // Ready for multithreading
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
-
- switch( m_eViewType )
- {
- case E_DIALOG : {
- m_pDataContainer_Dialogs->SetUserItem( m_sViewName, sName, aValue );
- }
- break;
- case E_TABDIALOG : {
- m_pDataContainer_TabDialogs->SetUserItem( m_sViewName, sName, aValue );
- }
- break;
- case E_TABPAGE : {
- m_pDataContainer_TabPages->SetUserItem( m_sViewName, sName, aValue );
- }
- break;
- case E_WINDOW : {
- m_pDataContainer_Windows->SetUserItem( m_sViewName, sName, aValue );
- }
- break;
- }
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-::osl::Mutex& SvtViewOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static ::osl::Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
-
-void SvtViewOptions::AcquireOptions()
-{
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
- if( ++m_nRefCount_Dialogs == 1 )
- {
- m_pDataContainer_Dialogs = new SvtViewOptionsBase_Impl( LIST_DIALOGS );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_DIALOG);
- }
- if( ++m_nRefCount_TabDialogs == 1 )
- {
- m_pDataContainer_TabDialogs = new SvtViewOptionsBase_Impl( LIST_TABDIALOGS );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABDIALOG);
- }
- if( ++m_nRefCount_TabPages == 1 )
- {
- m_pDataContainer_TabPages = new SvtViewOptionsBase_Impl( LIST_TABPAGES );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_TABPAGE);
- }
- if( ++m_nRefCount_Windows == 1 )
- {
- m_pDataContainer_Windows = new SvtViewOptionsBase_Impl( LIST_WINDOWS );
- ItemHolder1::holdConfigItem(E_VIEWOPTIONS_WINDOW);
- }
-}
-
-void SvtViewOptions::ReleaseOptions()
-{
- ::osl::MutexGuard aGuard( GetOwnStaticMutex() );
- if( --m_nRefCount_Dialogs == 0 )
- {
- delete m_pDataContainer_Dialogs;
- m_pDataContainer_Dialogs = NULL;
- }
- if( --m_nRefCount_TabDialogs == 0 )
- {
- delete m_pDataContainer_TabDialogs;
- m_pDataContainer_TabDialogs = NULL;
- }
- if( --m_nRefCount_TabPages == 0 )
- {
- delete m_pDataContainer_TabPages;
- m_pDataContainer_TabPages = NULL;
- }
- if( --m_nRefCount_Windows == 0 )
- {
- delete m_pDataContainer_Windows;
- m_pDataContainer_Windows = NULL;
- }
-}
diff --git a/svtools/source/config/workingsetoptions.cxx b/svtools/source/config/workingsetoptions.cxx
deleted file mode 100644
index d2c1007a70de..000000000000
--- a/svtools/source/config/workingsetoptions.cxx
+++ /dev/null
@@ -1,396 +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: workingsetoptions.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-//_________________________________________________________________________________________________________________
-// includes
-//_________________________________________________________________________________________________________________
-
-#include <svtools/workingsetoptions.hxx>
-#include <unotools/configmgr.hxx>
-#include <unotools/configitem.hxx>
-#include <tools/debug.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-#include <itemholder1.hxx>
-
-//_________________________________________________________________________________________________________________
-// namespaces
-//_________________________________________________________________________________________________________________
-
-using namespace ::utl ;
-using namespace ::rtl ;
-using namespace ::osl ;
-using namespace ::com::sun::star::uno ;
-
-//_________________________________________________________________________________________________________________
-// const
-//_________________________________________________________________________________________________________________
-
-#define ROOTNODE_WORKINGSET OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/WorkingSet"))
-#define DEFAULT_WINDOWLIST Sequence< OUString >()
-
-#define PROPERTYNAME_WINDOWLIST OUString(RTL_CONSTASCII_USTRINGPARAM("WindowList" ))
-
-#define PROPERTYHANDLE_WINDOWLIST 0
-
-#define PROPERTYCOUNT 1
-
-//_________________________________________________________________________________________________________________
-// private declarations!
-//_________________________________________________________________________________________________________________
-
-class SvtWorkingSetOptions_Impl : public ConfigItem
-{
- //-------------------------------------------------------------------------------------------------------------
- // public methods
- //-------------------------------------------------------------------------------------------------------------
-
- public:
-
- //---------------------------------------------------------------------------------------------------------
- // constructor / destructor
- //---------------------------------------------------------------------------------------------------------
-
- SvtWorkingSetOptions_Impl();
- ~SvtWorkingSetOptions_Impl();
-
- //---------------------------------------------------------------------------------------------------------
- // overloaded methods of baseclass
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short called for notify of configmanager
- @descr These method is called from the ConfigManager before application ends or from the
- PropertyChangeListener if the sub tree broadcasts changes. You must update your
- internal values.
-
- @seealso baseclass ConfigItem
-
- @param "seqPropertyNames" is the list of properties which should be updated.
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Notify( const Sequence< OUString >& seqPropertyNames );
-
- /*-****************************************************************************************************//**
- @short write changes to configuration
- @descr These method writes the changed values into the sub tree
- and should always called in our destructor to guarantee consistency of config data.
-
- @seealso baseclass ConfigItem
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- virtual void Commit();
-
- //---------------------------------------------------------------------------------------------------------
- // public interface
- //---------------------------------------------------------------------------------------------------------
-
- /*-****************************************************************************************************//**
- @short access method to get internal values
- @descr These method give us a chance to regulate acces to ouer internal values.
- It's not used in the moment - but it's possible for the feature!
-
- @seealso -
-
- @param -
- @return -
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- Sequence< OUString > GetWindowList( ) const ;
- void SetWindowList( const Sequence< OUString >& seqWindowList ) ;
-
- //-------------------------------------------------------------------------------------------------------------
- // private methods
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- /*-****************************************************************************************************//**
- @short return list of key names of ouer configuration management which represent oue module tree
- @descr These methods return a static const list of key names. We need it to get needed values from our
- configuration management.
-
- @seealso -
-
- @param -
- @return A list of needed configuration keys is returned.
-
- @onerror -
- *//*-*****************************************************************************************************/
-
- static Sequence< OUString > GetPropertyNames();
-
- //-------------------------------------------------------------------------------------------------------------
- // private member
- //-------------------------------------------------------------------------------------------------------------
-
- private:
-
- Sequence< OUString > m_seqWindowList ;
-};
-
-//_________________________________________________________________________________________________________________
-// definitions
-//_________________________________________________________________________________________________________________
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()
- // Init baseclasses first
- : ConfigItem ( ROOTNODE_WORKINGSET )
- // Init member then.
- , m_seqWindowList ( DEFAULT_WINDOWLIST )
-{
- // Use our static list of configuration keys to get his values.
- Sequence< OUString > seqNames = GetPropertyNames ( );
- Sequence< Any > seqValues = GetProperties ( seqNames );
-
- // Safe impossible cases.
- // We need values from ALL configuration keys.
- // Follow assignment use order of values in relation to our list of key names!
- DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nI miss some values of configuration keys!\n" );
-
- // Copy values from list in right order to ouer internal member.
- sal_Int32 nPropertyCount = seqValues.getLength();
- for( sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
- {
- // Safe impossible cases.
- // Check any for valid value.
- DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nInvalid property value detected!\n" );
- switch( nProperty )
- {
- case PROPERTYHANDLE_WINDOWLIST : {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SEQUENCE), "SvtWorkingSetOptions_Impl::SvtWorkingSetOptions_Impl()\nWho has changed the value type of \"Office.Common\\WorkingSet\\WindowList\"?" );
- seqValues[nProperty] >>= m_seqWindowList;
- }
- break;
- }
- }
-
- // Enable notification mechanism of ouer baseclass.
- // We need it to get information about changes outside these class on ouer used configuration keys!
- EnableNotification( seqNames );
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtWorkingSetOptions_Impl::~SvtWorkingSetOptions_Impl()
-{
- // We must save our current values .. if user forget it!
- if( IsModified() == sal_True )
- {
- Commit();
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtWorkingSetOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNames )
-{
- // Use given list of updated properties to get his values from configuration directly!
- Sequence< Any > seqValues = GetProperties( seqPropertyNames );
- // Safe impossible cases.
- // We need values from ALL notified configuration keys.
- DBG_ASSERT( !(seqPropertyNames.getLength()!=seqValues.getLength()), "SvtWorkingSetOptions_Impl::Notify()\nI miss some values of configuration keys!\n" );
- // Step over list of property names and get right value from coreesponding value list to set it on internal members!
- sal_Int32 nCount = seqPropertyNames.getLength();
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- if( seqPropertyNames[nProperty] == PROPERTYNAME_WINDOWLIST )
- {
- DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SEQUENCE), "SvtWorkingSetOptions_Impl::Notify()\nWho has changed the value type of \"Office.Common\\WorkingSet\\WindowList\"?" );
- seqValues[nProperty] >>= m_seqWindowList;
- }
- #if OSL_DEBUG_LEVEL > 1
- else DBG_ASSERT( sal_False, "SvtWorkingSetOptions_Impl::Notify()\nUnkown property detected ... I can't handle these!\n" );
- #endif
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtWorkingSetOptions_Impl::Commit()
-{
- // Get names of supported properties, create a list for values and copy current values to it.
- Sequence< OUString > seqNames = GetPropertyNames ();
- sal_Int32 nCount = seqNames.getLength();
- Sequence< Any > seqValues ( nCount );
- for( sal_Int32 nProperty=0; nProperty<nCount; ++nProperty )
- {
- switch( nProperty )
- {
- case PROPERTYHANDLE_WINDOWLIST : {
- seqValues[nProperty] <<= m_seqWindowList;
- }
- break;
- }
- }
- // Set properties in configuration.
- PutProperties( seqNames, seqValues );
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< OUString > SvtWorkingSetOptions_Impl::GetWindowList() const
-{
- return m_seqWindowList;
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtWorkingSetOptions_Impl::SetWindowList( const Sequence< OUString >& seqWindowList )
-{
- m_seqWindowList = seqWindowList;
- SetModified();
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Sequence< OUString > SvtWorkingSetOptions_Impl::GetPropertyNames()
-{
- // Build static list of configuration key names.
- static const OUString pProperties[] =
- {
- PROPERTYNAME_WINDOWLIST ,
- };
- // Initialize return sequence with these list ...
- static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
- // ... and return it.
- return seqPropertyNames;
-}
-
-//*****************************************************************************************************************
-// initialize static member
-// DON'T DO IT IN YOUR HEADER!
-// see definition for further informations
-//*****************************************************************************************************************
-SvtWorkingSetOptions_Impl* SvtWorkingSetOptions::m_pDataContainer = NULL ;
-sal_Int32 SvtWorkingSetOptions::m_nRefCount = 0 ;
-
-//*****************************************************************************************************************
-// constructor
-//*****************************************************************************************************************
-SvtWorkingSetOptions::SvtWorkingSetOptions()
-{
- // Global access, must be guarded (multithreading!).
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Increase ouer refcount ...
- ++m_nRefCount;
- // ... and initialize ouer data container only if it not already exist!
- if( m_pDataContainer == NULL )
- {
- m_pDataContainer = new SvtWorkingSetOptions_Impl;
- ItemHolder1::holdConfigItem(E_WORKINGSETOPTIONS);
- }
-}
-
-//*****************************************************************************************************************
-// destructor
-//*****************************************************************************************************************
-SvtWorkingSetOptions::~SvtWorkingSetOptions()
-{
- // Global access, must be guarded (multithreading!)
- MutexGuard aGuard( GetOwnStaticMutex() );
- // Decrease ouer refcount.
- --m_nRefCount;
- // If last instance was deleted ...
- // we must destroy ouer static data container!
- if( m_nRefCount <= 0 )
- {
- delete m_pDataContainer;
- m_pDataContainer = NULL;
- }
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-Sequence< OUString > SvtWorkingSetOptions::GetWindowList() const
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- return m_pDataContainer->GetWindowList();
-}
-
-//*****************************************************************************************************************
-// public method
-//*****************************************************************************************************************
-void SvtWorkingSetOptions::SetWindowList( const Sequence< OUString >& seqWindowList )
-{
- MutexGuard aGuard( GetOwnStaticMutex() );
- m_pDataContainer->SetWindowList( seqWindowList );
-}
-
-//*****************************************************************************************************************
-// private method
-//*****************************************************************************************************************
-Mutex& SvtWorkingSetOptions::GetOwnStaticMutex()
-{
- // Initialize static mutex only for one time!
- static Mutex* pMutex = NULL;
- // If these method first called (Mutex not already exist!) ...
- if( pMutex == NULL )
- {
- // ... we must create a new one. Protect follow code with the global mutex -
- // It must be - we create a static variable!
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
- if( pMutex == NULL )
- {
- // Create the new mutex and set it for return on static variable.
- static Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
-}
diff --git a/svtools/source/config/xmlaccelcfg.cxx b/svtools/source/config/xmlaccelcfg.cxx
deleted file mode 100644
index 36886a533413..000000000000
--- a/svtools/source/config/xmlaccelcfg.cxx
+++ /dev/null
@@ -1,424 +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: xmlaccelcfg.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_svtools.hxx"
-
-#include "xmlaccelcfg.hxx"
-
-#include <vector>
-#if OSL_DEBUG_LEVEL == 0
-# ifndef NDEBUG
-# define NDEBUG
-# endif
-#endif
-#include <assert.h>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-using namespace rtl;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::xml::sax;
-
-#define ELEMENT_ACCELERATORLIST "acceleratorlist"
-#define ELEMENT_ACCELERATORITEM "item"
-
-#define ATTRIBUTE_KEYCODE "code"
-#define ATTRIBUTE_MODIFIER "modifier"
-#define ATTRIBUTE_URL "url"
-
-#define ATTRIBUTE_TYPE_CDATA "CDATA"
-
-// ------------------------------------------------------------------
-
-struct AttributeListImpl_impl;
-class AttributeListImpl : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XAttributeList >
-{
-protected:
- ~AttributeListImpl();
-
-public:
- AttributeListImpl();
- AttributeListImpl( const AttributeListImpl & );
-
-public:
- virtual sal_Int16 SAL_CALL getLength(void) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw (::com::sun::star::uno::RuntimeException);
-
-public:
- void addAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sType , const ::rtl::OUString &sValue );
- void clear();
-
-private:
- struct AttributeListImpl_impl *m_pImpl;
-};
-
-struct TagAttribute
-{
- TagAttribute(){}
- TagAttribute( const OUString &aName, const OUString &aType , const OUString &aValue )
- {
- sName = aName;
- sType = aType;
- sValue = aValue;
- }
-
- OUString sName;
- OUString sType;
- OUString sValue;
-};
-
-struct AttributeListImpl_impl
-{
- AttributeListImpl_impl()
- {
- // performance improvement during adding
- vecAttribute.reserve(20);
- }
- ::std::vector<struct TagAttribute> vecAttribute;
-};
-
-
-
-sal_Int16 SAL_CALL AttributeListImpl::getLength(void) throw (RuntimeException)
-{
- return sal::static_int_cast< sal_Int16 >(m_pImpl->vecAttribute.size());
-}
-
-
-AttributeListImpl::AttributeListImpl( const AttributeListImpl &r ) :
- cppu::WeakImplHelper1<com::sun::star::xml::sax::XAttributeList>(r)
-{
- m_pImpl = new AttributeListImpl_impl;
- *m_pImpl = *(r.m_pImpl);
-}
-
-OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException)
-{
- if( i < sal::static_int_cast<sal_Int16>(m_pImpl->vecAttribute.size()) ) {
- return m_pImpl->vecAttribute[i].sName;
- }
- return OUString();
-}
-
-
-OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException)
-{
- if( i < sal::static_int_cast<sal_Int16>(m_pImpl->vecAttribute.size()) ) {
- return m_pImpl->vecAttribute[i].sType;
- }
- return OUString();
-}
-
-OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException)
-{
- if( i < sal::static_int_cast<sal_Int16>(m_pImpl->vecAttribute.size()) ) {
- return m_pImpl->vecAttribute[i].sValue;
- }
- return OUString();
-
-}
-
-OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException)
-{
- ::std::vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
-
- for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) {
- if( (*ii).sName == sName ) {
- return (*ii).sType;
- }
- }
- return OUString();
-}
-
-OUString AttributeListImpl::getValueByName(const OUString& sName) throw (RuntimeException)
-{
- ::std::vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
-
- for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ ) {
- if( (*ii).sName == sName ) {
- return (*ii).sValue;
- }
- }
- return OUString();
-}
-
-
-AttributeListImpl::AttributeListImpl()
-{
- m_pImpl = new AttributeListImpl_impl;
-}
-
-
-
-AttributeListImpl::~AttributeListImpl()
-{
- delete m_pImpl;
-}
-
-
-void AttributeListImpl::addAttribute( const OUString &sName ,
- const OUString &sType ,
- const OUString &sValue )
-{
- m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) );
-}
-
-void AttributeListImpl::clear()
-{
- ::std::vector<struct TagAttribute> dummy;
- m_pImpl->vecAttribute.swap( dummy );
-
- assert( ! getLength() );
-}
-
-// ------------------------------------------------------------------
-
-Any SAL_CALL OReadAccelatorDocumentHandler::queryInterface( const Type & rType ) throw( RuntimeException )
-{
- Any a = ::cppu::queryInterface( rType ,SAL_STATIC_CAST( XDocumentHandler*, this ));
- if ( a.hasValue() )
- return a;
- else
- return OWeakObject::queryInterface( rType );
-}
-
-void SAL_CALL OReadAccelatorDocumentHandler::ignorableWhitespace(
- const OUString& )
-throw( SAXException, RuntimeException )
-{
-}
-
-void SAL_CALL OReadAccelatorDocumentHandler::processingInstruction(
- const OUString&, const OUString& )
-throw( SAXException, RuntimeException )
-{
-}
-
-void SAL_CALL OReadAccelatorDocumentHandler::setDocumentLocator(
- const Reference< XLocator > &xLocator)
-throw( SAXException, RuntimeException )
-{
- m_xLocator = xLocator;
-}
-
-::rtl::OUString OReadAccelatorDocumentHandler::getErrorLineString()
-{
- char buffer[32];
-
- if ( m_xLocator.is() )
- {
- return OUString::createFromAscii( buffer );
- }
- else
- return OUString();
-}
-
-void SAL_CALL OReadAccelatorDocumentHandler::startDocument(void)
- throw ( SAXException, RuntimeException )
-{
-}
-
-void SAL_CALL OReadAccelatorDocumentHandler::endDocument(void)
- throw( SAXException, RuntimeException )
-{
- if ( m_nElementDepth > 0 )
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "A closing element is missing!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-}
-
-
-void SAL_CALL OReadAccelatorDocumentHandler::startElement(
- const OUString& aElementName, const Reference< XAttributeList > &xAttrList )
-throw( SAXException, RuntimeException )
-{
- m_nElementDepth++;
-
- if ( aElementName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORLIST )))
- {
- // acceleratorlist
- if ( m_bAcceleratorMode )
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list used twice!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- else
- m_bAcceleratorMode = sal_True;
- }
- else if ( aElementName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORITEM )))
- {
- // accelerator item
- if ( !m_bAcceleratorMode )
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list element has to be used before!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- else
- {
- // read accelerator item
- m_bItemCloseExpected = sal_True;
-
- SvtAcceleratorConfigItem aItem;
-
- // read attributes for accelerator
- for ( sal_Int16 i=0; i< xAttrList->getLength(); i++ )
- {
- OUString aName = xAttrList->getNameByIndex( i );
- OUString aValue = xAttrList->getValueByIndex( i );
-
- if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_URL )))
- aItem.aCommand = aValue;
- else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_MODIFIER )))
- aItem.nModifier = (sal_uInt16)aValue.toInt32();
- else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ATTRIBUTE_KEYCODE )))
- aItem.nCode = (sal_uInt16)aValue.toInt32();
- }
-
- m_aReadAcceleratorList.push_back( aItem );
- }
- }
- else
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown element found!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-}
-
-
-void SAL_CALL OReadAccelatorDocumentHandler::characters(const rtl::OUString&)
-throw( SAXException, RuntimeException )
-{
-}
-
-
-void SAL_CALL OReadAccelatorDocumentHandler::endElement( const OUString& aName )
- throw( SAXException, RuntimeException )
-{
- m_nElementDepth--;
-
- if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORLIST )))
- {
- // acceleratorlist
- if ( !m_bAcceleratorMode )
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Accelerator list used twice!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- }
- else if ( aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ELEMENT_ACCELERATORITEM )))
- {
- if ( !m_bItemCloseExpected )
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Closing accelerator item element expected!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
- }
- else
- {
- OUString aErrorMessage = getErrorLineString();
- aErrorMessage += OUString( RTL_CONSTASCII_USTRINGPARAM( "Unknown closing element found!" ));
- throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
- }
-}
-
-// ------------------------------------------------------------------
-
-OWriteAccelatorDocumentHandler::OWriteAccelatorDocumentHandler(
- const SvtAcceleratorItemList& aWriteAcceleratorList, Reference< XDocumentHandler > xDocumentHandler ) :
- m_xWriteDocumentHandler( xDocumentHandler ),
- m_aWriteAcceleratorList( aWriteAcceleratorList )
-{
- m_aAttributeType = OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_TYPE_CDATA ));
-}
-
-OWriteAccelatorDocumentHandler::~OWriteAccelatorDocumentHandler()
-{
-}
-
-void OWriteAccelatorDocumentHandler::WriteAcceleratorDocument()
- throw ( SAXException, RuntimeException )
-{
- AttributeListImpl* pList = new AttributeListImpl;
- Reference< XAttributeList > rList( (XAttributeList *)pList , UNO_QUERY );
-
- m_xWriteDocumentHandler->startDocument();
- m_xWriteDocumentHandler->startElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )), rList );
- m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
-
- std::list< SvtAcceleratorConfigItem>::const_iterator p;
- for ( p = m_aWriteAcceleratorList.begin(); p != m_aWriteAcceleratorList.end(); p++ )
- WriteAcceleratorItem( *p );
-
- m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORLIST )) );
- m_xWriteDocumentHandler->endDocument();
-}
-
-void OWriteAccelatorDocumentHandler::WriteAcceleratorItem(
- const SvtAcceleratorConfigItem& aAcceleratorItem )
- throw( SAXException, RuntimeException )
-{
- AttributeListImpl* pAcceleratorAttributes = new AttributeListImpl;
- Reference< XAttributeList > xAcceleratorAttrList( (XAttributeList *)pAcceleratorAttributes , UNO_QUERY );
-
- // set attributes
- pAcceleratorAttributes->addAttribute(
- OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_KEYCODE )),
- m_aAttributeType,
- OUString::valueOf( aAcceleratorItem.nCode ));
-
- pAcceleratorAttributes->addAttribute(
- OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_MODIFIER )),
- m_aAttributeType,
- OUString::valueOf( aAcceleratorItem.nModifier ));
-
- pAcceleratorAttributes->addAttribute(
- OUString( RTL_CONSTASCII_USTRINGPARAM( ATTRIBUTE_URL )),
- m_aAttributeType,
- aAcceleratorItem.aCommand );
-
- // write start element
- m_xWriteDocumentHandler->startElement(
- OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )),
- xAcceleratorAttrList );
- m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
- m_xWriteDocumentHandler->endElement( OUString( RTL_CONSTASCII_USTRINGPARAM( ELEMENT_ACCELERATORITEM )) );
-}
diff --git a/svtools/source/contnr/contentenumeration.cxx b/svtools/source/contnr/contentenumeration.cxx
index af379db9b12b..a0e6b353dfb6 100644
--- a/svtools/source/contnr/contentenumeration.cxx
+++ b/svtools/source/contnr/contentenumeration.cxx
@@ -31,7 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include "contentenumeration.hxx"
-#include <svtools/urlfilter.hxx>
+#include <svl/urlfilter.hxx>
#include <svtools/inettbc.hxx>
#include "imagemgr.hxx"
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 274557051c27..7fddf18ee266 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -37,7 +37,7 @@
#include <svtools/headbar.hxx>
#include <svtools/svtabbx.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "fileview.hrc"
#include "contentenumeration.hxx"
#include <svtools/AccessibleBrowseBoxObjType.hxx>
@@ -78,8 +78,8 @@
#include <vcl/sound.hxx>
#include <unotools/ucbhelper.hxx>
#include <unotools/intlwrapper.hxx>
-#include <svtools/syslocale.hxx>
-#include <svtools/urlfilter.hxx>
+#include <unotools/syslocale.hxx>
+#include <svl/urlfilter.hxx>
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
@@ -167,7 +167,7 @@ namespace
static sal_Bool isHighContrast( const Window* _pView )
{
- return _pView->GetDisplayBackground().GetColor().IsDark();
+ return _pView->GetSettings().GetStyleSettings().GetHighContrastMode();
}
// -----------------------------------------------------------------------
diff --git a/svtools/source/contnr/fileview.src b/svtools/source/contnr/fileview.src
index c86db1ce418a..9d1cdb618cda 100644
--- a/svtools/source/contnr/fileview.src
+++ b/svtools/source/contnr/fileview.src
@@ -30,7 +30,7 @@
// includes ------------------------------------------------------------------
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "fileview.hrc"
#include <svtools/helpid.hrc>
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx
index d4ec597aebfc..d443beb7fff9 100644
--- a/svtools/source/contnr/imivctl.hxx
+++ b/svtools/source/contnr/imivctl.hxx
@@ -45,7 +45,7 @@
#include <limits.h>
#include "ivctrl.hxx"
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
class IcnCursor_Impl;
class SvtIconChoiceCtrl;
diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx
index c0f40fd306df..916738af70ae 100644
--- a/svtools/source/contnr/ivctrl.cxx
+++ b/svtools/source/contnr/ivctrl.cxx
@@ -201,7 +201,7 @@ BOOL SvtIconChoiceCtrl::EditingEntry( SvxIconChoiceCtrlEntry* )
}
void SvtIconChoiceCtrl::DrawEntryImage( SvxIconChoiceCtrlEntry* pEntry, const Point& rPos, OutputDevice& rDev )
{
- rDev.DrawImage ( rPos, GetDisplayBackground().GetColor().IsDark() ? pEntry->GetImageHC() : pEntry->GetImage() );
+ rDev.DrawImage( rPos, GetSettings().GetStyleSettings().GetHighContrastMode() ? pEntry->GetImageHC() : pEntry->GetImage() );
}
String SvtIconChoiceCtrl::GetEntryText( SvxIconChoiceCtrlEntry* pEntry, BOOL )
{
@@ -579,8 +579,7 @@ Rectangle SvtIconChoiceCtrl::GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) co
void SvtIconChoiceCtrl::FillLayoutData() const
{
- DBG_ASSERT( !mpLayoutData, "SvtIconChoiceCtrl::FillLayoutData: shouldn't this be called with non-existent layout data only?" );
- mpLayoutData = new ::vcl::ControlLayoutData();
+ CreateLayoutData();
SvtIconChoiceCtrl* pNonConstMe = const_cast< SvtIconChoiceCtrl* >( this );
@@ -598,7 +597,7 @@ void SvtIconChoiceCtrl::FillLayoutData() const
sal_Bool bLargeIconMode = WB_ICON == ( _pImp->GetStyle() & ( VIEWMODE_MASK ) );
sal_uInt16 nTextPaintFlags = bLargeIconMode ? PAINTFLAG_HOR_CENTERED : PAINTFLAG_VER_CENTERED;
- _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, mpLayoutData );
+ _pImp->PaintItem( aTextRect, IcnViewFieldTypeText, pEntry, nTextPaintFlags, pNonConstMe, &sEntryText, GetLayoutData() );
++nPos;
}
diff --git a/svtools/source/contnr/svcontnr.src b/svtools/source/contnr/svcontnr.src
index c26c906eb3f6..f81bc3fdfa9b 100644
--- a/svtools/source/contnr/svcontnr.src
+++ b/svtools/source/contnr/svcontnr.src
@@ -28,7 +28,7 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
Image RID_IMG_TREENODE_COLLAPSED
{
diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx
index e17b81e548a9..f2674279f4df 100644
--- a/svtools/source/contnr/svimpbox.cxx
+++ b/svtools/source/contnr/svimpbox.cxx
@@ -50,7 +50,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
// #102891# --------------------
diff --git a/svtools/source/contnr/svimpicn.cxx b/svtools/source/contnr/svimpicn.cxx
index 37ee096dc6d9..8d7a79701d27 100644
--- a/svtools/source/contnr/svimpicn.cxx
+++ b/svtools/source/contnr/svimpicn.cxx
@@ -46,7 +46,7 @@
#ifndef _SVLBITM_HXX
#include <svtools/svlbitm.hxx>
#endif
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
diff --git a/svtools/source/contnr/svlbitm.cxx b/svtools/source/contnr/svlbitm.cxx
index ccd98e6a32a1..e9125b7fb2e1 100644
--- a/svtools/source/contnr/svlbitm.cxx
+++ b/svtools/source/contnr/svlbitm.cxx
@@ -590,8 +590,7 @@ void SvLBoxContextBmp::Paint( const Point& _rPos, SvLBox& _rDev,
BmpColorMode eMode( BMP_COLOR_NORMAL );
if ( !!m_pImpl->m_aImage1_hc )
{ // we really have HC images
- const Wallpaper& rDeviceBackground = _rDev.GetDisplayBackground();
- if ( rDeviceBackground.GetColor().IsDark() )
+ if ( _rDev.GetSettings().GetStyleSettings().GetHighContrastMode() )
eMode = BMP_COLOR_HIGHCONTRAST;
}
diff --git a/svtools/source/contnr/svlbox.cxx b/svtools/source/contnr/svlbox.cxx
index e56db398b8fb..77a9a3798d6d 100644
--- a/svtools/source/contnr/svlbox.cxx
+++ b/svtools/source/contnr/svlbox.cxx
@@ -48,7 +48,7 @@
#include <rtl/instance.hxx>
#define _SVSTDARR_ULONGSSORT
-#include <svtools/svstdarr.hxx>
+#include <svl/svstdarr.hxx>
#ifndef _SVEDI_HXX
#include <svtools/svmedit.hxx>
diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx
index 1770810c7a5d..3b4907e7a80d 100644
--- a/svtools/source/contnr/svtabbx.cxx
+++ b/svtools/source/contnr/svtabbx.cxx
@@ -34,7 +34,7 @@
#include <svtools/headbar.hxx>
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
diff --git a/svtools/source/contnr/svtreebx.cxx b/svtools/source/contnr/svtreebx.cxx
index a697928842af..503325ddf802 100644
--- a/svtools/source/contnr/svtreebx.cxx
+++ b/svtools/source/contnr/svtreebx.cxx
@@ -1813,7 +1813,7 @@ long SvTreeListBox::PaintEntry1(SvLBoxEntry* pEntry,long nLine,USHORT nTabFlags,
const Image* pImg = 0;
BmpColorMode eBitmapMode = BMP_COLOR_NORMAL;
- if ( GetDisplayBackground().GetColor().IsDark() )
+ if ( GetSettings().GetStyleSettings().GetHighContrastMode() )
eBitmapMode = BMP_COLOR_HIGHCONTRAST;
if( IsExpanded(pEntry) )
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index 2b212fdcffeb..06de35ba19aa 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -33,18 +33,18 @@
#include "templwin.hxx"
#include "templdlg.hxx"
#include <svtools/svtdata.hxx>
-#include <svtools/pathoptions.hxx>
-#include <svtools/dynamicmenuoptions.hxx>
-#include <svtools/extendedsecurityoptions.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/dynamicmenuoptions.hxx>
+#include <unotools/extendedsecurityoptions.hxx>
#include <svtools/xtextedt.hxx>
-#include <svtools/inettype.hxx>
+#include <svl/inettype.hxx>
#include "imagemgr.hxx"
#include <svtools/miscopt.hxx>
#include "templatefoldercache.hxx"
#include "imgdef.hxx"
#include "txtattr.hxx"
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#ifndef _SVTOOLS_TEMPLWIN_HRC
#include "templwin.hrc"
@@ -52,8 +52,8 @@
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
#endif
-#include <svtools/pathoptions.hxx>
-#include <svtools/viewoptions.hxx>
+#include <unotools/pathoptions.hxx>
+#include <unotools/viewoptions.hxx>
#include <unotools/ucbhelper.hxx>
#include "unotools/configmgr.hxx"
@@ -369,7 +369,7 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) :
// insert the categories
// "New Document"
- sal_Bool bHiContrast = GetBackground().GetColor().IsDark();
+ sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
Image aImage( SvtResId( bHiContrast ? IMG_SVT_NEWDOC_HC : IMG_SVT_NEWDOC ) );
nMaxTextLength = aImage.GetSizePixel().Width();
String aEntryStr = String( SvtResId( STR_SVT_NEWDOC ) );
@@ -1348,7 +1348,7 @@ void SvtTemplateWindow::InitToolBoxImages()
{
SvtMiscOptions aMiscOpt;
BOOL bLarge = aMiscOpt.AreCurrentSymbolsLarge();
- sal_Bool bHiContrast = aFileViewTB.GetBackground().GetColor().IsDark();
+ sal_Bool bHiContrast = aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode();
aFileViewTB.SetItemImage( TI_DOCTEMPLATE_BACK, Image( SvtResId(
bLarge ? bHiContrast ? IMG_SVT_DOCTEMPL_HC_BACK_LARGE : IMG_SVT_DOCTEMPLATE_BACK_LARGE
@@ -1372,7 +1372,7 @@ void SvtTemplateWindow::InitToolBoxImages()
void SvtTemplateWindow::UpdateIcons()
{
- pIconWin->UpdateIcons( aFileViewTB.GetBackground().GetColor().IsDark() );
+ pIconWin->UpdateIcons( aFileViewTB.GetSettings().GetStyleSettings().GetHighContrastMode() );
}
// ------------------------------------------------------------------------
diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx
index bd3eb4afd5dd..050ba7ab6739 100644
--- a/svtools/source/contnr/templwin.hxx
+++ b/svtools/source/contnr/templwin.hxx
@@ -38,7 +38,7 @@
#include "fileview.hxx"
#include "ivctrl.hxx"
#include <svtools/svmedit2.hxx>
-#include <svtools/restrictedpaths.hxx>
+#include <svl/restrictedpaths.hxx>
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/lang/Locale.hpp>
diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src
index 30149de4da14..f7f42b7e176b 100644
--- a/svtools/source/contnr/templwin.src
+++ b/svtools/source/contnr/templwin.src
@@ -33,7 +33,7 @@
#include "templwin.hrc"
#include "controldims.hrc"
#include <svtools/helpid.hrc>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
// Magenta and Grey as mask colors
#define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; };
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index eb4e533b628c..c1491571dd1c 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -38,7 +38,7 @@
#include <svtools/treelist.hxx>
-#ifndef PRODUCT
+#ifdef DBG_UTIL
// Prueft Integritaet der Liste nach jeder Operation
//#define CHECK_INTEGRITY
#endif
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index 8ff008eaf7e4..481f6f2ceeae 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -62,7 +62,7 @@
#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
#define _SV_CALENDAR_CXX
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <calendar.hxx>
diff --git a/svtools/source/control/calendar.src b/svtools/source/control/calendar.src
index 44bffd361847..043dd9808663 100644
--- a/svtools/source/control/calendar.src
+++ b/svtools/source/control/calendar.src
@@ -28,7 +28,7 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
String STR_SVT_CALENDAR_DAY
{
Text [ en-US ] = "Day" ;
diff --git a/svtools/source/control/collatorres.cxx b/svtools/source/control/collatorres.cxx
index 692d470b8f5b..c976d7442bc0 100644
--- a/svtools/source/control/collatorres.cxx
+++ b/svtools/source/control/collatorres.cxx
@@ -32,7 +32,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include <svtools/svtdata.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <collatorres.hxx>
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 5be239a5593e..b0d20bf7ce30 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -43,7 +43,7 @@
#include <unotools/charclass.hxx>
#include <svtools/svtdata.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <ctrlbox.hxx>
#include <ctrltool.hxx>
@@ -644,8 +644,7 @@ void FontNameBox::DataChanged( const DataChangedEvent& rDCEvt )
void FontNameBox::InitBitmaps( void )
{
- Color aCol = GetSettings().GetStyleSettings().GetWindowColor();
- BOOL bHC = aCol.IsDark();
+ BOOL bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
maImagePrinterFont = Image( SvtResId( bHC? RID_IMG_PRINTERFONT_HC : RID_IMG_PRINTERFONT ) );
maImageBitmapFont = Image( SvtResId( bHC? RID_IMG_BITMAPFONT_HC : RID_IMG_BITMAPFONT ) );
diff --git a/svtools/source/control/ctrlbox.src b/svtools/source/control/ctrlbox.src
index 5cfee79e5f11..05c75577cdbf 100644
--- a/svtools/source/control/ctrlbox.src
+++ b/svtools/source/control/ctrlbox.src
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#ifndef IMAGE_STDBTN_COLOR
#define IMAGE_STDBTN_COLOR Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; }
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 77bb996584bd..1573ed531662 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -45,7 +45,7 @@
#include <vcl/svapp.hxx>
#include <vcl/wrkwin.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <ctrltool.hxx>
diff --git a/svtools/source/control/ctrltool.src b/svtools/source/control/ctrltool.src
index 267a65e98517..ab8005cd9698 100644
--- a/svtools/source/control/ctrltool.src
+++ b/svtools/source/control/ctrltool.src
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
String STR_SVT_STYLE_LIGHT
{
diff --git a/svtools/source/control/fileurlbox.cxx b/svtools/source/control/fileurlbox.cxx
index 936f8b3e25c5..554f713fd4d6 100644
--- a/svtools/source/control/fileurlbox.cxx
+++ b/svtools/source/control/fileurlbox.cxx
@@ -32,7 +32,7 @@
#include "precompiled_svtools.hxx"
#include <svtools/fileurlbox.hxx>
#include <osl/file.h>
-#include "filenotation.hxx"
+#include "svl/filenotation.hxx"
//.........................................................................
namespace svt
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index 387c1db34fc1..bbf00329cf93 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -36,7 +36,7 @@
#include <comphelper/processfactory.hxx>
#include <unotools/localedatawrapper.hxx>
#include <vcl/svapp.hxx>
-#include <svtools/zformat.hxx>
+#include <svl/zformat.hxx>
#include <svtools/fmtfield.hxx>
#include <i18npool/mslangid.hxx>
#include <com/sun/star/lang/Locale.hpp>
@@ -45,7 +45,7 @@
#include <com/sun/star/util/SearchResult.hpp>
#include <com/sun/star/util/SearchFlags.hpp>
#include <com/sun/star/lang/Locale.hpp>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
#ifndef REGEXP_SUPPORT
#include <map>
diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
index ec8387ecb662..7d7477130e0d 100644
--- a/svtools/source/control/hyperlabel.cxx
+++ b/svtools/source/control/hyperlabel.cxx
@@ -107,35 +107,16 @@ namespace svt
}
- void HyperLabel::SetLabelAndSize(::rtl::OUString _rText, const Size& _rNewSize )
+ Size HyperLabel::CalcMinimumSize( long nMaxWidth ) const
{
- Size rLocSize = _rNewSize;
- Size rLogicLocSize = PixelToLogic( _rNewSize, MAP_APPFONT );
- SetLabel( _rText );
- ImplCalcMinimumSize( rLocSize );
- rLocSize.Height() = ( m_pImpl->m_aMinSize.Height());
-// else
-// rLocSize = LogicToPixel( Size( rLogicLocSize.Width(), LABELBASEMAPHEIGHT ), MAP_APPFONT );
- SetSizePixel( rLocSize );
- Show();
- }
-
- sal_Bool HyperLabel::ImplCalcMinimumSize(const Size& _rCompSize )
- {
- sal_Bool b_AdjustMinWidth = sal_False;
- m_pImpl->m_aMinSize = CalcMinimumSize( );
- if ( m_pImpl->m_aMinSize.Width() >= _rCompSize.Width() ) // the MinimumSize is used to size the FocusRectangle
- {
- m_pImpl->m_aMinSize.Width() = _rCompSize.Width(); // and for the MouseMove method
- m_pImpl->m_aMinSize = CalcMinimumSize(_rCompSize.Width() );
- b_AdjustMinWidth = sal_True;
- }
+ m_pImpl->m_aMinSize = FixedText::CalcMinimumSize( nMaxWidth );
+ // the MinimumSize is used to size the FocusRectangle
+ // and for the MouseMove method
m_pImpl->m_aMinSize.Height() += 2;
m_pImpl->m_aMinSize.Width() += 1;
- return b_AdjustMinWidth;
+ return m_pImpl->m_aMinSize;
}
-
void HyperLabel::implInit()
{
ToggleBackgroundColor( COL_TRANSPARENT );
@@ -234,17 +215,6 @@ namespace svt
m_pImpl->bInteractive = ( _bInteractive && IsEnabled() );
}
- void HyperLabel::SetHyperLabelPosition(sal_uInt16 XPos, sal_uInt16 YPos)
- {
- SetPosPixel( LogicToPixel( Point( XPos, YPos ), MAP_APPFONT ) );
- }
-
- Point HyperLabel::GetLogicalPosition()
- {
- Point aPoint = GetPosPixel( );
- return PixelToLogic( aPoint, MAP_APPFONT );
- }
-
sal_Int16 HyperLabel::GetID() const
{
return m_pImpl->ID;
@@ -270,10 +240,9 @@ namespace svt
return GetText();
}
- void HyperLabel::SetLabel( ::rtl::OUString _rText )
+ void HyperLabel::SetLabel( const ::rtl::OUString& _rText )
{
SetText(_rText);
- Show();
}
diff --git a/svtools/source/control/indexentryres.cxx b/svtools/source/control/indexentryres.cxx
index 49096144b215..f69e9b34e5ea 100644
--- a/svtools/source/control/indexentryres.cxx
+++ b/svtools/source/control/indexentryres.cxx
@@ -32,7 +32,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include <svtools/svtdata.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <indexentryres.hxx>
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index 4a01a03ad759..b4904afee418 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -66,16 +66,16 @@
#include <vos/mutex.hxx>
#endif
#include <vcl/svapp.hxx>
-#include <svtools/historyoptions.hxx>
-#include <svtools/eitem.hxx>
-#include <svtools/stritem.hxx>
-#include <svtools/cancel.hxx>
-#include <svtools/itemset.hxx>
-#include "urihelper.hxx"
-#include <svtools/pathoptions.hxx>
+#include <unotools/historyoptions.hxx>
+#include <svl/eitem.hxx>
+#include <svl/stritem.hxx>
+#include <svl/cancel.hxx>
+#include <svl/itemset.hxx>
+#include "svl/urihelper.hxx"
+#include <unotools/pathoptions.hxx>
#define _SVSTDARR_STRINGSDTOR
-#include <svtools/svstdarr.hxx>
+#include <svl/svstdarr.hxx>
#include <ucbhelper/commandenvironment.hxx>
#include <ucbhelper/content.hxx>
#include <unotools/localfilehelper.hxx>
@@ -83,7 +83,7 @@
#include "iodlg.hrc"
#include <asynclink.hxx>
-#include <svtools/urlfilter.hxx>
+#include <svl/urlfilter.hxx>
#include <vector>
#include <algorithm>
diff --git a/svtools/source/control/makefile.mk b/svtools/source/control/makefile.mk
index 10bb6beb50e4..eecf983ab756 100644
--- a/svtools/source/control/makefile.mk
+++ b/svtools/source/control/makefile.mk
@@ -77,7 +77,6 @@ SLOFILES=\
$(SLO)$/calendar.obj \
$(SLO)$/filectrl.obj \
$(SLO)$/scrwin.obj \
- $(SLO)$/reginfo.obj \
$(SLO)$/collatorres.obj \
$(SLO)$/indexentryres.obj \
$(SLO)$/hyperlabel.obj \
diff --git a/svtools/source/control/reginfo.cxx b/svtools/source/control/reginfo.cxx
deleted file mode 100644
index 24daba5e6123..000000000000
--- a/svtools/source/control/reginfo.cxx
+++ /dev/null
@@ -1,375 +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: reginfo.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_svtools.hxx"
-
-#include "reginfo.hxx"
-#include <tools/debug.hxx>
-#include <osl/thread.h>
-
-#define MAXREGVALUE 200
-
-// *****************************************************************************
-#if defined(WIN) || defined(WNT)
-
-#include <tools/svwin.h>
-
-#define DBG_HDL DBG_ASSERT(pImp->bValidGroup, "Keine Gruppe gesetzt"); \
- if( !pImp->bValidGroup ) return
-
-struct RegInfo_Impl
-{
- HKEY aGroupHdl;
- BOOL bValidGroup;
-};
-
-RegInfo::RegInfo()
-{
- pImp=new RegInfo_Impl;
- pImp->bValidGroup = FALSE;
-}
-
-RegInfo::~RegInfo()
-{
- if(pImp->bValidGroup)
- RegCloseKey( pImp->aGroupHdl );
- delete pImp;
-}
-
-String RegInfo::GetKeyName( USHORT nKey ) const
-{
- DBG_HDL String::EmptyString();
- char aBuffer[MAXREGVALUE];
- RegEnumKey( pImp->aGroupHdl, nKey, aBuffer, MAXREGVALUE );
- return String( UniString::CreateFromAscii(aBuffer) );
-}
-
-USHORT RegInfo::GetKeyCount() const
-{
- DBG_HDL 0;
-#ifdef WNT
- DWORD nKeys;
- DWORD Dum1=10, Dum2, Dum3, Dum4, Dum5, Dum6, Dum7;
- char s[10];
- FILETIME aDumFileTime;
- RegQueryInfoKey( pImp->aGroupHdl, s, &Dum1, 0, &nKeys, &Dum2, &Dum3,
- &Dum4, &Dum5, &Dum6, &Dum7, &aDumFileTime );
- return (USHORT) nKeys;
-#else
- char aBuffer[MAXREGVALUE];
- USHORT n=0;
- while(RegEnumKey(
- pImp->aGroupHdl, n, aBuffer, MAXREGVALUE) == ERROR_SUCCESS)
- n++;
- return n;
-#endif
-}
-
-inline String MakeAppGroupString_Impl( const String &rGroup )
-{
- String aGroup( UniString::CreateFromAscii("SvAppGroups\\") );
- aGroup+=rGroup;
- return aGroup;
-}
-
-void RegInfo::SetAppGroup( const String& rGroup )
-{
- aCurrentGroup = MakeAppGroupString_Impl(rGroup);
- if( pImp->bValidGroup )
- {
- RegCloseKey( pImp->aGroupHdl );
- pImp->bValidGroup = FALSE;
- }
- ByteString aBStr( aCurrentGroup, osl_getThreadTextEncoding() );
- RegCreateKey( HKEY_CLASSES_ROOT, aBStr.GetBuffer(), &pImp->aGroupHdl );
- pImp->bValidGroup = TRUE;
-}
-
-void RegInfo::DeleteAppGroup( const String &rGroup )
-{
- String aOldGroup = aCurrentGroup;
- SetAppGroup( rGroup );
- DBG_HDL;
- USHORT nMax = GetKeyCount();
- for( USHORT n = nMax; n--; )
- {
- String aKey( GetKeyName( n ));
- DeleteKey( aKey );
- }
- RegCloseKey( pImp->aGroupHdl );
-
- ByteString aBStr( rGroup, osl_getThreadTextEncoding() );
- RegDeleteKey( HKEY_CLASSES_ROOT, aBStr.GetBuffer() );
- pImp->bValidGroup = FALSE;
- if( rGroup != aOldGroup )
- SetAppGroup( aOldGroup );
-}
-
-BOOL ReadKey_Impl( const String& rKey,
- HKEY aHdl, String& rResult )
-{
- char s[MAXREGVALUE];
- LONG aLen=MAXREGVALUE;
-
- ByteString aBStr( rKey, osl_getThreadTextEncoding() );
- LONG nRes = RegQueryValue( aHdl, aBStr.GetBuffer(), s, &aLen);
- if(nRes == ERROR_SUCCESS)
- {
- rResult = UniString::CreateFromAscii(s);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-String RegInfo::ReadKey( const String& rKey ) const
-{
- DBG_HDL String::EmptyString();
- String aRes;
- if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes))
- return aRes;
- else
- return String::EmptyString();
-}
-
-String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const
-{
- DBG_HDL String::EmptyString();
- String aRes;
- if(ReadKey_Impl( rKey, pImp->aGroupHdl, aRes))
- return aRes;
- else
- return rDefault;
-}
-
-void RegInfo::WriteKey( const String& rKey, const String& rValue )
-{
- DBG_HDL;
- ByteString aBStr( rKey, osl_getThreadTextEncoding() );
- ByteString aBStr1( rValue, osl_getThreadTextEncoding() );
- RegSetValue( pImp->aGroupHdl, aBStr.GetBuffer(), REG_SZ, aBStr1.GetBuffer(), 0);
-}
-
-
-void RegInfo::DeleteKey( const String& rKey )
-{
- DBG_HDL;
- ByteString aBStr( rKey, osl_getThreadTextEncoding() );
- RegDeleteKey( pImp->aGroupHdl, aBStr.GetBuffer() );
-}
-
-// *****************************************************************************
-#elif defined(OS2)
-
-#define INCL_WINSHELLDATA
-#include <svpm.h>
-
-struct RegInfo_Impl
-{
- char *pKeyList;
- String aCurrentApp;
- void BuildKeyList( const String &rGroup );
-};
-
-void RegInfo_Impl::BuildKeyList( const String &rGroup )
-{
- ByteString aBStr( rGroup, osl_getThreadTextEncoding() );
- USHORT nLen = 0;
- do
- {
- nLen+=1000;
- delete[] pKeyList;
- pKeyList = new char[nLen];
- *(int *)pKeyList = 0;
- }
- while( PrfQueryProfileString(
- HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(),
- 0, 0, pKeyList, nLen) == nLen);
-}
-
-
-RegInfo::RegInfo()
-{
- pImp=new RegInfo_Impl;
- pImp->pKeyList = 0;
-}
-
-RegInfo::~RegInfo()
-{
- delete[] pImp->pKeyList;
- delete pImp;
-}
-
-inline String MakeAppGroupString_Impl( const String &rGroup )
-{
- String aGroup(UniString::CreateFromAscii("SvAppGroups:"));
- aGroup+=rGroup;
- return aGroup;
-}
-
-String RegInfo::GetKeyName( USHORT nKey ) const
-{
- if( !pImp->pKeyList )
- pImp->BuildKeyList(pImp->aCurrentApp);
-
- const char *pc=pImp->pKeyList;
- for( USHORT n=0; n<nKey; n++ )
- while(*pc++);
-
- return String(UniString::CreateFromAscii(pc));
-}
-
-USHORT RegInfo::GetKeyCount() const
-{
- if( !pImp->pKeyList )
- pImp->BuildKeyList( pImp->aCurrentApp);
-
- const char *pc=pImp->pKeyList;
- USHORT nRet=0;
- while(*pc)
- {
- while(*pc++);
- nRet++;
- }
- return nRet;
-}
-
-void RegInfo::SetAppGroup( const String& rGroup )
-{
- delete[] pImp->pKeyList;
- pImp->pKeyList = 0;
- aCurrentGroup = rGroup;
- pImp->aCurrentApp = MakeAppGroupString_Impl( rGroup );
-}
-
-void RegInfo::DeleteAppGroup( const String &rGroup )
-{
- ByteString aBStr( MakeAppGroupString_Impl( rGroup ), osl_getThreadTextEncoding() );
- PrfWriteProfileString(
- HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), 0, 0);
-}
-
-
-String RegInfo::ReadKey( const String& rKey ) const
-{
- ULONG ulBufferMax = MAXREGVALUE;
- char *pBuffer= new char[MAXREGVALUE];
- ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() );
- ByteString aBStr1( rKey, osl_getThreadTextEncoding() );
- *pBuffer=0;
- PrfQueryProfileData(
- HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)aBStr1.GetBuffer(), pBuffer, &ulBufferMax);
- String aRet(UniString::CreateFromAscii(pBuffer));
- delete[] pBuffer;
- return aRet;
-}
-
-
-String RegInfo::ReadKey( const String& rKey, const String &rDefault ) const
-{
- String aResult = ReadKey(rKey);
- if (!aResult.Len())
- return rDefault;
- else
- return aResult;
-}
-
-
-void RegInfo::WriteKey( const String& rKey, const String& rValue )
-{
- ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() );
- ByteString aBStr1( rKey, osl_getThreadTextEncoding() );
- PrfWriteProfileData(
- HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)aBStr1.GetBuffer(), (PVOID)rValue.GetBuffer(), rValue.Len()*2);
-}
-
-void RegInfo::DeleteKey( const String& rKey )
-{
- ByteString aBStr( pImp->aCurrentApp, osl_getThreadTextEncoding() );
- ByteString aBStr1( rKey, osl_getThreadTextEncoding() );
- PrfWriteProfileString(
- HINI_USERPROFILE, (PCSZ)aBStr.GetBuffer(), (PCSZ)rKey.GetBuffer(), 0);
-}
-
-// *****************************************************************************
-
-#else
-
-RegInfo::RegInfo()
-{
-}
-
-
-RegInfo::~RegInfo()
-{
-}
-
-String RegInfo::GetKeyName( USHORT ) const
-{
- return String::EmptyString();
-}
-
-USHORT RegInfo::GetKeyCount() const
-{
- return 0;
-}
-
-void RegInfo::SetAppGroup( const String& )
-{
- return ;
-}
-
-void RegInfo::DeleteAppGroup( const String& )
-{
- return;
-}
-
-String RegInfo::ReadKey( const String& ) const
-{
- return String::EmptyString();
-}
-
-String RegInfo::ReadKey( const String&, const String& ) const
-{
- return String::EmptyString();
-}
-
-void RegInfo::WriteKey( const String&, const String& )
-{
- return;
-}
-
-void RegInfo::DeleteKey( const String& )
-{
- return;
-}
-
-#endif
diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx
index b0e178e631d9..693bca733813 100644
--- a/svtools/source/control/roadmap.cxx
+++ b/svtools/source/control/roadmap.cxx
@@ -49,11 +49,10 @@
#endif
#include <memory>
-#define RMENTRYPOINT_X 4
-#define RMENTRYPOINT_Y 27
-#define RMITEMDISTANCE_Y 6
+#define ROADMAP_INDENT_X 4
+#define ROADMAP_INDENT_Y 27
+#define ROADMAP_ITEM_DISTANCE_Y 6
#define RMINCOMPLETE -1
-#define NREMOVERMITEM -1
#define NADDITEM 1
#define INCOMPLETELABEL ::String::CreateFromAscii("...") // TODO: Cast to String
@@ -63,30 +62,18 @@ namespace svt
//.........................................................................
typedef std::vector< ::rtl::OUString > S_Vector;
- typedef std::vector< ORoadmapHyperLabel* > HL_Vector;
+ typedef std::vector< RoadmapItem* > HL_Vector;
//=====================================================================
- //= FontChanger
+ //= ColorChanger
//=====================================================================
-// class FontChanger
-// {
-// protected:
-// OutputDevice* m_pDev;
-//
-// public:
-// FontChanger( OutputDevice* _pDev, const Font& _rNewFont )
-// :m_pDev( _pDev )
-// {
-// m_pDev->Push( PUSH_FONT );
-// m_pDev->SetFont( _rNewFont );
-// }
-//
-// ~FontChanger()
-// {
-// m_pDev->Pop( );
-// }
-// };
-
+ class IDLabel : public FixedText
+ {
+ public:
+ IDLabel( Window* _pParent, WinBits _nWinStyle = 0 );
+ ~IDLabel( );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ };
//=====================================================================
//= ColorChanger
@@ -111,6 +98,51 @@ namespace svt
}
};
+ //=====================================================================
+ //= RoadmapItem
+ //=====================================================================
+ class RoadmapItem : public RoadmapTypes
+ {
+ private:
+ IDLabel* mpID;
+ HyperLabel* mpDescription;
+ const Size m_aItemPlayground;
+
+ public:
+ RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground );
+ ~RoadmapItem( );
+
+ void SetID( sal_Int16 _ID );
+ sal_Int16 GetID() const;
+
+ void SetIndex( ItemIndex _Index );
+ ItemIndex GetIndex() const;
+
+ void SetLabel( const ::rtl::OUString& _rText );
+ ::rtl::OUString GetLabel( );
+
+ void Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText );
+
+ void SetPosition( RoadmapItem* OldHyperLabel );
+
+ void ToggleBackgroundColor( const Color& _rGBColor );
+ void SetInteractive( sal_Bool _bInteractive );
+
+ void SetClickHdl( const Link& rLink );
+ const Link& GetClickHdl() const;
+ void SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags );
+ void Enable( BOOL bEnable = TRUE);
+ BOOL IsEnabled() const;
+ void GrabFocus();
+
+ bool Contains( const Window* _pWindow ) const;
+
+ HyperLabel* GetDescriptionHyperLabel() const { return mpDescription; }
+
+ private:
+ void ImplUpdateIndex( const ItemIndex _nIndex );
+ void ImplUpdatePosSize();
+ };
//=====================================================================
//= RoadmapImpl
@@ -118,27 +150,32 @@ namespace svt
class RoadmapImpl : public RoadmapTypes
{
protected:
+ const ORoadmap& m_rAntiImpl;
Link m_aSelectHdl;
BitmapEx m_aPicture;
HL_Vector m_aRoadmapSteps;
ItemId m_iCurItemID;
sal_Bool m_bInteractive;
sal_Bool m_bComplete;
+ Size m_aItemSizePixel;
public:
- RoadmapImpl() :
- m_bInteractive( sal_True ),
- m_bComplete( sal_True ) {}
+ RoadmapImpl( const ORoadmap& _rAntiImpl )
+ :m_rAntiImpl( _rAntiImpl )
+ ,m_iCurItemID( -1 )
+ ,m_bInteractive( sal_True )
+ ,m_bComplete( sal_True )
+ {
+ }
- Size aHyperLabelPixelSize;
- ORoadmapHyperLabel* InCompleteHyperLabel;
+ RoadmapItem* InCompleteHyperLabel;
- void addHyperLabel( ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
+ void addHyperLabel( RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.push_back(_rRoadmapStep); }
HL_Vector& getHyperLabels() { return m_aRoadmapSteps; }
const HL_Vector& getHyperLabels() const { return m_aRoadmapSteps; }
- void insertHyperLabel( ItemIndex _Index, ORoadmapHyperLabel* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
+ void insertHyperLabel( ItemIndex _Index, RoadmapItem* _rRoadmapStep ) { m_aRoadmapSteps.insert( m_aRoadmapSteps.begin() + _Index, _rRoadmapStep ); }
ItemIndex getItemCount() const { return m_aRoadmapSteps.size();}
@@ -157,6 +194,9 @@ namespace svt
void setSelectHdl( const Link& _rHdl ) { m_aSelectHdl = _rHdl; }
const Link& getSelectHdl( ) const { return m_aSelectHdl; }
+ void initItemSize();
+ const Size& getItemSize() const { return m_aItemSizePixel; }
+
void removeHyperLabel( ItemIndex _Index )
{
if ( ( _Index > -1 ) && ( _Index < getItemCount() ) )
@@ -172,8 +212,21 @@ namespace svt
//= Roadmap
//=====================================================================
//---------------------------------------------------------------------
- ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId ):Control( _pParent, _rId )
- ,m_pImpl( new RoadmapImpl() )
+ void RoadmapImpl::initItemSize()
+ {
+ Size aLabelSize( m_rAntiImpl.GetOutputSizePixel() );
+ aLabelSize.Height() = m_rAntiImpl.LogicToPixel( Size( 0, LABELBASEMAPHEIGHT ), MAP_APPFONT ).Height();
+ aLabelSize.Width() -= m_rAntiImpl.LogicToPixel( Size( 2 * ROADMAP_INDENT_X, 0 ), MAP_APPFONT ).Width();
+ m_aItemSizePixel = aLabelSize;
+ }
+
+ //=====================================================================
+ //= Roadmap
+ //=====================================================================
+ //---------------------------------------------------------------------
+ ORoadmap::ORoadmap( Window* _pParent, const ResId& _rId )
+ :Control( _pParent, _rId )
+ ,m_pImpl( new RoadmapImpl( *this ) )
{
implInit();
}
@@ -181,7 +234,7 @@ namespace svt
//---------------------------------------------------------------------
ORoadmap::ORoadmap( Window* _pParent, WinBits _nWinStyle )
:Control( _pParent, _nWinStyle )
- , m_pImpl( new RoadmapImpl() )
+ ,m_pImpl( new RoadmapImpl( *this ) )
{
implInit();
@@ -216,14 +269,15 @@ namespace svt
// on this with calculating a new bold font.
// Unfortunately, the OutputDevice does not offer a notify mechanism for a changed font.
// So settings the font from outside is simply a forbidded scenario at the moment
+ EnableMapMode( sal_False );
}
//---------------------------------------------------------------------
ORoadmap::~ORoadmap( )
{
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
+ HL_Vector aItemsCopy = m_pImpl->getHyperLabels();
m_pImpl->getHyperLabels().clear();
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+ for ( HL_Vector::iterator i = aItemsCopy.begin(); i< aItemsCopy.end(); ++i )
{
delete *i;
}
@@ -240,54 +294,43 @@ namespace svt
}
- void ORoadmap::InitializeHyperLabelSize()
+ RoadmapItem* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
{
- Size aSize = GetSizePixel();
- Size aLogicSize = PixelToLogic( aSize, MAP_APPFONT );
- aLogicSize.Height() = LABELBASEMAPHEIGHT;
- aLogicSize.Width() -= (2*RMENTRYPOINT_X);
- m_pImpl->aHyperLabelPixelSize = LogicToPixel( aLogicSize, MAP_APPFONT );
- EnableMapMode( sal_False );
- }
-
-
- ORoadmapHyperLabel* ORoadmap::GetPreviousHyperLabel( ItemIndex _Index)
- {
- ORoadmapHyperLabel* OldHyperLabel = NULL;
- if (_Index > 0)
- OldHyperLabel = m_pImpl->getHyperLabels().at( _Index - 1 );
- return OldHyperLabel;
+ RoadmapItem* pOldItem = NULL;
+ if ( _Index > 0 )
+ pOldItem = m_pImpl->getHyperLabels().at( _Index - 1 );
+ return pOldItem;
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::InsertHyperLabel( ItemIndex _Index, ::rtl::OUString _sLabel, ItemId _RMID, sal_Bool _bEnabled)
+ RoadmapItem* ORoadmap::InsertHyperLabel( ItemIndex _Index, const ::rtl::OUString& _sLabel, ItemId _RMID, sal_Bool _bEnabled)
{
- if (m_pImpl->getItemCount() == 0 )
- InitializeHyperLabelSize();
- ORoadmapHyperLabel* CurHyperLabel;
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( _Index);
+ if ( m_pImpl->getItemCount() == 0 )
+ m_pImpl->initItemSize();
+
+ RoadmapItem* pItem = NULL;
+ RoadmapItem* pOldItem = GetPreviousHyperLabel( _Index );
- if (_RMID != RMINCOMPLETE )
+ pItem = new RoadmapItem( *this, m_pImpl->getItemSize() );
+ if ( _RMID != RMINCOMPLETE )
{
- CurHyperLabel = new ORoadmapHyperLabel(this, WB_WORDBREAK);
- CurHyperLabel->SetInteractive( m_pImpl->isInteractive() );
- m_pImpl->insertHyperLabel(_Index, CurHyperLabel );
+ pItem->SetInteractive( m_pImpl->isInteractive() );
+ m_pImpl->insertHyperLabel( _Index, pItem );
}
else
{
- CurHyperLabel = new ORoadmapHyperLabel(this);
- CurHyperLabel->SetInteractive( sal_False );
+ pItem->SetInteractive( sal_False );
}
- CurHyperLabel->SetPosition( OldHyperLabel );
- CurHyperLabel->SetLabelAndSize( _Index, _sLabel, m_pImpl->aHyperLabelPixelSize );
- CurHyperLabel->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
- CurHyperLabel->SetID( _RMID );
- CurHyperLabel->SetIndex( _Index );
+ pItem->SetPosition( pOldItem );
+ pItem->Update( _Index, _sLabel );
+ pItem->SetClickHdl(LINK( this, ORoadmap, ImplClickHdl ) );
+ pItem->SetID( _RMID );
+ pItem->SetIndex( _Index );
if (!_bEnabled)
- CurHyperLabel->Enable( _bEnabled );
- return CurHyperLabel;
+ pItem->Enable( _bEnabled );
+ return pItem;
}
//---------------------------------------------------------------------
@@ -308,12 +351,14 @@ namespace svt
void ORoadmap::SetRoadmapInteractive( sal_Bool _bInteractive )
{
m_pImpl->setInteractive( _bInteractive );
- ORoadmapHyperLabel* CurHyperLabel;
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- CurHyperLabel->SetInteractive( _bInteractive );
+ (*i)->SetInteractive( _bInteractive );
}
}
@@ -326,76 +371,55 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::SetRoadmapComplete( sal_Bool _bComplete )
{
- sal_Bool OldbComplete = m_pImpl->isComplete();
- m_pImpl->setComplete( _bComplete);
- if (_bComplete)
+ sal_Bool bWasComplete = m_pImpl->isComplete();
+ m_pImpl->setComplete( _bComplete );
+ if ( _bComplete )
{
if ( m_pImpl->InCompleteHyperLabel != NULL)
{
- if (m_pImpl->getItemCount() > 0)
- {
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- pLocRoadmapItems.pop_back();
- delete m_pImpl->InCompleteHyperLabel;
- }
+ delete m_pImpl->InCompleteHyperLabel;
m_pImpl->InCompleteHyperLabel = NULL;
}
}
- else if (OldbComplete)
- m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), RMINCOMPLETE );
+ else if ( bWasComplete )
+ m_pImpl->InCompleteHyperLabel = InsertHyperLabel( m_pImpl->getItemCount(), ::String::CreateFromAscii( "..." ), RMINCOMPLETE );
}
//---------------------------------------------------------------------
- void ORoadmap::SetRoadmapLabel(ORoadmapHyperLabel* CurHyperLabel, sal_Int32 _nPrefix, String _sDescription)
+ void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _nIndex )
{
- const xub_StrLen n_Pos = _sDescription.Search( String::CreateFromAscii(".") );
- if ( n_Pos != STRING_NOTFOUND )
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ if ( _nIndex < (ItemIndex)rItems.size() )
{
- const String sID = ::String::CreateFromInt32( _nPrefix );
- _sDescription.Replace(0 , n_Pos, sID );
- }
- CurHyperLabel->SetLabelAndSize( _nPrefix, _sDescription, m_pImpl->aHyperLabelPixelSize );
- }
-
- //---------------------------------------------------------------------
- void ORoadmap::UpdatefollowingHyperLabels( ItemIndex _Index, sal_Int16 )
- {
- if ( _Index < ( m_pImpl->getItemCount() ) )
- {
- Point aPos;
- String sLabel;
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ORoadmapHyperLabel* CurHyperLabel = NULL;
- ItemIndex n_CurPrefix = _Index + 1 ;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ _Index; i< pLocRoadmapItems.end(); i++)
+ RoadmapItem* pItem = NULL;
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex;
+ i< rItems.end();
+ ++i, ++_nIndex
+ )
{
- CurHyperLabel = *i;
- aPos = CurHyperLabel->GetLogicalPosition();
- CurHyperLabel->SetIndex( n_CurPrefix - 1);
- sLabel = CurHyperLabel->GetLabel();
- SetRoadmapLabel(CurHyperLabel, n_CurPrefix, sLabel);
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( n_CurPrefix-1);
- CurHyperLabel->SetPosition( OldHyperLabel);
- n_CurPrefix++;
+ pItem = *i;
+
+ pItem->SetIndex( _nIndex );
+ pItem->SetPosition( GetPreviousHyperLabel( _nIndex ) );
}
}
if ( ! m_pImpl->isComplete() )
{
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( m_pImpl->getItemCount());
- m_pImpl->InCompleteHyperLabel->SetPosition( OldHyperLabel );
- m_pImpl->InCompleteHyperLabel->SetLabelAndSize( m_pImpl->getItemCount(), ::String::CreateFromAscii("..."), m_pImpl->aHyperLabelPixelSize );
+ RoadmapItem* pOldItem = GetPreviousHyperLabel( m_pImpl->getItemCount() );
+ m_pImpl->InCompleteHyperLabel->SetPosition( pOldItem );
+ m_pImpl->InCompleteHyperLabel->Update( m_pImpl->getItemCount(), ::String::CreateFromAscii("...") );
}
}
//---------------------------------------------------------------------
- void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
+ void ORoadmap::ReplaceRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _RMID, sal_Bool _bEnabled )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByIndex( _Index);
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByIndex( _Index);
+ if ( pItem != NULL )
{
- CurHyperLabel->SetLabelAndSize( _Index, _RoadmapItem, m_pImpl->aHyperLabelPixelSize );
- CurHyperLabel->SetID( _RMID );
- CurHyperLabel->Enable( _bEnabled );
+ pItem->Update( _Index, _RoadmapItem );
+ pItem->SetID( _RMID );
+ pItem->Enable( _bEnabled );
}
}
@@ -408,7 +432,7 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetItemID( ItemIndex _nIndex ) const
{
- const ORoadmapHyperLabel* pHyperLabel = GetByIndex( _nIndex );
+ const RoadmapItem* pHyperLabel = GetByIndex( _nIndex );
if ( pHyperLabel )
return pHyperLabel->GetID();
return -1;
@@ -417,28 +441,26 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemIndex ORoadmap::GetItemIndex( ItemId _nID ) const
{
- ORoadmapHyperLabel* CurHyperLabel;
ItemId nLocID = 0;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- ItemIndex nResult = 0;
- for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- nLocID = CurHyperLabel->GetID();
+ nLocID = (*i)->GetID();
if ( nLocID == _nID )
- return nResult;
- nResult++;
+ return ItemIndex( i - rItems.begin() );
}
return -1;
}
//---------------------------------------------------------------------
- void ORoadmap::InsertRoadmapItem( ItemIndex _Index, ::rtl::OUString _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
+ void ORoadmap::InsertRoadmapItem( ItemIndex _Index, const ::rtl::OUString& _RoadmapItem, ItemId _nUniqueId, sal_Bool _bEnabled )
{
- ORoadmapHyperLabel* CurHyperLabel;
- CurHyperLabel = InsertHyperLabel(_Index, _RoadmapItem, _nUniqueId, _bEnabled);
+ InsertHyperLabel( _Index, _RoadmapItem, _nUniqueId, _bEnabled );
// Todo: YPos is superfluous, if items are always appended
- UpdatefollowingHyperLabels( _Index + 1);
+ UpdatefollowingHyperLabels( _Index + 1 );
}
//---------------------------------------------------------------------
@@ -447,7 +469,7 @@ namespace svt
if ( m_pImpl->getItemCount() > 0 && ( _Index > -1) && ( _Index < m_pImpl->getItemCount() ) )
{
m_pImpl->removeHyperLabel( _Index );
- UpdatefollowingHyperLabels( _Index, NREMOVERMITEM);
+ UpdatefollowingHyperLabels( _Index );
}
}
@@ -460,33 +482,33 @@ namespace svt
//---------------------------------------------------------------------
sal_Bool ORoadmap::IsRoadmapItemEnabled( ItemId _nItemId, ItemIndex _nStartIndex ) const
{
- const ORoadmapHyperLabel* _pLabelItem = GetByID( _nItemId, _nStartIndex );
+ const RoadmapItem* _pLabelItem = GetByID( _nItemId, _nStartIndex );
return _pLabelItem ? _pLabelItem->IsEnabled() : sal_False;
}
//---------------------------------------------------------------------
void ORoadmap::EnableRoadmapItem( ItemId _nItemId, sal_Bool _bEnable, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nItemId, _nStartIndex );
- if ( CurHyperLabel != NULL )
- CurHyperLabel->Enable( _bEnable );
+ RoadmapItem* pItem = GetByID( _nItemId, _nStartIndex );
+ if ( pItem != NULL )
+ pItem->Enable( _bEnable );
}
//---------------------------------------------------------------------
- void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, ::rtl::OUString _sLabel, ItemIndex _nStartIndex )
+ void ORoadmap::ChangeRoadmapItemLabel( ItemId _nID, const ::rtl::OUString& _sLabel, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
{
- CurHyperLabel->SetLabelAndSize( CurHyperLabel->GetIndex(), _sLabel, m_pImpl->aHyperLabelPixelSize );
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ItemIndex Index = _nStartIndex;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin()+ Index; i< pLocRoadmapItems.end(); i++)
+ pItem->Update( pItem->GetIndex(), _sLabel );
+
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- ORoadmapHyperLabel* OldHyperLabel = GetPreviousHyperLabel( Index );
- CurHyperLabel->SetPosition( OldHyperLabel);
- Index++;
+ (*i)->SetPosition( GetPreviousHyperLabel( i - rItems.begin() ) );
}
}
}
@@ -495,9 +517,9 @@ namespace svt
::rtl::OUString ORoadmap::GetRoadmapItemLabel( ItemId _nID, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
- return CurHyperLabel->GetLabel();
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
+ return pItem->GetLabel();
else
return ::rtl::OUString();
}
@@ -505,47 +527,47 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::ChangeRoadmapItemID( ItemId _nID, ItemId _NewID, ItemIndex _nStartIndex )
{
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nID, _nStartIndex );
- if ( CurHyperLabel != NULL )
- CurHyperLabel->SetID( _NewID );
+ RoadmapItem* pItem = GetByID( _nID, _nStartIndex );
+ if ( pItem != NULL )
+ pItem->SetID( _NewID );
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
+ RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex)
{
- ORoadmapHyperLabel* CurHyperLabel;
ItemId nLocID = 0;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = LocHyperLabels.begin()+ _nStartIndex; i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin() + _nStartIndex;
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- nLocID = CurHyperLabel->GetID();
+ nLocID = (*i)->GetID();
if ( nLocID == _nID )
- return CurHyperLabel;
+ return *i;
}
return NULL;
}
//---------------------------------------------------------------------
- const ORoadmapHyperLabel* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const
+ const RoadmapItem* ORoadmap::GetByID( ItemId _nID, ItemIndex _nStartIndex ) const
{
return const_cast< ORoadmap* >( this )->GetByID( _nID, _nStartIndex );
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
+ RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex)
{
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- if ((_nItemIndex > -1) && (_nItemIndex < m_pImpl->getItemCount( ) ) )
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) )
{
- ORoadmapHyperLabel* CurHyperLabel = LocHyperLabels.at(_nItemIndex); // Vectors are one-based
- return CurHyperLabel;
+ return rItems.at( _nItemIndex );
}
return NULL;
}
//---------------------------------------------------------------------
- const ORoadmapHyperLabel* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
+ const RoadmapItem* ORoadmap::GetByIndex( ItemIndex _nItemIndex ) const
{
return const_cast< ORoadmap* >( this )->GetByIndex( _nItemIndex );
}
@@ -553,14 +575,14 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetNextAvailableItemId( ItemIndex _nNewIndex )
{
- ORoadmapHyperLabel* CurHyperLabel;
+ RoadmapItem* pItem = NULL;
ItemIndex searchIndex = ++_nNewIndex;
while ( searchIndex < m_pImpl->getItemCount() )
{
- CurHyperLabel = GetByIndex( searchIndex );
- if ( CurHyperLabel->IsEnabled() )
- return CurHyperLabel->GetID( );
+ pItem = GetByIndex( searchIndex );
+ if ( pItem->IsEnabled() )
+ return pItem->GetID( );
++searchIndex;
}
@@ -570,13 +592,13 @@ namespace svt
//---------------------------------------------------------------------
RoadmapTypes::ItemId ORoadmap::GetPreviousAvailableItemId( ItemIndex _nNewIndex )
{
- ORoadmapHyperLabel* CurHyperLabel;
+ RoadmapItem* pItem = NULL;
ItemIndex searchIndex = --_nNewIndex;
while ( searchIndex > -1 )
{
- CurHyperLabel = GetByIndex( searchIndex );
- if ( CurHyperLabel->IsEnabled() )
- return CurHyperLabel->GetID( );
+ pItem = GetByIndex( searchIndex );
+ if ( pItem->IsEnabled() )
+ return pItem->GetID( );
searchIndex--;
}
@@ -586,12 +608,13 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::DeselectOldRoadmapItems()
{
- HL_Vector pLocRoadmapItems = m_pImpl->getHyperLabels();
- ORoadmapHyperLabel* CurHyperLabel = NULL;
- for ( HL_Vector::iterator i = pLocRoadmapItems.begin(); i< pLocRoadmapItems.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- CurHyperLabel->ToggleBackgroundColor( COL_TRANSPARENT );
+ (*i)->ToggleBackgroundColor( COL_TRANSPARENT );
}
}
@@ -617,7 +640,7 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::GetFocus()
{
- ORoadmapHyperLabel* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
+ RoadmapItem* pCurHyperLabel = GetByID( GetCurrentRoadmapItemID() );
if ( pCurHyperLabel != NULL )
pCurHyperLabel->GrabFocus();
}
@@ -626,15 +649,15 @@ namespace svt
sal_Bool ORoadmap::SelectRoadmapItemByID( ItemId _nNewID )
{
DeselectOldRoadmapItems();
- ORoadmapHyperLabel* CurHyperLabel = GetByID( _nNewID );
- if (CurHyperLabel != NULL)
+ RoadmapItem* pItem = GetByID( _nNewID );
+ if ( pItem != NULL )
{
- if (CurHyperLabel->IsEnabled())
+ if ( pItem->IsEnabled() )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- CurHyperLabel->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
+ pItem->ToggleBackgroundColor( rStyleSettings.GetHighlightColor() ); //HighlightColor
- CurHyperLabel->GrabFocus();
+ pItem->GrabFocus();
m_pImpl->setCurItemID(_nNewID);
Select();
@@ -670,7 +693,7 @@ namespace svt
//---------------------------------------------------------------------
void ORoadmap::DrawHeadline()
{
- Point aTextPos = LogicToPixel( Point( RMENTRYPOINT_X, 8 ), MAP_APPFONT );
+ Point aTextPos = LogicToPixel( Point( ROADMAP_INDENT_X, 8 ), MAP_APPFONT );
Size aOutputSize( GetOutputSizePixel() );
@@ -683,15 +706,16 @@ namespace svt
}
//---------------------------------------------------------------------
- ORoadmapHyperLabel* ORoadmap::GetByPointer(Window* pWindow)
+ RoadmapItem* ORoadmap::GetByPointer(Window* pWindow)
{
- ORoadmapHyperLabel* CurHyperLabel;
- HL_Vector &LocHyperLabels = m_pImpl->getHyperLabels();
- for ( HL_Vector::iterator i = LocHyperLabels.begin(); i< LocHyperLabels.end(); i++)
+ const HL_Vector& rItems = m_pImpl->getHyperLabels();
+ for ( HL_Vector::const_iterator i = rItems.begin();
+ i < rItems.end();
+ ++i
+ )
{
- CurHyperLabel = *i;
- if ( (CurHyperLabel->GetIDLabel() == pWindow) || (CurHyperLabel->GetDescriptionHyperLabel() == pWindow) )
- return CurHyperLabel;
+ if ( (*i)->Contains( pWindow ) )
+ return *i;
}
return NULL;
}
@@ -703,30 +727,30 @@ namespace svt
if ( _rNEvt.GetType() == EVENT_KEYINPUT )
{
Window* pWindow = _rNEvt.GetWindow();
- ORoadmapHyperLabel* CurHyperLabel = GetByPointer( pWindow );
- if ( CurHyperLabel != NULL )
+ RoadmapItem* pItem = GetByPointer( pWindow );
+ if ( pItem != NULL )
{
sal_Int16 nKeyCode = _rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
switch( nKeyCode )
{
case KEY_UP:
- { // Note: Performancewhise this is not optimal, because we search for an ID in the labels
+ { // Note: Performancewise this is not optimal, because we search for an ID in the labels
// and afterwards we search again for a label with the appropriate ID ->
// unnecessarily we search twice!!!
- ItemId nPrevItemID = GetPreviousAvailableItemId( CurHyperLabel->GetIndex() );
+ ItemId nPrevItemID = GetPreviousAvailableItemId( pItem->GetIndex() );
if ( nPrevItemID != -1 )
return SelectRoadmapItemByID( nPrevItemID );
}
break;
case KEY_DOWN:
{
- ItemId nNextItemID = GetNextAvailableItemId( CurHyperLabel->GetIndex() );
+ ItemId nNextItemID = GetNextAvailableItemId( pItem->GetIndex() );
if ( nNextItemID != -1 )
return SelectRoadmapItemByID( nNextItemID );
}
break;
case KEY_SPACE:
- return SelectRoadmapItemByID( CurHyperLabel->GetID() );
+ return SelectRoadmapItemByID( pItem->GetID() );
}
}
}
@@ -736,9 +760,12 @@ namespace svt
//---------------------------------------------------------------------
IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel*, _CurHyperLabel)
{
- return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
+ return SelectRoadmapItemByID( _CurHyperLabel->GetID() );
}
+
+
+ //---------------------------------------------------------------------
void ORoadmap::DataChanged( const DataChangedEvent& rDCEvt )
{
if ((( rDCEvt.GetType() == DATACHANGED_SETTINGS ) ||
@@ -752,216 +779,228 @@ namespace svt
aFont.SetColor( aTextColor );
SetFont( aFont );
RoadmapTypes::ItemId curItemID = GetCurrentRoadmapItemID();
- ORoadmapHyperLabel* pLabelItem = GetByID( curItemID );
+ RoadmapItem* pLabelItem = GetByID( curItemID );
pLabelItem->ToggleBackgroundColor(rStyleSettings.GetHighlightColor());
Invalidate();
}
}
- ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, const ResId& )
+ //---------------------------------------------------------------------
+ RoadmapItem::RoadmapItem( ORoadmap& _rParent, const Size& _rItemPlayground )
+ :m_aItemPlayground( _rItemPlayground )
{
- mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK);
- mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK);
+ mpID = new IDLabel( &_rParent, WB_WORDBREAK );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
+ mpID->Show();
+ mpDescription = new HyperLabel( &_rParent, WB_NOTABSTOP | WB_WORDBREAK );
+ mpDescription->Show();
}
-
- ORoadmapHyperLabel::ORoadmapHyperLabel( Window* _pParent, WinBits )
+ //---------------------------------------------------------------------
+ bool RoadmapItem::Contains( const Window* _pWindow ) const
{
- mpIDLabel = new ORoadmapIDHyperLabel(_pParent, WB_WORDBREAK);
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
- mpDescHyperLabel = new HyperLabel(_pParent, WB_NOTABSTOP | WB_WORDBREAK);
+ return ( mpID == _pWindow ) || ( mpDescription == _pWindow );
}
//---------------------------------------------------------------------
- void ORoadmapHyperLabel::GrabFocus()
+ void RoadmapItem::GrabFocus()
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->GrabFocus();
+ if ( mpDescription )
+ mpDescription->GrabFocus();
}
-
- void ORoadmapHyperLabel::SetInteractive( sal_Bool _bInteractive )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetInteractive( sal_Bool _bInteractive )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetInteractive(_bInteractive);
+ if ( mpDescription )
+ mpDescription->SetInteractive(_bInteractive);
}
- void ORoadmapHyperLabel::SetID( sal_Int16 _ID )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetID( sal_Int16 _ID )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetID(_ID);
+ if ( mpDescription )
+ mpDescription->SetID(_ID);
}
- sal_Int16 ORoadmapHyperLabel::GetID() const
+ //---------------------------------------------------------------------
+ sal_Int16 RoadmapItem::GetID() const
{
- return mpDescHyperLabel ? mpDescHyperLabel->GetID() : sal_Int16(-1);
+ return mpDescription ? mpDescription->GetID() : sal_Int16(-1);
}
- void ORoadmapHyperLabel::SetIndex( sal_Int32 _Index )
+ //---------------------------------------------------------------------
+ void RoadmapItem::ImplUpdateIndex( const ItemIndex _nIndex )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetIndex(_Index);
- }
+ if ( mpDescription )
+ mpDescription->SetIndex( _nIndex );
+ if ( mpID )
+ {
+ ::rtl::OUString aIDText = ::rtl::OUString::valueOf( (sal_Int32)( _nIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." );
+ mpID->SetText( aIDText );
+ }
- sal_Int32 ORoadmapHyperLabel::GetIndex() const
- {
- return mpDescHyperLabel ? mpDescHyperLabel->GetIndex() : sal_Int32(-1);
+ // update the geometry of both controls
+ ImplUpdatePosSize();
}
-
- void ORoadmapHyperLabel::SetLabel( ::rtl::OUString _rText )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetIndex( ItemIndex _Index )
{
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetText(_rText);
+ ImplUpdateIndex( _Index );
}
+ //---------------------------------------------------------------------
+ RoadmapTypes::ItemIndex RoadmapItem::GetIndex() const
+ {
+ return mpDescription ? mpDescription->GetIndex() : ItemIndex(-1);
+ }
- ::rtl::OUString ORoadmapHyperLabel::GetLabel( )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetLabel( const ::rtl::OUString& _rText )
{
- return mpDescHyperLabel ? mpDescHyperLabel->GetText() : String();
+ if ( mpDescription )
+ mpDescription->SetText(_rText);
}
+ //---------------------------------------------------------------------
+ ::rtl::OUString RoadmapItem::GetLabel( )
+ {
+ return mpDescription ? mpDescription->GetText() : String();
+ }
- void ORoadmapHyperLabel::SetPosition(ORoadmapHyperLabel* OldHyperLabel)
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetPosition( RoadmapItem* _pOldItem )
{
- Point aNewLogicalPoint;
- Point aNewPoint;
- if (OldHyperLabel == NULL)
+ Point aIDPos;
+ if ( _pOldItem == NULL )
{
- aNewLogicalPoint = Point( RMENTRYPOINT_X, RMENTRYPOINT_Y);
- aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT );
+ aIDPos = mpID->LogicToPixel( Point( ROADMAP_INDENT_X, ROADMAP_INDENT_Y ), MAP_APPFONT );
}
else
{
- Size aOldSize = OldHyperLabel->GetDescriptionHyperLabel()->GetSizePixel();
- Point aOldLogicalPoint = OldHyperLabel->GetLogicalPosition();
- aNewLogicalPoint = Point(aOldLogicalPoint.X(), (aOldLogicalPoint.Y() + RMITEMDISTANCE_Y));
- aNewPoint = mpIDLabel->LogicToPixel(aNewLogicalPoint, MAP_APPFONT );
- aNewPoint = Point(aNewPoint.X(),aNewPoint.Y() + aOldSize.Height());
+ Size aOldSize = _pOldItem->GetDescriptionHyperLabel()->GetSizePixel();
+
+ aIDPos = _pOldItem->mpID->GetPosPixel();
+ aIDPos.Y() += aOldSize.Height();
+ aIDPos.Y() += mpID->GetParent()->LogicToPixel( Size( 0, ROADMAP_ITEM_DISTANCE_Y ) ).Height();
}
- mpIDLabel->SetPosPixel( aNewPoint );
- sal_Int32 xDescPos = aNewPoint.X() + mpIDLabel->GetSizePixel().Width();
- mpDescHyperLabel->SetPosPixel( Point(xDescPos, aNewPoint.Y()) );
- }
+ mpID->SetPosPixel( aIDPos );
+ sal_Int32 nDescPos = aIDPos.X() + mpID->GetSizePixel().Width();
+ mpDescription->SetPosPixel( Point( nDescPos, aIDPos.Y() ) );
+ }
- void ORoadmapHyperLabel::SetZOrder( ORoadmapHyperLabel* pRefRoadmapHyperLabel, USHORT nFlags )
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetZOrder( RoadmapItem* pRefRoadmapHyperLabel, USHORT nFlags )
{
if (pRefRoadmapHyperLabel == NULL)
- mpDescHyperLabel->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST );
+ mpDescription->SetZOrder( NULL, nFlags); //WINDOW_ZORDER_FIRST );
else
- mpDescHyperLabel->SetZOrder( pRefRoadmapHyperLabel->mpDescHyperLabel, nFlags); //, WINDOW_ZORDER_BEHIND );
+ mpDescription->SetZOrder( pRefRoadmapHyperLabel->mpDescription, nFlags); //, WINDOW_ZORDER_BEHIND );
}
-
- void ORoadmapHyperLabel::Enable( BOOL _bEnable)
+ //---------------------------------------------------------------------
+ void RoadmapItem::Enable( BOOL _bEnable)
{
- mpIDLabel->Enable(_bEnable);
- mpDescHyperLabel->Enable(_bEnable);
+ mpID->Enable(_bEnable);
+ mpDescription->Enable(_bEnable);
}
- BOOL ORoadmapHyperLabel::IsEnabled() const
+ //---------------------------------------------------------------------
+ BOOL RoadmapItem::IsEnabled() const
{
- return mpIDLabel->IsEnabled();
+ return mpID->IsEnabled();
}
-// void ORoadmapHyperLabel::GrabFocus()
-// {
-// mpDescHyperLabel->GrabFocus();
-//
-// }
-
- void ORoadmapHyperLabel::ToggleBackgroundColor( const Color& _rGBColor )
+ //---------------------------------------------------------------------
+ void RoadmapItem::ToggleBackgroundColor( const Color& _rGBColor )
{
if (_rGBColor == COL_TRANSPARENT)
{
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
- mpIDLabel->SetControlBackground( COL_TRANSPARENT );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetFieldTextColor( ) );
+ mpID->SetControlBackground( COL_TRANSPARENT );
}
else
{
- mpIDLabel->SetControlBackground( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightColor() );
- mpIDLabel->SetTextColor( mpIDLabel->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
+ mpID->SetControlBackground( mpID->GetSettings().GetStyleSettings().GetHighlightColor() );
+ mpID->SetTextColor( mpID->GetSettings().GetStyleSettings().GetHighlightTextColor( ) );
}
- mpDescHyperLabel->ToggleBackgroundColor(_rGBColor);
+ mpDescription->ToggleBackgroundColor(_rGBColor);
}
-
- Point ORoadmapHyperLabel::GetLogicalPosition()
+ //---------------------------------------------------------------------
+ void RoadmapItem::ImplUpdatePosSize()
{
- Point aPoint = mpIDLabel->GetPosPixel( );
- Size aSize = Size(aPoint.X(), aPoint.Y());
- aSize = mpIDLabel->PixelToLogic( aSize, MAP_APPFONT );
- aPoint = Point(aSize.Width(), aSize.Height());
- return aPoint;
- }
+ // calculate widths
+ long nIDWidth = mpID->GetTextWidth( mpID->GetText() );
+ long nMaxIDWidth = mpID->GetTextWidth( ::rtl::OUString::createFromAscii( "100." ) );
+ nIDWidth = ::std::min( nIDWidth, nMaxIDWidth );
+
+ // check how many space the description would need
+ Size aDescriptionSize = mpDescription->CalcMinimumSize( m_aItemPlayground.Width() - nIDWidth );
+
+ // position and size both controls
+ Size aIDSize( nIDWidth, aDescriptionSize.Height() );
+ mpID->SetSizePixel( aIDSize );
+ Point aIDPos = mpID->GetPosPixel();
+ mpDescription->SetPosPixel( Point( aIDPos.X() + nIDWidth, aIDPos.Y() ) );
+ mpDescription->SetSizePixel( aDescriptionSize );
+ }
- void ORoadmapHyperLabel::SetLabelAndSize( ItemIndex _RMIndex, ::rtl::OUString _rText, const Size& _rNewSize)
+ //---------------------------------------------------------------------
+ void RoadmapItem::Update( ItemIndex _RMIndex, const ::rtl::OUString& _rText )
{
- Size rIDSize = _rNewSize;
- ::rtl::OUString aStr = ::rtl::OUString::valueOf( (sal_Int32)( _RMIndex + 1 ) ) + ::rtl::OUString::createFromAscii( "." );
- rIDSize.Width() = (sal_Int32) mpIDLabel->GetTextWidth( aStr );
- long nMaxWidth = mpIDLabel->GetTextWidth( ::rtl::OUString::createFromAscii("100.") );
- rIDSize.Width() = ::std::min( rIDSize.getWidth(),nMaxWidth );
- mpIDLabel->SetSizePixel(mpIDLabel->LogicToPixel( rIDSize));
- mpIDLabel->SetText( aStr);
- mpIDLabel->Show();
- Size rDescSize = _rNewSize;
- rDescSize.Width() -= rIDSize.Width();
- sal_Int32 xDescPos = mpIDLabel->GetPosPixel().X() + mpIDLabel->GetSizePixel().Width();
- sal_Int32 yDescPos = mpIDLabel->GetPosPixel().Y();
- Point aPoint = Point(xDescPos, yDescPos);
- mpDescHyperLabel->SetPosPixel( aPoint );
- mpDescHyperLabel->SetLabelAndSize(_rText, rDescSize);
- mpIDLabel->SetSizePixel( Size( mpIDLabel->GetSizePixel().Width(), mpDescHyperLabel->GetSizePixel().Height() ) );
+ // update description label
+ mpDescription->SetLabel( _rText );
+
+ // update the index in both controls, which triggers updating the geometry of both
+ ImplUpdateIndex( _RMIndex );
}
- ORoadmapHyperLabel::~ORoadmapHyperLabel( )
+ //---------------------------------------------------------------------
+ RoadmapItem::~RoadmapItem( )
{
{
- ::std::auto_ptr<Control> aTemp(mpIDLabel);
- mpIDLabel = NULL;
+ ::std::auto_ptr<Control> aTemp(mpID);
+ mpID = NULL;
}
{
- ::std::auto_ptr<Control> aTemp(mpDescHyperLabel);
- mpDescHyperLabel = NULL;
+ ::std::auto_ptr<Control> aTemp(mpDescription);
+ mpDescription = NULL;
}
}
-
- void ORoadmapHyperLabel::SetClickHdl( const Link& rLink )
- {
- if ( mpDescHyperLabel )
- mpDescHyperLabel->SetClickHdl( rLink);
- }
-
- const Link& ORoadmapHyperLabel::GetClickHdl( ) const
+ //---------------------------------------------------------------------
+ void RoadmapItem::SetClickHdl( const Link& rLink )
{
- return mpDescHyperLabel->GetClickHdl();
+ if ( mpDescription )
+ mpDescription->SetClickHdl( rLink);
}
-
- ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, const ResId& _rId )
- :FixedText( _pParent, _rId )
+ //---------------------------------------------------------------------
+ const Link& RoadmapItem::GetClickHdl( ) const
{
+ return mpDescription->GetClickHdl();
}
- ORoadmapIDHyperLabel::ORoadmapIDHyperLabel( Window* _pParent, WinBits _nWinStyle )
+ //---------------------------------------------------------------------
+ IDLabel::IDLabel( Window* _pParent, WinBits _nWinStyle )
:FixedText( _pParent, _nWinStyle )
{
}
-
- ORoadmapIDHyperLabel::~ORoadmapIDHyperLabel( )
+ //---------------------------------------------------------------------
+ IDLabel::~IDLabel( )
{
}
-
- void ORoadmapIDHyperLabel::DataChanged( const DataChangedEvent& rDCEvt )
+ //---------------------------------------------------------------------
+ void IDLabel::DataChanged( const DataChangedEvent& rDCEvt )
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
FixedText::DataChanged( rDCEvt );
diff --git a/svtools/source/control/taskstat.cxx b/svtools/source/control/taskstat.cxx
index 86098af7de4a..82165a711285 100644
--- a/svtools/source/control/taskstat.cxx
+++ b/svtools/source/control/taskstat.cxx
@@ -43,7 +43,7 @@
#include <vcl/svapp.hxx>
#include <unotools/calendarwrapper.hxx>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
#include <taskbar.hxx>
// =======================================================================
diff --git a/svtools/source/control/urlcontrol.cxx b/svtools/source/control/urlcontrol.cxx
index 1252fc17a1d6..899867414e2f 100644
--- a/svtools/source/control/urlcontrol.cxx
+++ b/svtools/source/control/urlcontrol.cxx
@@ -31,12 +31,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
-#ifndef SVTOOL_URLCONTROL_HXX
#include <svtools/urlcontrol.hxx>
-#endif
-#ifndef SVTOOLS_FILENOTATION_HXX_
-#include "filenotation.hxx"
-#endif
+#include "svl/filenotation.hxx"
//.........................................................................
namespace svt
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 14ede88482a6..aa18a3683916 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -39,7 +39,7 @@
#include "addresstemplate.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
@@ -70,7 +70,7 @@
#include <com/sun/star/sdb/CommandType.hpp>
#include "localresaccess.hxx"
#ifndef SVTOOLS_FILENOTATION_HXX_
-#include "filenotation.hxx"
+#include "svl/filenotation.hxx"
#endif
#include <tools/urlobj.hxx>
@@ -324,8 +324,20 @@ public:
virtual void setDatasourceName(const ::rtl::OUString& _rName);
virtual void setCommand(const ::rtl::OUString& _rCommand);
+
+ virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
+ virtual void Commit();
};
+
+void AssignmentPersistentData::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
+{
+}
+
+void AssignmentPersistentData::Commit()
+{
+}
+
// -------------------------------------------------------------------
AssignmentPersistentData::AssignmentPersistentData()
:ConfigItem( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Office.DataAccess/AddressBook" )))
diff --git a/svtools/source/dialogs/addresstemplate.src b/svtools/source/dialogs/addresstemplate.src
index 9c4997cae9d2..63c0e6475597 100644
--- a/svtools/source/dialogs/addresstemplate.src
+++ b/svtools/source/dialogs/addresstemplate.src
@@ -29,7 +29,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#ifndef _SVT_ADDRESSTEMPLATE_HRC_
#include "addresstemplate.hrc"
diff --git a/svtools/source/dialogs/filedlg2.hrc b/svtools/source/dialogs/filedlg2.hrc
deleted file mode 100644
index a75e9047eafb..000000000000
--- a/svtools/source/dialogs/filedlg2.hrc
+++ /dev/null
@@ -1,44 +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: filedlg2.hrc,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#define STR_FILEDLG_SELECT 1000
-#define STR_FILEDLG_CANTCHDIR 1001
-#define STR_FILEDLG_OPEN 1002
-#define STR_FILEDLG_FILE 1003
-#define STR_FILEDLG_DIR 1004
-#define STR_FILEDLG_TYPE 1005
-#define STR_FILEDLG_CANTOPENFILE 1006
-#define STR_FILEDLG_CANTOPENDIR 1007
-#define STR_FILEDLG_OVERWRITE 1008
-#define STR_FILEDLG_GOUP 1009
-#define STR_FILEDLG_SAVE 1010
-#define STR_FILEDLG_DRIVES 1011
-#define STR_FILEDLG_HOME 1012
-#define STR_FILEDLG_NEWDIR 1013
-#define STR_FILEDLG_ASKNEWDIR 1014
diff --git a/svtools/source/dialogs/logindlg.cxx b/svtools/source/dialogs/logindlg.cxx
index 7ac65a77947d..791e373086af 100644
--- a/svtools/source/dialogs/logindlg.cxx
+++ b/svtools/source/dialogs/logindlg.cxx
@@ -38,7 +38,7 @@
#include "logindlg.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#include <svtools/svtdata.hxx>
diff --git a/svtools/source/dialogs/logindlg.src b/svtools/source/dialogs/logindlg.src
index 897597f383bf..b3ef357bbae4 100644
--- a/svtools/source/dialogs/logindlg.src
+++ b/svtools/source/dialogs/logindlg.src
@@ -29,7 +29,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#ifndef _SVTOOLS_LOGINDLG_HRC_
diff --git a/svtools/source/dialogs/printdlg.cxx b/svtools/source/dialogs/printdlg.cxx
index 68acffc62a74..a006f209af18 100644
--- a/svtools/source/dialogs/printdlg.cxx
+++ b/svtools/source/dialogs/printdlg.cxx
@@ -47,7 +47,7 @@
#include <svtools/printdlg.hxx>
#include <svtools/svtdata.hxx>
#include <filedlg.hxx>
-#include "pickerhelper.hxx"
+#include "svl/pickerhelper.hxx"
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
#endif
@@ -172,7 +172,7 @@ PrintDialog::~PrintDialog()
void PrintDialog::ImplSetImages()
{
- if( ! GetSettings().GetStyleSettings().GetDialogColor().IsDark() )
+ if( ! GetSettings().GetStyleSettings().GetHighContrastMode() )
{
maImgCollate.SetModeImage( Image( SvtResId( RID_IMG_PRNDLG_COLLATE ) ), BMP_COLOR_NORMAL );
maImgNotCollate.SetModeImage( Image( SvtResId( RID_IMG_PRNDLG_NOCOLLATE ) ), BMP_COLOR_NORMAL );
diff --git a/svtools/source/dialogs/printdlg.hrc b/svtools/source/dialogs/printdlg.hrc
index cae57cefdb0e..2f2f43e3ba10 100644
--- a/svtools/source/dialogs/printdlg.hrc
+++ b/svtools/source/dialogs/printdlg.hrc
@@ -28,7 +28,7 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#define FL_PRINTER 1
#define LB_NAMES 2
diff --git a/svtools/source/dialogs/prnsetup.hrc b/svtools/source/dialogs/prnsetup.hrc
index 33f98f7ed5e0..00623d97084c 100644
--- a/svtools/source/dialogs/prnsetup.hrc
+++ b/svtools/source/dialogs/prnsetup.hrc
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#define FL_PRINTER 1
#define LB_NAMES 2
diff --git a/svtools/source/dialogs/propctrl.hxx b/svtools/source/dialogs/propctrl.hxx
new file mode 100644
index 000000000000..59019fc21b90
--- /dev/null
+++ b/svtools/source/dialogs/propctrl.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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: propctrl.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/*
+#include <tools/stream.hxx>
+#include <vcl/sound.hxx>
+#include "sbx.hxx"
+#include "sbxbase.hxx"
+#include "sbxres.hxx"
+#include <svl/brdcst.hxx>
+ */
+
+
+#ifndef __PROPED_HXX__
+#include <proped.hxx>
+#endif
+#ifndef _UNO_HXX
+#include <usr/uno.hxx>
+#endif
+#ifndef _USR_SEQU_HXX
+#include <usr/sequ.hxx>
+#endif
+#ifndef __TOOLSIDL_HXX__
+#include <usr/toolsidl.hxx>
+#endif
+
+/*
+class XPropertyEditor
+ : public XInterface
+{
+public:
+
+ virtual void setObject(const UsrAny& aToInspectObj) = 0;
+
+ static Uik getSmartUik() { return(385); }
+};
+*/
+
+class PropertyEditorControler_Impl;
+class SvPropertyBox;
+class Window;
+
+class SimplePropertyEditor_Impl :
+ public XPropertyEditor,
+ public XPropertyEditorNavigation,
+ public UsrObject
+{
+ PropertyEditorControler_Impl* pActiveControler;
+ SvPropertyBox* mpPropBox;
+ UsrAny maStartUnoObj;
+ UsrAny maActiveUnoObj;
+
+ // History der Objekte speichern
+ AnySequence maHistorySeq;
+ WSStringSequence maHistoryNames;
+ UINT32 mnHistoryCount;
+ INT32 mnActualHistoryLevel;
+
+ // Einfache History via Dummy-Properties
+ BOOL bSimpleHistory;
+
+ // Methode zum Anlegen/Aktivieren der Controller
+ void showObject( const UsrAny& aToShowObj );
+ String getPath( void );
+
+public:
+ // Provisorischer Ctor mit Parent-Window
+ SimplePropertyEditor_Impl( Window *pParent );
+ ~SimplePropertyEditor_Impl();
+
+ // HACK fuer History-Test
+ void enableSimpleHistory( BOOL bHistory_ ) { bSimpleHistory = bHistory_; }
+
+ SMART_UNO_DECLARATION(ImplIntrospection,UsrObject);
+
+ // Methoden von XInterface
+ XInterface * queryInterface( Uik aUik );
+ XIdlClassRef getIdlClass();
+
+ // Methoden von XPropertyEditor
+ virtual void setObject(const UsrAny& aToInspectObj, const XubString& aObjName);
+
+ // Methoden von PropertyEditorNavigation
+ virtual void forward(void);
+ virtual void back(void);
+
+};
+
+
+
+
diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx
index b0fff49e5e8d..c7473e446986 100644
--- a/svtools/source/dialogs/roadmapwizard.cxx
+++ b/svtools/source/dialogs/roadmapwizard.cxx
@@ -32,7 +32,7 @@
#include "precompiled_svtools.hxx"
#include <svtools/roadmapwizard.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <svtools/svtdata.hxx>
#include "roadmap.hxx"
#include <tools/debug.hxx>
diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx
index c436256a31c4..602c2e3e6f8a 100644
--- a/svtools/source/dialogs/wizardmachine.cxx
+++ b/svtools/source/dialogs/wizardmachine.cxx
@@ -36,7 +36,7 @@
#include <vcl/msgbox.hxx>
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
//.........................................................................
diff --git a/svtools/source/dialogs/wizardmachine.src b/svtools/source/dialogs/wizardmachine.src
index d83fdd98824b..2fa50ef20bf6 100644
--- a/svtools/source/dialogs/wizardmachine.src
+++ b/svtools/source/dialogs/wizardmachine.src
@@ -29,7 +29,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
String STR_WIZDLG_FINISH
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
index 135761195e48..8c60a62063df 100644
--- a/svtools/source/edit/svmedit.cxx
+++ b/svtools/source/edit/svmedit.cxx
@@ -43,11 +43,11 @@
#include <svtools/svmedit.hxx>
#include <svtools/xtextedt.hxx>
-#include <svtools/brdcst.hxx>
-#include <svtools/undo.hxx>
+#include <svl/brdcst.hxx>
+#include <svl/undo.hxx>
#include <svtools/textwindowpeer.hxx>
-#include <svtools/lstner.hxx>
-#include <svtools/smplhint.hxx>
+#include <svl/lstner.hxx>
+#include <svl/smplhint.hxx>
// IDs erstmal aus VCL geklaut, muss mal richtig delivert werden...
@@ -1478,7 +1478,7 @@ long MultiLineEdit::PreNotify( NotifyEvent& rNEvt )
{
long nDone = 0;
-#if (OSL_DEBUG_LEVEL > 1) && !defined( PRODUCT )
+#if (OSL_DEBUG_LEVEL > 1) && defined(DBG_UTIL)
if( rNEvt.GetType() == EVENT_KEYINPUT )
{
const KeyEvent& rKEvent = *rNEvt.GetKeyEvent();
diff --git a/svtools/source/edit/syntaxhighlight.cxx b/svtools/source/edit/syntaxhighlight.cxx
index e2e71e86b662..7e2f98d0d37f 100644
--- a/svtools/source/edit/syntaxhighlight.cxx
+++ b/svtools/source/edit/syntaxhighlight.cxx
@@ -682,7 +682,7 @@ String SimpleTokenizer_Impl::getTokStr
return String( pStartPos, (USHORT)( pEndPos - pStartPos ) );
}
-#ifndef PRODUCT
+#ifdef DBG_UTIL
// TEST: Token ausgeben
String SimpleTokenizer_Impl::getFullTokenStr( /*out*/TokenTypes eType,
/*out*/const sal_Unicode* pStartPos, /*out*/const sal_Unicode* pEndPos )
diff --git a/svtools/source/edit/textdat2.hxx b/svtools/source/edit/textdat2.hxx
index 51336e75741e..7ee667db2305 100644
--- a/svtools/source/edit/textdat2.hxx
+++ b/svtools/source/edit/textdat2.hxx
@@ -32,7 +32,7 @@
#ifndef _TEXTDAT2_HXX
#define _TEXTDAT2_HXX
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
#include <tools/list.hxx>
#include <vcl/seleng.hxx>
#include <vcl/virdev.hxx>
diff --git a/svtools/source/edit/textdoc.hxx b/svtools/source/edit/textdoc.hxx
index 45b03e70ac47..b940bb6f4da7 100644
--- a/svtools/source/edit/textdoc.hxx
+++ b/svtools/source/edit/textdoc.hxx
@@ -31,7 +31,7 @@
#ifndef _TEXTDOC_HXX
#define _TEXTDOC_HXX
-#include <svtools/svarray.hxx>
+#include <svl/svarray.hxx>
#include <svtools/textdata.hxx>
#include <txtattr.hxx>
diff --git a/svtools/source/edit/texteng.cxx b/svtools/source/edit/texteng.cxx
index e7eff8385206..596ca89054e7 100644
--- a/svtools/source/edit/texteng.cxx
+++ b/svtools/source/edit/texteng.cxx
@@ -40,7 +40,7 @@
#include <textdat2.hxx>
#include <textundo.hxx>
#include <textund2.hxx>
-#include <svtools/ctloptions.hxx>
+#include <svl/ctloptions.hxx>
#include <vcl/window.hxx>
#include <vcl/edit.hxx>
diff --git a/svtools/source/edit/textundo.hxx b/svtools/source/edit/textundo.hxx
index fe2c53bca45e..7ce7169e1563 100644
--- a/svtools/source/edit/textundo.hxx
+++ b/svtools/source/edit/textundo.hxx
@@ -30,7 +30,7 @@
#ifndef _TEXTUNDO_HXX
#define _TEXTUNDO_HXX
-#include <svtools/undo.hxx>
+#include <svl/undo.hxx>
class TextEngine;
diff --git a/svtools/source/edit/textview.cxx b/svtools/source/edit/textview.cxx
index e0697a488287..99b6fc900885 100644
--- a/svtools/source/edit/textview.cxx
+++ b/svtools/source/edit/textview.cxx
@@ -36,7 +36,7 @@
#include <svtools/textdata.hxx>
#include <textdat2.hxx>
-#include <svtools/undo.hxx>
+#include <svl/undo.hxx>
#include <vcl/cursor.hxx>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
@@ -44,7 +44,7 @@
#include <tools/stream.hxx>
#include <sot/formats.hxx>
-#include <urlbmk.hxx>
+#include <svl/urlbmk.hxx>
#ifndef _COM_SUN_STAR_TEXT_XBREAKITERATOR_HPP_
#include <com/sun/star/i18n/XBreakIterator.hpp>
diff --git a/svtools/source/filepicker/makefile.mk b/svtools/source/filepicker/makefile.mk
deleted file mode 100644
index d00ac5170e1a..000000000000
--- a/svtools/source/filepicker/makefile.mk
+++ /dev/null
@@ -1,51 +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: makefile.mk,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.
-#
-#*************************************************************************
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=filepicker
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------------
-
-SLOFILES =\
- $(SLO)$/pickerhelper.obj \
- $(SLO)$/pickerhistory.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/filepicker/pickerhelper.cxx b/svtools/source/filepicker/pickerhelper.cxx
deleted file mode 100644
index 0d8b2db9d8a0..000000000000
--- a/svtools/source/filepicker/pickerhelper.cxx
+++ /dev/null
@@ -1,102 +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: pickerhelper.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include "pickerhelper.hxx"
-#include "rtl/ustring.hxx"
-#include "com/sun/star/ui/dialogs/XFilePicker.hpp"
-#include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
-#include "com/sun/star/beans/XPropertySet.hpp"
-#include "com/sun/star/beans/XPropertySetInfo.hpp"
-#include "com/sun/star/uno/Any.hxx"
-#include "tools/debug.hxx"
-
-namespace css = com::sun::star;
-
-using css::uno::Reference;
-using rtl::OUString;
-
-namespace svt
-{
- void SetDialogHelpId(
- Reference < css::ui::dialogs::XFilePicker > _mxFileDlg, sal_Int32 _nHelpId )
- {
- try
- {
- // does the dialog haver a help URL property?
- Reference< css::beans::XPropertySet > xDialogProps( _mxFileDlg, css::uno::UNO_QUERY );
- Reference< css::beans::XPropertySetInfo > xInfo;
- if( xDialogProps.is() )
- xInfo = xDialogProps->getPropertySetInfo( );
-
- const OUString sHelpURLPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) );
-
- if( xInfo.is() && xInfo->hasPropertyByName( sHelpURLPropertyName ) )
- { // yep
- OUString sId( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
- sId += OUString::valueOf( _nHelpId );
- xDialogProps->setPropertyValue( sHelpURLPropertyName, css::uno::makeAny( sId ) );
- }
- }
- catch( const css::uno::Exception& )
- {
- DBG_ERROR( "svt::SetDialogHelpId(): caught an exception while setting the help id!" );
- }
- }
-
- void SetDialogHelpId(
- Reference< css::ui::dialogs::XFolderPicker > _mxFileDlg, sal_Int32 _nHelpId )
- {
- try
- {
- // does the dialog haver a help URL property?
- Reference< css::beans::XPropertySet > xDialogProps( _mxFileDlg, css::uno::UNO_QUERY );
- Reference< css::beans::XPropertySetInfo > xInfo;
- if( xDialogProps.is() )
- xInfo = xDialogProps->getPropertySetInfo( );
-
- const OUString sHelpURLPropertyName( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" ) );
-
- if( xInfo.is() && xInfo->hasPropertyByName( sHelpURLPropertyName ) )
- { // yep
- OUString sId( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
- sId += OUString::valueOf( _nHelpId );
- xDialogProps->setPropertyValue( sHelpURLPropertyName, css::uno::makeAny( sId ) );
- }
- }
- catch( const css::uno::Exception& )
- {
- DBG_ERROR( "svt::SetDialogHelpId(): caught an exception while setting the help id!" );
- }
- }
-}
-
diff --git a/svtools/source/filepicker/pickerhistory.cxx b/svtools/source/filepicker/pickerhistory.cxx
deleted file mode 100644
index 5bd584618f09..000000000000
--- a/svtools/source/filepicker/pickerhistory.cxx
+++ /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: pickerhistory.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include "pickerhistory.hxx"
-#include "pickerhistoryaccess.hxx"
-#include <cppuhelper/weakref.hxx>
-#include <vector>
-
-//.........................................................................
-namespace svt
-{
-//.........................................................................
- using namespace ::com::sun::star::uno;
-
- namespace
- {
- typedef ::com::sun::star::uno::WeakReference< XInterface > InterfaceAdapter;
- typedef ::std::vector< InterfaceAdapter > InterfaceArray;
-
- // ----------------------------------------------------------------
- InterfaceArray& getFolderPickerHistory()
- {
- static InterfaceArray s_aHistory;
- return s_aHistory;
- }
-
- // ----------------------------------------------------------------
- InterfaceArray& getFilePickerHistory()
- {
- static InterfaceArray s_aHistory;
- return s_aHistory;
- }
-
- // ----------------------------------------------------------------
- void implPushBackPicker( InterfaceArray& _rHistory, const Reference< XInterface >& _rxPicker )
- {
- if ( !_rxPicker.is() )
- return;
-
- //=============================================================
- // first, check which of the objects we hold in s_aHistory can be removed
- {
- InterfaceArray aCleanedHistory;
- for ( InterfaceArray::const_iterator aLoop = _rHistory.begin();
- aLoop != _rHistory.end();
- ++aLoop
- )
- {
- Reference< XInterface > xCurrent( aLoop->get() );
- if ( xCurrent.is() )
- {
- if ( aCleanedHistory.empty() )
- // make some room, assume that all interfaces (from here on) are valie
- aCleanedHistory.reserve( _rHistory.size() - ( aLoop - _rHistory.begin() ) );
- aCleanedHistory.push_back( InterfaceAdapter( xCurrent ) );
- }
- }
- _rHistory.swap( aCleanedHistory );
- }
-
- //=============================================================
- // then push_back the picker
- _rHistory.push_back( InterfaceAdapter( _rxPicker ) );
- }
-
- //-----------------------------------------------------------------
- Reference< XInterface > implGetTopMostPicker( const InterfaceArray& _rHistory )
- {
- Reference< XInterface > xTopMostAlive;
-
- //=============================================================
- // search the first picker which is still alive ...
- for ( InterfaceArray::const_reverse_iterator aLoop = _rHistory.rbegin();
- ( aLoop != _rHistory.rend() ) && !xTopMostAlive.is();
- ++aLoop
- )
- {
- xTopMostAlive = aLoop->get();
- }
-
- return xTopMostAlive;
- }
- }
-
- //---------------------------------------------------------------------
- Reference< XInterface > GetTopMostFolderPicker( )
- {
- return implGetTopMostPicker( getFolderPickerHistory() );
- }
-
- //---------------------------------------------------------------------
- Reference< XInterface > GetTopMostFilePicker( )
- {
- return implGetTopMostPicker( getFilePickerHistory() );
- }
-
- //---------------------------------------------------------------------
- void addFolderPicker( const Reference< XInterface >& _rxPicker )
- {
- implPushBackPicker( getFolderPickerHistory(), _rxPicker );
- }
-
- //---------------------------------------------------------------------
- void addFilePicker( const Reference< XInterface >& _rxPicker )
- {
- implPushBackPicker( getFilePickerHistory(), _rxPicker );
- }
-
-//.........................................................................
-} // namespace svt
-//.........................................................................
-
diff --git a/svtools/source/filerec/filerec.cxx b/svtools/source/filerec/filerec.cxx
deleted file mode 100644
index 262e5135572a..000000000000
--- a/svtools/source/filerec/filerec.cxx
+++ /dev/null
@@ -1,1019 +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: filerec.cxx,v $
- * $Revision: 1.13 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <svtools/filerec.hxx>
-#include <osl/endian.h>
-
-//========================================================================
-
-SV_IMPL_VARARR( SfxUINT32s, UINT32 );
-
-//========================================================================
-
-/* Die folgenden Makros extrahieren Teilbereiche aus einem UINT32 Wert.
- Diese UINT32-Werte werden anstelle der einzelnen Werte gestreamt,
- um Calls zu sparen.
-*/
-
-#define SFX_REC_PRE(n) ( ((n) & 0x000000FF) )
-#define SFX_REC_OFS(n) ( ((n) & 0xFFFFFF00) >> 8 )
-#define SFX_REC_TYP(n) ( ((n) & 0x000000FF) )
-#define SFX_REC_VER(n) ( ((n) & 0x0000FF00) >> 8 )
-#define SFX_REC_TAG(n) ( ((n) & 0xFFFF0000) >> 16 )
-
-#define SFX_REC_CONTENT_VER(n) ( ((n) & 0x000000FF) )
-#define SFX_REC_CONTENT_OFS(n) ( ((n) & 0xFFFFFF00) >> 8 )
-
-//-------------------------------------------------------------------------
-
-/* Die folgenden Makros setzen Teilbereiche zu einem UINT32 Wert zusammen.
- Diese UINT32-Werte werden anstelle der einzelnen Werte gestreamt,
- um Calls zu sparen.
-*/
-
-#define SFX_REC_MINI_HEADER(nPreTag,nStartPos,nEndPos) \
- ( UINT32(nPreTag) | \
- UINT32(nEndPos-nStartPos-SFX_REC_HEADERSIZE_MINI) << 8 )
-
-#define SFX_REC_HEADER(nRecType,nContentTag,nContentVer) \
- ( UINT32(nRecType) | \
- ( UINT32(nContentVer) << 8 ) | \
- ( UINT32(nContentTag) << 16 ) )
-
-#define SFX_REC_CONTENT_HEADER(nContentVer,n1StStartPos,nCurStartPos) \
- ( UINT32(nContentVer) | \
- UINT32( nCurStartPos - n1StStartPos ) << 8 )
-
-//=========================================================================
-
-UINT32 SfxMiniRecordWriter::Close
-(
- FASTBOOL bSeekToEndOfRec /* TRUE (default)
- Der Stream wird an das Ende des Records
- positioniert.
-
- FALSE
- Der Stream wird an den Anfang des
- Contents (also hinter den Header)
- positioniert.
- */
-)
-
-/* [Beschreibung]
-
- Diese Methode schlie\st den Record. Dabei wird haupts"achlich der
- Header geschrieben.
-
- Wurde der Header bereits geschrieben, hat der Aufruf keine Wirkung.
-
-
- [R"uckgabewert]
-
- UINT32 != 0
- Position im Stream, die direkt hinter dem Record liegt.
- 'bSeekToEndOfRecord==TRUE'
- => R"uckgabewert == aktuelle Stream-Position nach Aufruf
-
- == 0
- Der Header war bereits geschrieben worden.
-*/
-
-{
- // wurde der Header noch nicht geschrieben?
- if ( !_bHeaderOk )
- {
- // Header an den Anfang des Records schreiben
- UINT32 nEndPos = _pStream->Tell();
- _pStream->Seek( _nStartPos );
- *_pStream << SFX_REC_MINI_HEADER( _nPreTag, _nStartPos, nEndPos );
-
- // je nachdem ans Ende des Records seeken oder hinter Header bleiben
- if ( bSeekToEndOfRec )
- _pStream->Seek( nEndPos );
-
- // Header wurde JETZT geschrieben
- _bHeaderOk = TRUE;
- return nEndPos;
- }
-#ifdef DBG_UTIL
- // mu\s Fix-Size-Record gepr"uft werden?
- else if ( SFX_BOOL_DONTCARE == _bHeaderOk )
- {
- // Header auslesen, um Soll-Gr"o\se zu bestimmen
- UINT32 nEndPos = _pStream->Tell();
- _pStream->Seek( _nStartPos );
- UINT32 nHeader;
- *_pStream >> nHeader;
- _pStream->Seek( nEndPos );
-
- // Soll-Gr"o\se mit Ist-Gr"o\se vergleichen
- DBG_ASSERT( nEndPos - SFX_REC_OFS(nHeader) == _nStartPos + sizeof(UINT32),
- "fixed record size incorrect" );
- DbgOutf( "SfxFileRec: written record until %ul", nEndPos );
- }
-#endif
-
- // Record war bereits geschlossen
- return 0;
-}
-
-//=========================================================================
-
-USHORT SfxMiniRecordReader::ScanRecordType
-(
- SvStream* pStream /* <SvStream> an dessen aktueller Position
- ein Record liegt, dessen Typ erkannt werden
- soll.
- */
-)
-
-/* [Beschreibung]
-
- Mit dieser statischen Methode kann ermittelt werden, ob sich an der
- aktuellen Position in einem Stream ein Record befindet, und der Typ
- des Records kann ermittelt werden.
-
- Die Position im Stream ist nach dem Aufruf aufver"andert.
-
-
- [Anmerkung]
-
- Die Record-Typen k"onnen zwar (abgesehen vom Drawing-Enginge-Record)
- untereinander eindeutig erkannt werden, es besteht jedoch die Gefahr
- der Verwechslung von Records mit normalen Daten. File-Formate sollten
- darauf R"ucksicht nehmen. Handelt es sich um keinen Record, wird
- am wahrscheinlichsten SFX_REC_TYPE_MINI zur"uckgeliefert, da dieser
- Typ sich aufgrund seines sparsam kurzen Headers durch die k"urzeste
- Kennung auszeichnet.
-
-
- [R"uckgabewert]
-
- USHORT SFX_REC_TYPE_EOR
- An der aktuellen Position des Streams
- steht eine End-Of-Records-Kennung.
-
- SFX_REC_TYPE_MINI
- Es handelt sich um einen SW3 kompatiblen
- Mini-Record, dessen einzige Kennung sein
- 'Mini-Tag' ist.
-
- SFX_REC_TYPE_SINGLE
- Es handelt sich um einen Extended-Record
- mit einem einzigen Content, der durch eine
- Version und ein Tag n"aher gekennzeichnet
- ist.
-
- SFX_REC_TYPE_FIXSIZE
- Es handelt sich um einen Extended-Record
- mit mehreren Contents gleicher Gr"o\se,
- die gemeinsam durch eine einzige Version
- und ein einziges gemeinsames Tag n"aher
- gekennzeichnet sind.
-
- SFX_REC_TYPE_VARSIZE
- Es handelt sich um einen Extended-Record
- mit mehreren Contents variabler Gr"o\se,
- die gemeinsam durch eine einzige Version
- und ein einziges gemeinsames Tag n"aher
- gekennzeichnet sind.
-
- SFX_REC_TYPE_MIXTAGS
- Es handelt sich um einen Extended-Record
- mit mehreren Contents variabler Gr"o\se,
- die jeweils durch ein eignes Tag und
- eine eigene Versions-Nummer n"aher
- gekennzeichnet sind.
-
- SFX_REC_TYPE_DRAWENG
- Es handelt sich wahrscheinlich um einen
- Drawing-Engine-Record. Dieser Record-Typ
- kann von den Klassen dieser Gruppe nicht
- interpretiert werden.
-*/
-
-{
- // die ersten 4 Bytes als Mini-Header lesen
- sal_uInt32 nHeader;
- *pStream >> nHeader;
-
- // k"onnte es sich um einen extended-Record handeln?
- USHORT nPreTag = sal::static_int_cast< USHORT >(SFX_REC_PRE(nHeader));
- if ( SFX_REC_PRETAG_EXT == nPreTag )
- {
- // die n"achsten 4 Bytes als extended-Header lesen
- *pStream >> nHeader;
-
- // Stream-Position restaurieren
- pStream->SeekRel(-8);
-
- // liegt eine g"ultige Record-Kennung vor?
- USHORT nType = sal::static_int_cast< USHORT >(SFX_REC_TYP(nHeader));
- if ( nType >= SFX_REC_TYPE_FIRST && nType <= SFX_REC_TYPE_LAST )
- // entsprechenden extended-Record-Typ zur"uckliefern
- return nType;
-
- // sonst ist der Record-Typ unbekannt
- return SFX_REC_TYPE_NONE;
- }
-
- // Stream-Position restaurieren
- pStream->SeekRel(-4);
-
- // liegt eine End-Of-Record-Kennung vor?
- if ( SFX_REC_PRETAG_EOR == nPreTag )
- return nPreTag;
-
- // liegt ein Drawin-Engine-Record vor?
- if ( nHeader == UINT32(*"DRMD") || nHeader == UINT32(*"DRVW") )
- return SFX_REC_TYPE_DRAWENG;
-
- // alle anderen sind grunds"atzlich g"ultige Mini-Records
- return SFX_REC_TYPE_MINI;
-}
-
-//-------------------------------------------------------------------------
-
-FASTBOOL SfxMiniRecordReader::SetHeader_Impl( UINT32 nHeader )
-
-/* [Beschreibung]
-
- Interne Methode zum nachtr"aglichen Verarbeiten eines extern gelesenen
- Headers. Falls der Header eine End-Of-Records-Kennung darstellt,
- wird am Stream ein Errorcode gesetzt und FALSE zur"uckgeliefert. Im
- Fehlerfall wird der Stream jedoch nicht auf den Record-Anfang zur"uck-
- gesetzt.
-*/
-
-{
- FASTBOOL bRet = TRUE;
-
- // Record-Ende und Pre-Tag aus dem Header ermitteln
- _nEofRec = _pStream->Tell() + SFX_REC_OFS(nHeader);
- _nPreTag = sal::static_int_cast< BYTE >(SFX_REC_PRE(nHeader));
-
- // wenn End-Of-Record-Kennung, dann Fehler
- if ( _nPreTag == SFX_REC_PRETAG_EOR )
- {
- _pStream->SetError( ERRCODE_IO_WRONGFORMAT );
- bRet = FALSE;
- }
- return bRet;
-}
-
-//-------------------------------------------------------------------------
-
-SfxMiniRecordReader::SfxMiniRecordReader
-(
- SvStream* pStream /* <SvStream>, an dessen aktueller
- Position sich ein <SfxMiniRecord>
- befindet.
- */
-)
-
-/* [Beschreibung]
-
- Dieser Ctor liest den Header eines <SfxMiniRecord> ab der aktuellen
- Position von 'pStream'. Da grunds"atzlich fast 4-Byte Kombination ein
- g"ultiger SfxMiniRecord-Header ist, bleiben die einzig m"oglichen
- Fehler der EOF-Status des Streams, und ein SFX_REC_PRETAG_EOR
- als Pre-Tag. Ein entsprechender Error-Code (ERRCODE_IO_EOF bzw.
- ERRCODE_IO_WRONGFORMAT) ist dann am Stream gesetzt, dessen Position
- dann au\serdem unver"andert ist.
-*/
-
-: _pStream( pStream ),
- _bSkipped( FALSE )
-{
- // Header einlesen
- UINT32 nStartPos = pStream->Tell(); // um im Fehlerfall zur"uck zu-seeken
- DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) );
- UINT32 nHeader;
- *pStream >> nHeader;
-
- // Headerdaten extrahieren
- SetHeader_Impl( nHeader );
-
- // Fehlerbehandlung
- if ( pStream->IsEof() )
- _nPreTag = SFX_REC_PRETAG_EOR;
- else if ( _nPreTag == SFX_REC_PRETAG_EOR )
- pStream->SetError( ERRCODE_IO_WRONGFORMAT );
- if ( !IsValid() )
- pStream->Seek( nStartPos );
-}
-
-//-------------------------------------------------------------------------
-
-SfxMiniRecordReader::SfxMiniRecordReader
-(
- SvStream* pStream, /* <SvStream>, an dessen aktueller
- Position sich ein <SfxMiniRecord>
- befindet.
- */
- BYTE nTag // Pre-Tag des gew"unschten Records
-)
-
-/* [Beschreibung]
-
- Dieser Ctor interpretiert 'pStream' ab der aktuellen Position als
- eine l"uckenlose Folge von, von dieser Klassen-Gruppe interpretierbaren,
- Records. Der in dieser Folge erste als <SfxMiniRecord> interpretierbare
- (also ggf. auch ein extended-Record) mit dem PreTag 'nTag' wird ge"offnet
- und durch diese Instanz repr"asentiert.
-
- Wird das Ende des Streams oder die Kennung SFX_REC_PRETAG_EOR
- erreicht, bevor ein Record mit dem ge"unschten Pre-Tag gefunden wird,
- ist die erzeugte Instanz ung"ultig ('IsValid() == FALSE'). Ein ent-
- sprechender Error-Code (ERRCODE_IO_EOF bzw. ERRCODE_IO_WRONGFORMAT)
- ist dann am Stream gesetzt, dessen Position ist dann au\serdem unver-
- "andert.
-
- Bei 'nTag==SFX_FILEREC_PRETAG_EOR' wird nicht versucht, einen Record
- zu lesen, es wird sofort 'IsValid()' auf FALSE gesetzt und kein Error-Code
- am Stream gesetzt. Dies ist dauzu gedacht, ohne 'new' und 'delete'
- abw"rtskompatibel SfxMiniRecords einbauen zu k"onnen. Siehe dazu
- <SfxItemSet::Load()>.
-
-
- [Anwendungsvorschlag]
-
- Wird dieser Ctor in einer bereits ausgelieferten Programmversion
- verwendet, k"onnen in das File-Format jeweils davor kompatibel neue
- Records mit einer anderen Kennung eingef"ugt werden. Diese werden
- schlie\slich automatisch "uberlesen. Erkauft wird diese M"oglichkeit
- allerdings mit etwas schlechterem Laufzeitverhalten im Vergleich mit
- direktem 'drauf-los-lesen', der sich jedoch auf einen Vergleich zweier
- Bytes reduziert, falls der gesuchte Record der erste in der Folge ist.
-*/
-
-: _pStream( pStream ),
- _bSkipped( nTag == SFX_REC_PRETAG_EOR )
-{
- // ggf. ignorieren (s.o.)
- if ( _bSkipped )
- {
- _nPreTag = nTag;
- return;
- }
-
- // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen
- UINT32 nStartPos = pStream->Tell();
-
- // passenden Record suchen
- while(TRUE)
- {
- // Header lesen
- DBG( DbgOutf( "SfxFileRec: searching record at %ul", pStream->Tell() ) );
- UINT32 nHeader;
- *pStream >> nHeader;
-
- // Headerdaten von Basisklasse extrahieren lassen
- SetHeader_Impl( nHeader );
-
- // ggf. Fehler behandeln
- if ( pStream->IsEof() )
- _nPreTag = SFX_REC_PRETAG_EOR;
- else if ( _nPreTag == SFX_REC_PRETAG_EOR )
- pStream->SetError( ERRCODE_IO_WRONGFORMAT );
- else
- {
- // wenn gefunden, dann Schleife abbrechen
- if ( _nPreTag == nTag )
- break;
-
- // sonst skippen und weitersuchen
- pStream->Seek( _nEofRec );
- continue;
- }
-
- // Fehler => zur"uck-seeken
- pStream->Seek( nStartPos );
- break;
- }
-}
-
-//=========================================================================
-
-SfxSingleRecordWriter::SfxSingleRecordWriter
-(
- BYTE nRecordType, // f"ur Subklassen
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nContentTag, // Inhalts-Art-Kennung
- BYTE nContentVer // Inhalts-Versions-Kennung
-)
-
-/* [Beschreibung]
-
- Interner Ctor f"ur Subklassen.
-*/
-
-: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT )
-{
- // Erweiterten Header hiner den des SfxMiniRec schreiben
- *pStream << SFX_REC_HEADER(nRecordType, nContentTag, nContentVer);
-}
-
-//-------------------------------------------------------------------------
-
-SfxSingleRecordWriter::SfxSingleRecordWriter
-(
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nContentTag, // Inhalts-Art-Kennung
- BYTE nContentVer // Inhalts-Versions-Kennung
-)
-
-/* [Beschreibung]
-
- Legt in 'pStream' einen 'SfxSingleRecord' an, dessen Content-Gr"o\se
- nicht bekannt ist, sondern nach dam Streamen des Contents errechnet
- werden soll.
-*/
-
-: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT )
-{
- // Erweiterten Header hiner den des SfxMiniRec schreiben
- *pStream << SFX_REC_HEADER( SFX_REC_TYPE_SINGLE, nContentTag, nContentVer);
-}
-
-//-------------------------------------------------------------------------
-
-SfxSingleRecordWriter::SfxSingleRecordWriter
-(
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nContentTag, // Inhalts-Art-Kennung
- BYTE nContentVer, // Inhalts-Versions-Kennung
- UINT32 nContentSize // Gr"o\se des Inhalts in Bytes
-)
-
-/* [Beschreibung]
-
- Legt in 'pStream' einen 'SfxSingleRecord' an, dessen Content-Gr"o\se
- von vornherein bekannt ist.
-*/
-
-: SfxMiniRecordWriter( pStream, SFX_REC_PRETAG_EXT,
- nContentSize + SFX_REC_HEADERSIZE_SINGLE )
-{
- // Erweiterten Header hinter den des SfxMiniRec schreiben
- *pStream << SFX_REC_HEADER( SFX_REC_TYPE_SINGLE, nContentTag, nContentVer);
-}
-
-//=========================================================================
-
-inline FASTBOOL SfxSingleRecordReader::ReadHeader_Impl( USHORT nTypes )
-
-/* [Beschreibung]
-
- Interne Methode zum Einlesen eines SfxMultiRecord-Headers, nachdem
- die Basisklasse bereits initialisiert und deren Header gelesen ist.
- Ggf. ist ein Error-Code am Stream gesetzt, im Fehlerfall wird jedoch
- nicht zur"uckge-seekt.
-*/
-
-{
- FASTBOOL bRet;
-
- // Basisklassen-Header einlesen
- UINT32 nHeader=0;
- *_pStream >> nHeader;
- if ( !SetHeader_Impl( nHeader ) )
- bRet = FALSE;
- else
- {
- // eigenen Header einlesen
- *_pStream >> nHeader;
- _nRecordVer = sal::static_int_cast< BYTE >(SFX_REC_VER(nHeader));
- _nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader));
-
- // falscher Record-Typ?
- _nRecordType = sal::static_int_cast< BYTE >(SFX_REC_TYP(nHeader));
- bRet = 0 != ( nTypes & _nRecordType);
- }
- return bRet;
-}
-
-//-------------------------------------------------------------------------
-
-SfxSingleRecordReader::SfxSingleRecordReader( SvStream *pStream )
-: SfxMiniRecordReader()
-{
- // Startposition merken, um im Fehlerfall zur"uck-seeken zu k"onnen
- #ifdef DBG_UTIL
- UINT32 nStartPos = pStream->Tell();
- DBG( DbgOutf( "SfxFileRec: reading record at %ul", nStartPos ) );
- #endif
-
- // Basisklasse initialisieren (nicht via Ctor, da der nur MiniRecs akzept.)
- Construct_Impl( pStream );
-
- // nur Header mit korrektem Record-Type akzeptieren
- if ( !ReadHeader_Impl( SFX_REC_TYPE_SINGLE ) )
- {
- // Error-Code setzen und zur"uck-seeken
- pStream->SeekRel( - SFX_REC_HEADERSIZE_SINGLE );
- pStream->SetError( ERRCODE_IO_WRONGFORMAT );
- }
-}
-
-//-------------------------------------------------------------------------
-
-SfxSingleRecordReader::SfxSingleRecordReader( SvStream *pStream, USHORT nTag )
-{
- // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen
- UINT32 nStartPos = pStream->Tell();
-
- // richtigen Record suchen, ggf. Error-Code setzen und zur"uck-seeken
- Construct_Impl( pStream );
- if ( !FindHeader_Impl( SFX_REC_TYPE_SINGLE, nTag ) )
- {
- // Error-Code setzen und zur"uck-seeken
- pStream->Seek( nStartPos );
- pStream->SetError( ERRCODE_IO_WRONGFORMAT );
- }
-}
-
-//-------------------------------------------------------------------------
-
-FASTBOOL SfxSingleRecordReader::FindHeader_Impl
-(
- UINT16 nTypes, // arithm. Veroderung erlaubter Record-Typen
- UINT16 nTag // zu findende Record-Art-Kennung
-)
-
-/* [Beschreibung]
-
- Interne Methode zum lesen des Headers des ersten Record, der einem
- der Typen in 'nTypes' entspricht und mit der Art-Kennung 'nTag'
- gekennzeichnet ist.
-
- Kann ein solcher Record nicht gefunden werden, wird am Stream ein
- Errorcode gesetzt, zur"uck-geseekt und FALSE zur"uckgeliefert.
-*/
-
-{
- // StartPos merken, um im Fehlerfall zur"uck-seeken zu k"onnen
- UINT32 nStartPos = _pStream->Tell();
-
- // richtigen Record suchen
- while ( !_pStream->IsEof() )
- {
- // Header lesen
- UINT32 nHeader;
- DBG( DbgOutf( "SfxFileRec: searching record at %ul", _pStream->Tell() ) );
- *_pStream >> nHeader;
- if ( !SetHeader_Impl( nHeader ) )
- // EOR => Such-Schleife abbreichen
- break;
-
- // Extended Record gefunden?
- if ( _nPreTag == SFX_REC_PRETAG_EXT )
- {
- // Extended Header lesen
- *_pStream >> nHeader;
- _nRecordTag = sal::static_int_cast< UINT16 >(SFX_REC_TAG(nHeader));
-
- // richtigen Record gefunden?
- if ( _nRecordTag == nTag )
- {
- // gefundener Record-Typ passend?
- _nRecordType = sal::static_int_cast< BYTE >(
- SFX_REC_TYP(nHeader));
- if ( nTypes & _nRecordType )
- // ==> gefunden
- return TRUE;
-
- // error => Such-Schleife abbrechen
- break;
- }
- }
-
- // sonst skippen
- if ( !_pStream->IsEof() )
- _pStream->Seek( _nEofRec );
- }
-
- // Fehler setzen und zur"uck-seeken
- _pStream->SetError( ERRCODE_IO_WRONGFORMAT );
- _pStream->Seek( nStartPos );
- return FALSE;
-}
-
-//=========================================================================
-
-SfxMultiFixRecordWriter::SfxMultiFixRecordWriter
-(
- BYTE nRecordType, // Subklassen Record-Kennung
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nContentTag, // Content-Art-Kennung
- BYTE nContentVer, // Content-Versions-Kennung
- UINT32 // Gr"o\se jedes einzelnen Contents in Bytes
-)
-
-/* [Beschreibung]
-
- Interne Methode f"ur Subklassen.
-*/
-
-: SfxSingleRecordWriter( nRecordType, pStream, nContentTag, nContentVer ),
- _nContentCount( 0 )
-{
- // Platz f"ur eigenen Header
- pStream->SeekRel( + SFX_REC_HEADERSIZE_MULTI );
-}
-
-//------------------------------------------------------------------------
-
-SfxMultiFixRecordWriter::SfxMultiFixRecordWriter
-(
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nContentTag, // Content-Art-Kennung
- BYTE nContentVer, // Content-Versions-Kennung
- UINT32 // Gr"o\se jedes einzelnen Contents in Bytes
-)
-
-/* [Beschreibung]
-
- Legt in 'pStream' einen 'SfxMultiFixRecord' an, dessen Content-Gr"o\se
- konstant und von vornherein bekannt ist.
-*/
-
-: SfxSingleRecordWriter( SFX_REC_TYPE_FIXSIZE,
- pStream, nContentTag, nContentVer ),
- _nContentCount( 0 )
-{
- // Platz f"ur eigenen Header
- pStream->SeekRel( + SFX_REC_HEADERSIZE_MULTI );
-}
-
-//------------------------------------------------------------------------
-
-UINT32 SfxMultiFixRecordWriter::Close( FASTBOOL bSeekToEndOfRec )
-
-// siehe <SfxMiniRecordWriter>
-
-{
- // Header noch nicht geschrieben?
- if ( !_bHeaderOk )
- {
- // Position hinter Record merken, um sie restaurieren zu k"onnen
- UINT32 nEndPos = SfxSingleRecordWriter::Close( FALSE );
-
- // gegen"uber SfxSingleRecord erweiterten Header schreiben
- *_pStream << _nContentCount;
- *_pStream << _nContentSize;
-
- // je nachdem ans Ende des Records seeken oder hinter Header bleiben
- if ( bSeekToEndOfRec )
- _pStream->Seek(nEndPos);
- return nEndPos;
- }
-
- // Record war bereits geschlossen
- return 0;
-}
-
-//=========================================================================
-
-SfxMultiVarRecordWriter::SfxMultiVarRecordWriter
-(
- BYTE nRecordType, // Record-Kennung der Subklasse
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nRecordTag, // Gesamt-Art-Kennung
- BYTE nRecordVer // Gesamt-Versions-Kennung
-)
-
-/* [Beschreibung]
-
- Interner Ctor f"ur Subklassen.
-*/
-
-: SfxMultiFixRecordWriter( nRecordType, pStream, nRecordTag, nRecordVer, 0 ),
- _nContentVer( 0 )
-{
-}
-
-//-------------------------------------------------------------------------
-
-SfxMultiVarRecordWriter::SfxMultiVarRecordWriter
-(
- SvStream* pStream, // Stream, in dem der Record angelegt wird
- UINT16 nRecordTag, // Gesamt-Art-Kennung
- BYTE nRecordVer // Gesamt-Versions-Kennung
-)
-
-/* [Beschreibung]
-
- Legt in 'pStream' einen 'SfxMultiVarRecord' an, dessen Content-Gr"o\sen
- weder bekannt sind noch identisch sein m"ussen, sondern jeweils nach dem
- Streamen jedes einzelnen Contents errechnet werden sollen.
-
-
- [Anmerkung]
-
- Diese Methode ist nicht inline, da f"ur die Initialisierung eines
- <SvULongs>-Members zu viel Code generiert werden w"urde.
-*/
-
-: SfxMultiFixRecordWriter( SFX_REC_TYPE_VARSIZE,
- pStream, nRecordTag, nRecordVer, 0 ),
- _nContentVer( 0 )
-{
-}
-
-//-------------------------------------------------------------------------
-
-SfxMultiVarRecordWriter::~SfxMultiVarRecordWriter()
-
-/* [Beschreibung]
-
- Der Dtor der Klasse <SfxMultiVarRecordWriter> schlie\st den Record
- automatisch, falls <SfxMultiVarRecordWriter::Close()> nicht bereits
- explizit gerufen wurde.
-*/
-
-{
- // wurde der Header noch nicht geschrieben oder mu\s er gepr"uft werden
- if ( !_bHeaderOk )
- Close();
-}
-
-//-------------------------------------------------------------------------
-
-void SfxMultiVarRecordWriter::FlushContent_Impl()
-
-/* [Beschreibung]
-
- Interne Methode zum Abschlie\sen eines einzelnen Contents.
-*/
-
-{
- // Versions-Kennung und Positions-Offset des aktuellen Contents merken;
- // das Positions-Offset ist relativ zur Startposition des ersten Contents
- _aContentOfs.Insert(
- SFX_REC_CONTENT_HEADER(_nContentVer,_nStartPos,_nContentStartPos),
- _nContentCount-1 );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxMultiVarRecordWriter::NewContent()
-
-// siehe <SfxMultiFixRecordWriter>
-
-{
- // schon ein Content geschrieben?
- if ( _nContentCount )
- FlushContent_Impl();
-
- // neuen Content beginnen
- _nContentStartPos = _pStream->Tell();
- ++_nContentCount;
-}
-
-//-------------------------------------------------------------------------
-
-UINT32 SfxMultiVarRecordWriter::Close( FASTBOOL bSeekToEndOfRec )
-
-// siehe <SfxMiniRecordWriter>
-
-{
- // Header noch nicht geschrieben?
- if ( !_bHeaderOk )
- {
- // ggf. letzten Content abschlie\sen
- if ( _nContentCount )
- FlushContent_Impl();
-
- // Content-Offset-Tabelle schreiben
- UINT32 nContentOfsPos = _pStream->Tell();
- //! darf man das so einr"ucken?
- #if defined(OSL_LITENDIAN)
- _pStream->Write( _aContentOfs.GetData(),
- sizeof(UINT32)*_nContentCount );
- #else
- for ( USHORT n = 0; n < _nContentCount; ++n )
- *_pStream << UINT32(_aContentOfs[n]);
- #endif
-
- // SfxMultiFixRecordWriter::Close() "uberspringen!
- UINT32 nEndPos = SfxSingleRecordWriter::Close( FALSE );
-
- // eigenen Header schreiben
- *_pStream << _nContentCount;
- if ( SFX_REC_TYPE_VARSIZE_RELOC == _nPreTag ||
- SFX_REC_TYPE_MIXTAGS_RELOC == _nPreTag )
- *_pStream << static_cast<UINT32>(nContentOfsPos - ( _pStream->Tell() + sizeof(UINT32) ));
- else
- *_pStream << nContentOfsPos;
-
- // ans Ende des Records seeken bzw. am Ende des Headers bleiben
- if ( bSeekToEndOfRec )
- _pStream->Seek(nEndPos);
- return nEndPos;
- }
-
- // Record war bereits vorher geschlossen
- return 0;
-}
-
-//=========================================================================
-
-void SfxMultiMixRecordWriter::NewContent
-(
- UINT16 nContentTag, // Kennung f"ur die Art des Contents
- BYTE nContentVer // Kennung f"ur die Version des Contents
-)
-
-/* [Beschreibung]
-
- Mit dieser Methode wird in den Record ein neuer Content eingef"ugt
- und dessen Content-Tag sowie dessen Content-Version angegeben. Jeder,
- auch der 1. Record mu\s durch Aufruf dieser Methode eingeleitet werden.
-*/
-
-{
- // ggf. vorherigen Record abschlie\sen
- if ( _nContentCount )
- FlushContent_Impl();
-
- // Tag vor den Content schreiben, Version und Startposition merken
- _nContentStartPos = _pStream->Tell();
- ++_nContentCount;
- *_pStream << nContentTag;
- _nContentVer = nContentVer;
-}
-
-//=========================================================================
-
-FASTBOOL SfxMultiRecordReader::ReadHeader_Impl()
-
-/* [Beschreibung]
-
- Interne Methode zum Einlesen eines SfxMultiRecord-Headers, nachdem
- die Basisklasse bereits initialisiert und deren Header gelesen ist.
- Ggf. ist ein Error-Code am Stream gesetzt, im Fehlerfall wird jedoch
- nicht zur"uckge-seekt.
-*/
-
-{
- // eigenen Header lesen
- *_pStream >> _nContentCount;
- *_pStream >> _nContentSize; // Fix: jedes einzelnen, Var|Mix: Tabellen-Pos.
-
- // mu\s noch eine Tabelle mit Content-Offsets geladen werden?
- if ( _nRecordType != SFX_REC_TYPE_FIXSIZE )
- {
- // Tabelle aus dem Stream einlesen
- UINT32 nContentPos = _pStream->Tell();
- if ( _nRecordType == SFX_REC_TYPE_VARSIZE_RELOC ||
- _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC )
- _pStream->SeekRel( + _nContentSize );
- else
- _pStream->Seek( _nContentSize );
- _pContentOfs = new UINT32[_nContentCount];
- //! darf man jetzt so einr"ucken
- #if defined(OSL_LITENDIAN)
- _pStream->Read( _pContentOfs, sizeof(UINT32)*_nContentCount );
- #else
- for ( USHORT n = 0; n < _nContentCount; ++n )
- *_pStream >> _pContentOfs[n];
- #endif
- _pStream->Seek( nContentPos );
- }
-
- // Header konnte gelesen werden, wenn am Stream kein Error gesetzt ist
- return !_pStream->GetError();
-}
-
-//-------------------------------------------------------------------------
-
-SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream )
-: _pContentOfs( NULL ), _nContentNo(0)
-{
- // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen
- _nStartPos = pStream->Tell();
-
- // Basisklasse konstruieren (normaler Ctor w"urde nur SingleRecs lesen)
- SfxSingleRecordReader::Construct_Impl( pStream );
-
- // Header der Basisklasse lesen
- if ( !SfxSingleRecordReader::ReadHeader_Impl( SFX_REC_TYPE_FIXSIZE |
- SFX_REC_TYPE_VARSIZE | SFX_REC_TYPE_VARSIZE_RELOC |
- SFX_REC_TYPE_MIXTAGS | SFX_REC_TYPE_MIXTAGS_RELOC ) ||
- !ReadHeader_Impl() )
- // als ung"ultig markieren und zur"uck-seeken
- SetInvalid_Impl( _nStartPos );
-}
-
-//-------------------------------------------------------------------------
-
-SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream, UINT16 nTag )
-: _nContentNo(0)
-{
- // Position im Stream merken, um im Fehlerfall zur"uck-seeken zu k"onnen
- _nStartPos = pStream->Tell();
-
- // passenden Record suchen und Basisklasse initialisieren
- SfxSingleRecordReader::Construct_Impl( pStream );
- if ( SfxSingleRecordReader::FindHeader_Impl( SFX_REC_TYPE_FIXSIZE |
- SFX_REC_TYPE_VARSIZE | SFX_REC_TYPE_VARSIZE_RELOC |
- SFX_REC_TYPE_MIXTAGS | SFX_REC_TYPE_MIXTAGS_RELOC,
- nTag ) )
- {
- // eigenen Header dazu-lesen
- if ( !ReadHeader_Impl() )
- // nicht lesbar => als ung"ultig markieren und zur"uck-seeken
- SetInvalid_Impl( _nStartPos);
- }
-}
-
-//-------------------------------------------------------------------------
-
-SfxMultiRecordReader::~SfxMultiRecordReader()
-{
- delete[] _pContentOfs;
-}
-
-//-------------------------------------------------------------------------
-
-FASTBOOL SfxMultiRecordReader::GetContent()
-
-/* [Beschreibung]
-
- Positioniert den Stream an den Anfang des n"chsten bzw. beim 1. Aufruf
- auf den Anfang des ersten Contents im Record und liest ggf. dessen
- Header ein.
-
- Liegt laut Record-Header kein Content mehr vor, wird FALSE zur"uck-
- gegeben. Trotz einem TRUE-Returnwert kann am Stream ein Fehlercode
- gesetzt sein, z.B. falls er unvorhergesehenerweise (kaputtes File)
- zuende ist.
-*/
-
-{
- // noch ein Content vorhanden?
- if ( _nContentNo < _nContentCount )
- {
- // den Stream an den Anfang des Contents positionieren
- UINT32 nOffset = _nRecordType == SFX_REC_TYPE_FIXSIZE
- ? _nContentNo * _nContentSize
- : SFX_REC_CONTENT_OFS(_pContentOfs[_nContentNo]);
- UINT32 nNewPos = _nStartPos + nOffset;
- DBG_ASSERT( nNewPos >= _pStream->Tell(), "SfxMultiRecordReader::GetContent() - New position before current, to much data red!" );
-
- // #99366#: correct stream pos in every case;
- // the if clause was added by MT a long time ago,
- // maybe to 'repair' other corrupt documents; but this
- // gives errors when writing with 5.1 and reading with current
- // versions, so we decided to remove the if clause (KA-05/17/2002)
- // if ( nNewPos > _pStream->Tell() )
- _pStream->Seek( nNewPos );
-
- // ggf. Content-Header lesen
- if ( _nRecordType == SFX_REC_TYPE_MIXTAGS ||
- _nRecordType == SFX_REC_TYPE_MIXTAGS_RELOC )
- {
- _nContentVer = sal::static_int_cast< BYTE >(
- SFX_REC_CONTENT_VER(_pContentOfs[_nContentNo]));
- *_pStream >> _nContentTag;
- }
-
- // ContentNo weiterz"ahlen
- ++_nContentNo;
- return TRUE;
- }
-
- return FALSE;
-}
-
-
diff --git a/svtools/source/filerec/makefile.mk b/svtools/source/filerec/makefile.mk
deleted file mode 100644
index 33e4b4923183..000000000000
--- a/svtools/source/filerec/makefile.mk
+++ /dev/null
@@ -1,50 +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: makefile.mk,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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=filerec
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/filerec.obj
-
-# --- Tagets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
index 1bc83575ec38..584814dd9e92 100644
--- a/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
+++ b/svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
@@ -37,7 +37,7 @@
#include "FilterConfigCache.hxx"
#include <osl/file.hxx>
#include <osl/module.hxx>
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#include <svtools/fltcall.hxx>
#include "dlgexpor.hxx"
#include "dlgejpg.hxx"
@@ -49,7 +49,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Sequence.h>
#include <com/sun/star/uno/Any.h>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
#include "vcl/svapp.hxx"
#if defined WIN || (defined OS2 && !defined ICC)
diff --git a/svtools/source/filter.vcl/filter/dlgejpg.hrc b/svtools/source/filter.vcl/filter/dlgejpg.hrc
index 4342a89d1d24..67ac915df367 100644
--- a/svtools/source/filter.vcl/filter/dlgejpg.hrc
+++ b/svtools/source/filter.vcl/filter/dlgejpg.hrc
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#define BTN_OK 1
#define BTN_CANCEL 1
diff --git a/svtools/source/filter.vcl/filter/dlgepng.hrc b/svtools/source/filter.vcl/filter/dlgepng.hrc
index 79d4b189aa5a..d687141abf56 100644
--- a/svtools/source/filter.vcl/filter/dlgepng.hrc
+++ b/svtools/source/filter.vcl/filter/dlgepng.hrc
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#define BTN_OK 1
#define BTN_CANCEL 1
diff --git a/svtools/source/filter.vcl/filter/dlgexpor.hrc b/svtools/source/filter.vcl/filter/dlgexpor.hrc
index 28921b5f178c..cae15d7276d2 100644
--- a/svtools/source/filter.vcl/filter/dlgexpor.hrc
+++ b/svtools/source/filter.vcl/filter/dlgexpor.hrc
@@ -27,7 +27,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#define BTN_OK_PIX 1
#define BTN_CANCEL_PIX 1
diff --git a/svtools/source/filter.vcl/filter/filter.cxx b/svtools/source/filter.vcl/filter/filter.cxx
index 3586ddd02ddd..306307a0bf91 100644
--- a/svtools/source/filter.vcl/filter/filter.cxx
+++ b/svtools/source/filter.vcl/filter/filter.cxx
@@ -54,7 +54,7 @@
#include "jpeg.hxx"
#include "xbmread.hxx"
#include "xpmread.hxx"
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#include "strings.hrc"
#include "sgffilt.hxx"
#include "osl/module.hxx"
diff --git a/svtools/source/filter.vcl/filter/makefile.mk b/svtools/source/filter.vcl/filter/makefile.mk
index 2229f8f05546..ecdf48ba5671 100644
--- a/svtools/source/filter.vcl/filter/makefile.mk
+++ b/svtools/source/filter.vcl/filter/makefile.mk
@@ -40,6 +40,8 @@ LIBTARGET=NO
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/svt.pmk
+SOLARINC+=-I../../inc
+
# --- Files --------------------------------------------------------
SRS1NAME=$(TARGET)
diff --git a/svtools/source/filter.vcl/filter/strings.hrc b/svtools/source/filter.vcl/filter/strings.hrc
index 0cfa4e6bf7c4..a3356982609a 100644
--- a/svtools/source/filter.vcl/filter/strings.hrc
+++ b/svtools/source/filter.vcl/filter/strings.hrc
@@ -27,4 +27,4 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
diff --git a/svtools/source/filter.vcl/igif/decode.cxx b/svtools/source/filter.vcl/igif/decode.cxx
index 960a91845bf8..9babc02665a3 100644
--- a/svtools/source/filter.vcl/igif/decode.cxx
+++ b/svtools/source/filter.vcl/igif/decode.cxx
@@ -51,7 +51,6 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) :
bEOIFound ( FALSE ),
nDataSize ( cDataSize )
{
- pTable = new GIFLZWTableEntry[ 4096 ];
pOutBuf = new BYTE[ 4096 ];
nClearCode = 1 << nDataSize;
@@ -61,6 +60,8 @@ GIFLZWDecompressor::GIFLZWDecompressor( BYTE cDataSize ) :
nOldCode = 0xffff;
pOutBufData = pOutBuf + 4096;
+ pTable = new GIFLZWTableEntry[ 4098 ];
+
for( USHORT i = 0; i < nTableSize; i++ )
{
pTable[i].pPrev = NULL;
diff --git a/svtools/source/filter.vcl/igif/makefile.mk b/svtools/source/filter.vcl/igif/makefile.mk
index 0562813c00cc..49e2461bd7a8 100644
--- a/svtools/source/filter.vcl/igif/makefile.mk
+++ b/svtools/source/filter.vcl/igif/makefile.mk
@@ -38,6 +38,7 @@ TARGET=igif
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/svt.pmk
+SOLARINC+=-I../../inc
# --- Files --------------------------------------------------------
diff --git a/svtools/source/filter.vcl/ixbm/makefile.mk b/svtools/source/filter.vcl/ixbm/makefile.mk
index 9c090e1de04a..41d6f7425474 100644
--- a/svtools/source/filter.vcl/ixbm/makefile.mk
+++ b/svtools/source/filter.vcl/ixbm/makefile.mk
@@ -38,6 +38,7 @@ TARGET=ixbm
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/svt.pmk
+SOLARINC+=-I../../inc
# --- Files --------------------------------------------------------
diff --git a/svtools/source/filter.vcl/ixpm/makefile.mk b/svtools/source/filter.vcl/ixpm/makefile.mk
index 2e5cb851ebbf..10792f41ab3a 100644
--- a/svtools/source/filter.vcl/ixpm/makefile.mk
+++ b/svtools/source/filter.vcl/ixpm/makefile.mk
@@ -38,6 +38,7 @@ TARGET=ixpm
.INCLUDE : settings.mk
.INCLUDE : $(PRJ)$/util$/svt.pmk
+SOLARINC+=-I../../inc
# --- Files --------------------------------------------------------
diff --git a/svtools/source/filter.vcl/ixpm/xpmread.cxx b/svtools/source/filter.vcl/ixpm/xpmread.cxx
index 0aa070e41596..1a667908f2f1 100644
--- a/svtools/source/filter.vcl/ixpm/xpmread.cxx
+++ b/svtools/source/filter.vcl/ixpm/xpmread.cxx
@@ -109,6 +109,10 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
mnColors = ImplGetULONG( 2 );
mnCpp = ImplGetULONG( 3 );
}
+ if ( mnColors > ( SAL_MAX_UINT32 / ( 4 + mnCpp ) ) )
+ mbStatus = sal_False;
+ if ( ( mnWidth * mnCpp ) >= XPMSTRINGBUF )
+ mbStatus = sal_False;
if ( mbStatus && mnWidth && mnHeight && mnColors && mnCpp )
{
mnIdentifier = XPMCOLORS;
@@ -118,15 +122,20 @@ ReadState XPMReader::ReadXPM( Graphic& rGraphic )
// 1 Byte -> 0xff wenn Farbe transparent ist
// 3 Bytes -> RGB Wert der Farbe
mpColMap = new BYTE[ mnColors * ( 4 + mnCpp ) ];
-
- for ( ULONG i = 0; i < mnColors; i++ )
+ if ( mpColMap )
{
- if ( ImplGetColor( i ) == FALSE )
+ for ( ULONG i = 0; i < mnColors; i++ )
{
- mbStatus = FALSE;
- break;
+ if ( ImplGetColor( i ) == FALSE )
+ {
+ mbStatus = FALSE;
+ break;
+ }
}
}
+ else
+ mbStatus = sal_False;
+
if ( mbStatus )
{
// bei mehr als 256 Farben wird eine 24 Bit Grafik erstellt
@@ -630,7 +639,7 @@ BOOL XPMReader::ImplGetString( void )
mnStatus &=~XPMSTRING; // end of parameter by eol
break;
}
- if ( mnStringSize >= XPMSTRINGBUF )
+ if ( mnStringSize >= ( XPMSTRINGBUF - 1 ) )
{
mbStatus = FALSE;
break;
diff --git a/svtools/source/filter.vcl/jpeg/makefile.mk b/svtools/source/filter.vcl/jpeg/makefile.mk
index 86c9c89c8bf0..7a9b5fc509c9 100644
--- a/svtools/source/filter.vcl/jpeg/makefile.mk
+++ b/svtools/source/filter.vcl/jpeg/makefile.mk
@@ -43,6 +43,8 @@ TARGET=jpeg
CFLAGS+=-DSYSTEM_JPEG
.ENDIF
+SOLARINC+=-I../../inc
+
# --- Files --------------------------------------------------------
SLOFILES= $(SLO)$/jpegc.obj \
diff --git a/svtools/source/filter.vcl/wmf/emfwr.cxx b/svtools/source/filter.vcl/wmf/emfwr.cxx
index df56afc4a250..e011dde1a0e8 100644
--- a/svtools/source/filter.vcl/wmf/emfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/emfwr.cxx
@@ -33,6 +33,9 @@
#include "emfwr.hxx"
#include <vcl/salbtype.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vcl/lineinfo.hxx>
// -----------
// - Defines -
@@ -829,6 +832,46 @@ void EMFWriter::ImplWriteTextRecord( const Point& rPos, const String rText, cons
// -----------------------------------------------------------------------------
+void EMFWriter::Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
+{
+ if(rLinePolygon.count())
+ {
+ basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
+ basegfx::B2DPolyPolygon aFillPolyPolygon;
+
+ rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
+
+ if(aLinePolyPolygon.count())
+ {
+ for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+ ImplWritePolygonRecord( Polygon(aCandidate), FALSE );
+ }
+ }
+
+ if(aFillPolyPolygon.count())
+ {
+ const Color aOldLineColor(maVDev.GetLineColor());
+ const Color aOldFillColor(maVDev.GetFillColor());
+
+ maVDev.SetLineColor();
+ maVDev.SetFillColor(aOldLineColor);
+
+ for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+ {
+ const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+ ImplWritePolyPolygonRecord(PolyPolygon(Polygon(aPolygon)));
+ }
+
+ maVDev.SetLineColor(aOldLineColor);
+ maVDev.SetFillColor(aOldFillColor);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
{
for( ULONG j = 0, nActionCount = rMtf.GetActionCount(); j < nActionCount; j++ )
@@ -871,20 +914,31 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
{
const MetaLineAction* pA = (const MetaLineAction*) pAction;
- ImplCheckLineAttr();
+ if(pA->GetLineInfo().IsDefault())
+ {
+ ImplCheckLineAttr();
- ImplBeginRecord( WIN_EMR_MOVETOEX );
- ImplWritePoint( pA->GetStartPoint() );
- ImplEndRecord();
+ ImplBeginRecord( WIN_EMR_MOVETOEX );
+ ImplWritePoint( pA->GetStartPoint() );
+ ImplEndRecord();
- ImplBeginRecord( WIN_EMR_LINETO );
- ImplWritePoint( pA->GetEndPoint() );
- ImplEndRecord();
+ ImplBeginRecord( WIN_EMR_LINETO );
+ ImplWritePoint( pA->GetEndPoint() );
+ ImplEndRecord();
- ImplBeginRecord( WIN_EMR_SETPIXELV );
- ImplWritePoint( pA->GetEndPoint() );
- ImplWriteColor( maVDev.GetLineColor() );
- ImplEndRecord();
+ ImplBeginRecord( WIN_EMR_SETPIXELV );
+ ImplWritePoint( pA->GetEndPoint() );
+ ImplWriteColor( maVDev.GetLineColor() );
+ ImplEndRecord();
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
+ aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
+ Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
+ }
}
}
break;
@@ -983,7 +1037,23 @@ void EMFWriter::ImplWrite( const GDIMetaFile& rMtf )
case( META_POLYLINE_ACTION ):
{
if( maVDev.IsLineColor() )
- ImplWritePolygonRecord( ( (const MetaPolyLineAction*) pAction )->GetPolygon(), FALSE );
+ {
+ const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pAction;
+ const Polygon& rPoly = pA->GetPolygon();
+
+ if( rPoly.GetSize() )
+ {
+ if(pA->GetLineInfo().IsDefault())
+ {
+ ImplWritePolygonRecord( rPoly, FALSE );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ Impl_handleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
+ }
+ }
+ }
}
break;
diff --git a/svtools/source/filter.vcl/wmf/emfwr.hxx b/svtools/source/filter.vcl/wmf/emfwr.hxx
index 150aa1692ade..2d3c8801ba49 100644
--- a/svtools/source/filter.vcl/wmf/emfwr.hxx
+++ b/svtools/source/filter.vcl/wmf/emfwr.hxx
@@ -42,6 +42,9 @@
// - EMFWriter -
// -------------
+class LineInfo;
+namespace basegfx { class B2DPolygon; }
+
class EMFWriter
{
private:
@@ -86,6 +89,7 @@ private:
void ImplWriteBmpRecord( const Bitmap& rBmp, const Point& rPt, const Size& rSz, UINT32 nROP );
void ImplWriteTextRecord( const Point& rPos, const String rText, const sal_Int32* pDXArray, sal_uInt32 nWidth );
+ void Impl_handleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
void ImplWrite( const GDIMetaFile& rMtf );
public:
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx
index ee3a71c51f9d..30d4ff06c0d2 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx
@@ -33,7 +33,7 @@
#include <vcl/salbtype.hxx>
#include "wmfwr.hxx"
-#include <vcl/fontcvt.hxx>
+#include <unotools/fontcvt.hxx>
#include <rtl/crc.h>
#include <rtl/tencinfo.h>
#include <tools/tenccvt.hxx>
@@ -42,8 +42,9 @@
#include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType
#endif
-
#include <vcl/metric.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
//====================== MS-Windows-defines ===============================
@@ -755,7 +756,7 @@ void WMFWriter::WMFRecord_Polygon(const Polygon & rPoly)
Polygon aSimplePoly;
if ( rPoly.HasFlags() )
- rPoly.GetSimple( aSimplePoly );
+ rPoly.AdaptiveSubdivide( aSimplePoly );
else
aSimplePoly = rPoly;
nSize = aSimplePoly.GetSize();
@@ -770,7 +771,7 @@ void WMFWriter::WMFRecord_PolyLine(const Polygon & rPoly)
USHORT nSize,i;
Polygon aSimplePoly;
if ( rPoly.HasFlags() )
- rPoly.GetSimple( aSimplePoly );
+ rPoly.AdaptiveSubdivide( aSimplePoly );
else
aSimplePoly = rPoly;
nSize=aSimplePoly.GetSize();
@@ -792,7 +793,7 @@ void WMFWriter::WMFRecord_PolyPolygon(const PolyPolygon & rPolyPoly)
if ( aSimplePolyPoly[ i ].HasFlags() )
{
Polygon aSimplePoly;
- aSimplePolyPoly[ i ].GetSimple( aSimplePoly );
+ aSimplePolyPoly[ i ].AdaptiveSubdivide( aSimplePoly );
aSimplePolyPoly[ i ] = aSimplePoly;
}
}
@@ -1136,6 +1137,49 @@ void WMFWriter::SetAllAttr()
}
+void WMFWriter::HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon)
+{
+ if(rLinePolygon.count())
+ {
+ basegfx::B2DPolyPolygon aLinePolyPolygon(rLinePolygon);
+ basegfx::B2DPolyPolygon aFillPolyPolygon;
+
+ rInfo.applyToB2DPolyPolygon(aLinePolyPolygon, aFillPolyPolygon);
+
+ if(aLinePolyPolygon.count())
+ {
+ aSrcLineInfo = rInfo;
+ SetLineAndFillAttr();
+
+ for(sal_uInt32 a(0); a < aLinePolyPolygon.count(); a++)
+ {
+ const basegfx::B2DPolygon aCandidate(aLinePolyPolygon.getB2DPolygon(a));
+ WMFRecord_PolyLine(Polygon(aCandidate));
+ }
+ }
+
+ if(aFillPolyPolygon.count())
+ {
+ const Color aOldLineColor(aSrcLineColor);
+ const Color aOldFillColor(aSrcFillColor);
+
+ aSrcLineColor = Color( COL_TRANSPARENT );
+ aSrcFillColor = aOldLineColor;
+ SetLineAndFillAttr();
+
+ for(sal_uInt32 a(0); a < aFillPolyPolygon.count(); a++)
+ {
+ const Polygon aPolygon(aFillPolyPolygon.getB2DPolygon(a));
+ WMFRecord_Polygon(Polygon(aPolygon));
+ }
+
+ aSrcLineColor = aOldLineColor;
+ aSrcFillColor = aOldFillColor;
+ SetLineAndFillAttr();
+ }
+ }
+}
+
void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
{
ULONG nA, nACount;
@@ -1176,10 +1220,21 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_LINE_ACTION:
{
const MetaLineAction* pA = (const MetaLineAction *) pMA;
- aSrcLineInfo = pA->GetLineInfo();
- SetLineAndFillAttr();
- WMFRecord_MoveTo( pA->GetStartPoint() );
- WMFRecord_LineTo( pA->GetEndPoint() );
+ if(pA->GetLineInfo().IsDefault())
+ {
+ aSrcLineInfo = pA->GetLineInfo();
+ SetLineAndFillAttr();
+ WMFRecord_MoveTo( pA->GetStartPoint() );
+ WMFRecord_LineTo( pA->GetEndPoint() );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ basegfx::B2DPolygon aPolygon;
+ aPolygon.append(basegfx::B2DPoint(pA->GetStartPoint().X(), pA->GetStartPoint().Y()));
+ aPolygon.append(basegfx::B2DPoint(pA->GetEndPoint().X(), pA->GetEndPoint().Y()));
+ HandleLineInfoPolyPolygons(pA->GetLineInfo(), aPolygon);
+ }
}
break;
@@ -1241,9 +1296,22 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
case META_POLYLINE_ACTION:
{
const MetaPolyLineAction* pA = (const MetaPolyLineAction*) pMA;
- aSrcLineInfo = pA->GetLineInfo();
- SetLineAndFillAttr();
- WMFRecord_PolyLine( pA->GetPolygon() );
+ const Polygon& rPoly = pA->GetPolygon();
+
+ if( rPoly.GetSize() )
+ {
+ if(pA->GetLineInfo().IsDefault())
+ {
+ aSrcLineInfo = pA->GetLineInfo();
+ SetLineAndFillAttr();
+ WMFRecord_PolyLine( rPoly );
+ }
+ else
+ {
+ // LineInfo used; handle Dash/Dot and fat lines
+ HandleLineInfoPolyPolygons(pA->GetLineInfo(), rPoly.getB2DPolygon());
+ }
+ }
}
break;
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.hxx b/svtools/source/filter.vcl/wmf/wmfwr.hxx
index 48986a280404..03ca14e7633f 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.hxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.hxx
@@ -65,6 +65,9 @@ struct WMFWriterAttrStackMember
// -------------
class StarSymbolToMSMultiFont;
+class LineInfo;
+namespace basegfx { class B2DPolygon; }
+
class WMFWriter
{
private:
@@ -202,6 +205,7 @@ private:
void SetLineAndFillAttr();
void SetAllAttr();
+ void HandleLineInfoPolyPolygons(const LineInfo& rInfo, const basegfx::B2DPolygon& rLinePolygon);
void WriteRecords(const GDIMetaFile & rMTF);
void WriteHeader(const GDIMetaFile & rMTF, BOOL bPlaceable);
diff --git a/svtools/source/fsstor/exports.map b/svtools/source/fsstor/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/svtools/source/fsstor/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/svtools/source/fsstor/fsfactory.cxx b/svtools/source/fsstor/fsfactory.cxx
deleted file mode 100644
index 33df962be846..000000000000
--- a/svtools/source/fsstor/fsfactory.cxx
+++ /dev/null
@@ -1,295 +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: fsfactory.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include "fsfactory.hxx"
-#include "cppuhelper/factory.hxx"
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-
-
-#include <ucbhelper/fileidentifierconverter.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/content.hxx>
-
-#include <unotools/tempfile.hxx>
-#include <unotools/ucbhelper.hxx>
-
-#include "fsstorage.hxx"
-
-
-using namespace ::com::sun::star;
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.embed.FileSystemStorageFactory");
- aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.FileSystemStorageFactory");
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL FSStorageFactory::impl_staticGetImplementationName()
-{
- return ::rtl::OUString::createFromAscii("com.sun.star.comp.embed.FileSystemStorageFactory");
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new FSStorageFactory( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance()
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- ::rtl::OUString aTempURL;
-
- aTempURL = ::utl::TempFile( NULL, sal_True ).GetURL();
-
- if ( !aTempURL.getLength() )
- throw uno::RuntimeException(); // TODO: can not create tempfile
-
- ::ucbhelper::Content aResultContent(
- aTempURL, uno::Reference< ucb::XCommandEnvironment >() );
-
- return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >(
- new FSStorage( aResultContent,
- embed::ElementModes::READWRITE,
- uno::Sequence< beans::PropertyValue >(),
- m_xFactory ) ),
- uno::UNO_QUERY );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithArguments(
- const uno::Sequence< uno::Any >& aArguments )
- throw ( uno::Exception,
- uno::RuntimeException )
-{
- // The request for storage can be done with up to three arguments
-
- // The first argument specifies a source for the storage
- // it must be URL.
- // The second value is a mode the storage should be open in.
- // And the third value is a media descriptor.
-
- sal_Int32 nArgNum = aArguments.getLength();
- OSL_ENSURE( nArgNum < 4, "Wrong parameter number" );
-
- if ( !nArgNum )
- return createInstance();
-
- // first try to retrieve storage open mode if any
- // by default the storage will be open in readonly mode
- sal_Int32 nStorageMode = embed::ElementModes::READ;
- if ( nArgNum >= 2 )
- {
- if( !( aArguments[1] >>= nStorageMode ) )
- {
- OSL_ENSURE( sal_False, "Wrong second argument!\n" );
- throw uno::Exception(); // TODO: Illegal argument
- }
- // it's allways possible to read written storage in this implementation
- nStorageMode |= embed::ElementModes::READ;
- }
-
- // retrieve storage source URL
- ::rtl::OUString aURL;
-
- if ( aArguments[0] >>= aURL )
- {
- if ( !aURL.getLength() )
- {
- OSL_ENSURE( sal_False, "Empty URL is provided!\n" );
- throw uno::Exception(); // TODO: illegal argument
- }
- }
- else
- {
- OSL_ENSURE( sal_False, "Wrong first argument!\n" );
- throw uno::Exception(); // TODO: Illegal argument
- }
-
- // retrieve mediadescriptor and set storage properties
- uno::Sequence< beans::PropertyValue > aDescr;
- uno::Sequence< beans::PropertyValue > aPropsToSet;
-
- if ( nArgNum >= 3 )
- {
- if( aArguments[2] >>= aDescr )
- {
- aPropsToSet.realloc(1);
- aPropsToSet[0].Name = ::rtl::OUString::createFromAscii( "URL" );
- aPropsToSet[0].Value <<= aURL;
-
- for ( sal_Int32 nInd = 0, nNumArgs = 1; nInd < aDescr.getLength(); nInd++ )
- {
- if ( aDescr[nInd].Name.equalsAscii( "InteractionHandler" ) )
- {
- aPropsToSet.realloc( ++nNumArgs );
- aPropsToSet[nNumArgs-1].Name = aDescr[nInd].Name;
- aPropsToSet[nNumArgs-1].Value = aDescr[nInd].Value;
- break;
- }
- else
- OSL_ENSURE( sal_False, "Unacceptable property, will be ignored!\n" );
- }
- }
- else
- {
- OSL_ENSURE( sal_False, "Wrong third argument!\n" );
- throw uno::Exception(); // TODO: Illegal argument
- }
- }
-
- // allow to use other ucp's
- // if ( !isLocalNotFile_Impl( aURL ) )
- if ( aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.pkg", 16 )
- || aURL.equalsIgnoreAsciiCaseAsciiL( "vnd.sun.star.zip", 16 )
- || ::utl::UCBContentHelper::IsDocument( aURL ) )
- {
- OSL_ENSURE( sal_False, "File system storages can be based only on file URLs!\n" ); // ???
- throw uno::Exception(); // TODO: illegal argument
- }
-
- if ( ( nStorageMode & embed::ElementModes::WRITE ) && !( nStorageMode & embed::ElementModes::NOCREATE ) )
- FSStorage::MakeFolderNoUI( aURL, sal_False );
- else if ( !::utl::UCBContentHelper::IsFolder( aURL ) )
- throw io::IOException(); // there is no such folder
-
- ::ucbhelper::Content aResultContent(
- aURL, uno::Reference< ucb::XCommandEnvironment >() );
-
- // create storage based on source
- return uno::Reference< uno::XInterface >(
- static_cast< OWeakObject* >( new FSStorage( aResultContent,
- nStorageMode,
- aPropsToSet,
- m_xFactory ) ),
- uno::UNO_QUERY );
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL FSStorageFactory::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL FSStorageFactory::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
-
- for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL FSStorageFactory::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-//-------------------------------------------------------------------------
-
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
- const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
- void * /* pServiceManager */, void * pRegistryKey)
-{
- if (pRegistryKey)
- {
- uno::Reference< registry::XRegistryKey > xRegistryKey (
- reinterpret_cast< registry::XRegistryKey*>(pRegistryKey));
-
- uno::Reference< registry::XRegistryKey > xNewKey;
- xNewKey = xRegistryKey->createKey(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
- FSStorageFactory::impl_staticGetImplementationName() +
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES")));
-
- const uno::Sequence< ::rtl::OUString > aServices (
- FSStorageFactory::impl_staticGetSupportedServiceNames());
- for( sal_Int32 i = 0; i < aServices.getLength(); i++ )
- xNewKey->createKey( aServices.getConstArray()[i] );
-
- return sal_True;
- }
- return sal_False;
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
- const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
-{
- void * pResult = 0;
- if (pServiceManager)
- {
- uno::Reference< lang::XSingleServiceFactory > xFactory;
- if (FSStorageFactory::impl_staticGetImplementationName().compareToAscii (pImplementationName) == 0)
- {
- xFactory = cppu::createOneInstanceFactory (
- reinterpret_cast< lang::XMultiServiceFactory* >(pServiceManager),
- FSStorageFactory::impl_staticGetImplementationName(),
- FSStorageFactory::impl_staticCreateSelfInstance,
- FSStorageFactory::impl_staticGetSupportedServiceNames() );
- }
- if (xFactory.is())
- {
- xFactory->acquire();
- pResult = xFactory.get();
- }
- }
- return pResult;
-}
-
-} // extern "C"
-
diff --git a/svtools/source/fsstor/fsstorage.cxx b/svtools/source/fsstor/fsstorage.cxx
deleted file mode 100644
index cec018533a9a..000000000000
--- a/svtools/source/fsstor/fsstorage.cxx
+++ /dev/null
@@ -1,1617 +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: fsstorage.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/XTransactedObject.hpp>
-#include <com/sun/star/ucb/XProgressHandler.hpp>
-#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
-#ifndef _COM_SUN_STAR_UCB_INTERACTIVEIODEXCEPTION_HPP_
-#include <com/sun/star/ucb/InteractiveIOException.hpp>
-#endif
-#include <com/sun/star/ucb/IOErrorCode.hpp>
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
-#include <com/sun/star/io/IOException.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/sdbc/XResultSet.hpp>
-#include <com/sun/star/sdbc/XRow.hpp>
-
-
-#ifndef _COMPHELPER_PROCESSFACTORY_HXX
-#include <comphelper/processfactory.hxx>
-#endif
-#include <comphelper/storagehelper.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/exc_hlp.hxx>
-
-#include <tools/urlobj.hxx>
-#include <unotools/ucbhelper.hxx>
-#include <unotools/ucbstreamhelper.hxx>
-#include <unotools/streamwrap.hxx>
-#include <ucbhelper/fileidentifierconverter.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <ucbhelper/content.hxx>
-
-#include "fsstorage.hxx"
-#include "oinputstreamcontainer.hxx"
-#include "ostreamcontainer.hxx"
-
-using namespace ::com::sun::star;
-
-//=========================================================
-
-// TODO: move to a standard helper
-sal_Bool isLocalFile_Impl( ::rtl::OUString aURL )
-{
- ::rtl::OUString aSystemPath;
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- if ( !pBroker )
- throw uno::RuntimeException();
-
- uno::Reference< ucb::XContentProviderManager > xManager =
- pBroker->getContentProviderManagerInterface();
- try
- {
- aSystemPath = ::ucbhelper::getSystemPathFromFileURL( xManager, aURL );
- }
- catch ( uno::Exception& )
- {
- }
-
- return ( aSystemPath.getLength() != 0 );
-}
-
-
-//=========================================================
-
-struct FSStorage_Impl
-{
- ::rtl::OUString m_aURL;
-
- ::ucbhelper::Content* m_pContent;
- sal_Int32 m_nMode;
-
- ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
- ::cppu::OTypeCollection* m_pTypeCollection;
-
- uno::Reference< lang::XMultiServiceFactory > m_xFactory;
-
-
- FSStorage_Impl( const ::rtl::OUString& aURL, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory )
- : m_aURL( aURL )
- , m_pContent( NULL )
- , m_nMode( nMode )
- , m_pListenersContainer( NULL )
- , m_pTypeCollection( NULL )
- , m_xFactory( xFactory )
- {
- OSL_ENSURE( m_aURL.getLength(), "The URL must not be empty" );
- }
-
- FSStorage_Impl( const ::ucbhelper::Content& aContent, sal_Int32 nMode, uno::Reference< lang::XMultiServiceFactory > xFactory )
- : m_aURL( aContent.getURL() )
- , m_pContent( new ::ucbhelper::Content( aContent ) )
- , m_nMode( nMode )
- , m_pListenersContainer( NULL )
- , m_pTypeCollection( NULL )
- , m_xFactory( xFactory )
- {
- OSL_ENSURE( m_aURL.getLength(), "The URL must not be empty" );
- }
-
- ~FSStorage_Impl();
-};
-
-//=========================================================
-
-FSStorage_Impl::~FSStorage_Impl()
-{
- if ( m_pListenersContainer )
- delete m_pListenersContainer;
- if ( m_pTypeCollection )
- delete m_pTypeCollection;
- if ( m_pContent )
- delete m_pContent;
-}
-
-//=====================================================
-// FSStorage implementation
-//=====================================================
-
-//-----------------------------------------------
-FSStorage::FSStorage( const ::ucbhelper::Content& aContent,
- sal_Int32 nMode,
- uno::Sequence< beans::PropertyValue >,
- uno::Reference< lang::XMultiServiceFactory > xFactory )
-: m_pImpl( new FSStorage_Impl( aContent, nMode, xFactory ) )
-{
- // TODO: use properties
- if ( !xFactory.is() )
- throw uno::RuntimeException();
-
- GetContent();
-}
-
-//-----------------------------------------------
-FSStorage::~FSStorage()
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- m_refCount++; // to call dispose
- try {
- dispose();
- }
- catch( uno::RuntimeException& )
- {}
- }
-}
-
-//-----------------------------------------------
-sal_Bool FSStorage::MakeFolderNoUI( const String& rFolder, sal_Bool )
-{
- INetURLObject aURL( rFolder );
- ::rtl::OUString aTitle = aURL.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DECODE_WITH_CHARSET );
- aURL.removeSegment();
- ::ucbhelper::Content aParent;
- ::ucbhelper::Content aResultContent;
-
- if ( ::ucbhelper::Content::create( aURL.GetMainURL( INetURLObject::NO_DECODE ),
- uno::Reference< ucb::XCommandEnvironment >(),
- aParent ) )
- return ::utl::UCBContentHelper::MakeFolder( aParent, aTitle, aResultContent, sal_False );
-
- return sal_False;
-}
-
-//-----------------------------------------------
-::ucbhelper::Content* FSStorage::GetContent()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !m_pImpl->m_pContent )
- {
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
-
- try
- {
- m_pImpl->m_pContent = new ::ucbhelper::Content( m_pImpl->m_aURL, xDummyEnv );
- }
- catch( uno::Exception& )
- {
- }
- }
-
- return m_pImpl->m_pContent;
-}
-
-//-----------------------------------------------
-void FSStorage::CopyStreamToSubStream( const ::rtl::OUString& aSourceURL,
- const uno::Reference< embed::XStorage >& xDest,
- const ::rtl::OUString& aNewEntryName )
-{
- if ( !xDest.is() )
- throw uno::RuntimeException();
-
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv );
- uno::Reference< io::XInputStream > xSourceInput = aSourceContent.openStream();
-
- if ( !xSourceInput.is() )
- throw io::IOException(); // TODO: error handling
-
- uno::Reference< io::XStream > xSubStream = xDest->openStreamElement(
- aNewEntryName,
- embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
- if ( !xSubStream.is() )
- throw uno::RuntimeException();
-
- uno::Reference< io::XOutputStream > xDestOutput = xSubStream->getOutputStream();
- if ( !xDestOutput.is() )
- throw uno::RuntimeException();
-
- ::comphelper::OStorageHelper::CopyInputToOutput( xSourceInput, xDestOutput );
- xDestOutput->closeOutput();
-}
-
-//-----------------------------------------------
-void FSStorage::CopyContentToStorage_Impl( ::ucbhelper::Content* pContent, const uno::Reference< embed::XStorage >& xDest )
-{
- if ( !pContent )
- throw uno::RuntimeException();
-
- // get list of contents of the Content
- // create cursor for access to children
- uno::Sequence< ::rtl::OUString > aProps( 2 );
- ::rtl::OUString* pProps = aProps.getArray();
- pProps[0] = ::rtl::OUString::createFromAscii( "TargetURL" );
- pProps[1] = ::rtl::OUString::createFromAscii( "IsFolder" );
- ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS;
-
- try
- {
- uno::Reference< sdbc::XResultSet > xResultSet = pContent->createCursor( aProps, eInclude );
- uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY );
- uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY );
- if ( xResultSet.is() )
- {
- // go through the list: insert files as streams, insert folders as substorages using recursion
- while ( xResultSet->next() )
- {
- ::rtl::OUString aSourceURL( xRow->getString( 1 ) );
- sal_Bool bIsFolder( xRow->getBoolean(2) );
-
- // TODO/LATER: not sure whether the entry name must be encoded
- ::rtl::OUString aNewEntryName( INetURLObject( aSourceURL ).getName( INetURLObject::LAST_SEGMENT,
- true,
- INetURLObject::NO_DECODE ) );
- if ( bIsFolder )
- {
- uno::Reference< embed::XStorage > xSubStorage = xDest->openStorageElement( aNewEntryName,
- embed::ElementModes::READWRITE );
- if ( !xSubStorage.is() )
- throw uno::RuntimeException();
-
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aSourceContent( aSourceURL, xDummyEnv );
- CopyContentToStorage_Impl( &aSourceContent, xSubStorage );
- }
- else
- {
- CopyStreamToSubStream( aSourceURL, xDest, aNewEntryName );
- }
- }
- }
-
- uno::Reference< embed::XTransactedObject > xTransact( xDest, uno::UNO_QUERY );
- if ( xTransact.is() )
- xTransact->commit();
- }
- catch( ucb::InteractiveIOException& r )
- {
- if ( r.Code == ucb::IOErrorCode_NOT_EXISTING )
- OSL_ENSURE( sal_False, "The folder does not exist!\n" );
- else
- throw;
- }
-}
-
-//____________________________________________________________________________________________________
-// XInterface
-//____________________________________________________________________________________________________
-
-//-----------------------------------------------
-uno::Any SAL_CALL FSStorage::queryInterface( const uno::Type& rType )
- throw( uno::RuntimeException )
-{
- uno::Any aReturn;
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<lang::XTypeProvider*> ( this )
- , static_cast<embed::XStorage*> ( this )
- , static_cast<embed::XHierarchicalStorageAccess*> ( this )
- , static_cast<container::XNameAccess*> ( this )
- , static_cast<container::XElementAccess*> ( this )
- , static_cast<lang::XComponent*> ( this )
- , static_cast<beans::XPropertySet*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
-
- return OWeakObject::queryInterface( rType );
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::acquire() throw()
-{
- OWeakObject::acquire();
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::release() throw()
-{
- OWeakObject::release();
-}
-
-//____________________________________________________________________________________________________
-// XTypeProvider
-//____________________________________________________________________________________________________
-
-//-----------------------------------------------
-uno::Sequence< uno::Type > SAL_CALL FSStorage::getTypes()
- throw( uno::RuntimeException )
-{
- if ( m_pImpl->m_pTypeCollection == NULL )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pImpl->m_pTypeCollection == NULL )
- {
- m_pImpl->m_pTypeCollection = new ::cppu::OTypeCollection
- ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL )
- , ::getCppuType( ( const uno::Reference< embed::XStorage >* )NULL )
- , ::getCppuType( ( const uno::Reference< embed::XHierarchicalStorageAccess >* )NULL )
- , ::getCppuType( ( const uno::Reference< beans::XPropertySet >* )NULL ) );
- }
- }
-
- return m_pImpl->m_pTypeCollection->getTypes() ;
-}
-
-//-----------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL FSStorage::getImplementationId()
- throw( uno::RuntimeException )
-{
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( pID == NULL )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
-
- if ( pID == NULL )
- {
- static ::cppu::OImplementationId aID( sal_False ) ;
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-
-}
-
-//____________________________________________________________________________________________________
-// XStorage
-//____________________________________________________________________________________________________
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::copyToStorage( const uno::Reference< embed::XStorage >& xDest )
- throw ( embed::InvalidStorageException,
- io::IOException,
- lang::IllegalArgumentException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !xDest.is() || xDest == uno::Reference< uno::XInterface >( static_cast< OWeakObject*> ( this ), uno::UNO_QUERY ) )
- throw lang::IllegalArgumentException(); // TODO:
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- try
- {
- CopyContentToStorage_Impl( GetContent(), xDest );
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-}
-
-//-----------------------------------------------
-uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
- const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- packages::WrongPasswordException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked
- INetURLObject aFileURL( m_pImpl->m_aURL );
- aFileURL.Append( aStreamName );
-
- if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException();
-
- if ( ( nOpenMode & embed::ElementModes::NOCREATE )
- && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO:
-
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any
- uno::Reference< io::XStream > xResult;
- try
- {
- if ( nOpenMode & embed::ElementModes::WRITE )
- {
- if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(
- m_pImpl->m_xFactory->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ),
- uno::UNO_QUERY_THROW );
- xResult = xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
- }
- else
- {
- // TODO: test whether it really works for http and fwp
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ),
- STREAM_STD_WRITE );
- if ( pStream )
- {
- if ( !pStream->GetError() )
- xResult = uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) );
- else
- delete pStream;
- }
- }
-
- if ( !xResult.is() )
- throw io::IOException();
-
- if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) )
- {
- uno::Reference< io::XTruncate > xTrunc( xResult->getOutputStream(), uno::UNO_QUERY_THROW );
- xTrunc->truncate();
- }
- }
- else
- {
- if ( ( nOpenMode & embed::ElementModes::TRUNCATE )
- || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO: access denied
-
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
- uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
- xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
- }
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( packages::WrongPasswordException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-
- return xResult;
-}
-
-//-----------------------------------------------
-uno::Reference< io::XStream > SAL_CALL FSStorage::openEncryptedStreamElement(
- const ::rtl::OUString&, sal_Int32, const ::rtl::OUString& )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- packages::NoEncryptionException,
- packages::WrongPasswordException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- throw packages::NoEncryptionException();
-}
-
-//-----------------------------------------------
-uno::Reference< embed::XStorage > SAL_CALL FSStorage::openStorageElement(
- const ::rtl::OUString& aStorName, sal_Int32 nStorageMode )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- if ( ( nStorageMode & embed::ElementModes::WRITE )
- && !( m_pImpl->m_nMode & embed::ElementModes::WRITE ) )
- throw io::IOException(); // TODO: error handling
-
- // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked
- INetURLObject aFolderURL( m_pImpl->m_aURL );
- aFolderURL.Append( aStorName );
-
- sal_Bool bFolderExists = ::utl::UCBContentHelper::IsFolder( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) );
- if ( !bFolderExists && ::utl::UCBContentHelper::IsDocument( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO:
-
- if ( ( nStorageMode & embed::ElementModes::NOCREATE ) && !bFolderExists )
- throw io::IOException(); // TODO:
-
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any
- uno::Reference< embed::XStorage > xResult;
- try
- {
- if ( nStorageMode & embed::ElementModes::WRITE )
- {
- if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) && bFolderExists )
- {
- ::utl::UCBContentHelper::Kill( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ) );
- bFolderExists =
- MakeFolderNoUI( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); // TODO: not atomar :(
- }
- else if ( !bFolderExists )
- {
- bFolderExists =
- MakeFolderNoUI( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), sal_True ); // TODO: not atomar :(
- }
- }
- else if ( ( nStorageMode & embed::ElementModes::TRUNCATE ) )
- throw io::IOException(); // TODO: access denied
-
- if ( !bFolderExists )
- throw io::IOException(); // there is no such folder
-
- ::ucbhelper::Content aResultContent( aFolderURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
- xResult = uno::Reference< embed::XStorage >(
- static_cast< OWeakObject* >( new FSStorage( aResultContent,
- nStorageMode,
- uno::Sequence< beans::PropertyValue >(),
- m_pImpl->m_xFactory ) ),
- uno::UNO_QUERY );
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-
- return xResult;
-}
-
-//-----------------------------------------------
-uno::Reference< io::XStream > SAL_CALL FSStorage::cloneStreamElement( const ::rtl::OUString& aStreamName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- packages::WrongPasswordException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked
- INetURLObject aFileURL( m_pImpl->m_aURL );
- aFileURL.Append( aStreamName );
-
- uno::Reference < io::XStream > xTempResult;
- try
- {
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
- uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
-
- xTempResult = uno::Reference < io::XStream >(
- m_pImpl->m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ),
- uno::UNO_QUERY_THROW );
- uno::Reference < io::XOutputStream > xTempOut = xTempResult->getOutputStream();
- uno::Reference < io::XInputStream > xTempIn = xTempResult->getInputStream();
-
- if ( !xTempOut.is() || !xTempIn.is() )
- throw io::IOException();
-
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOut );
- xTempOut->closeOutput();
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( packages::WrongPasswordException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-
- return xTempResult;
-}
-
-//-----------------------------------------------
-uno::Reference< io::XStream > SAL_CALL FSStorage::cloneEncryptedStreamElement(
- const ::rtl::OUString&,
- const ::rtl::OUString& )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- packages::NoEncryptionException,
- packages::WrongPasswordException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- throw packages::NoEncryptionException();
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::copyLastCommitTo(
- const uno::Reference< embed::XStorage >& xTargetStorage )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- copyToStorage( xTargetStorage );
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::copyStorageElementLastCommitTo(
- const ::rtl::OUString& aStorName,
- const uno::Reference< embed::XStorage >& xTargetStorage )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- uno::Reference< embed::XStorage > xSourceStor( openStorageElement( aStorName, embed::ElementModes::READ ),
- uno::UNO_QUERY_THROW );
- xSourceStor->copyToStorage( xTargetStorage );
-}
-
-//-----------------------------------------------
-sal_Bool SAL_CALL FSStorage::isStreamElement( const ::rtl::OUString& aElementName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw embed::InvalidStorageException(); // TODO: error handling
-
- INetURLObject aURL( m_pImpl->m_aURL );
- aURL.Append( aElementName );
-
- return !::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
-}
-
-//-----------------------------------------------
-sal_Bool SAL_CALL FSStorage::isStorageElement( const ::rtl::OUString& aElementName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw embed::InvalidStorageException(); // TODO: error handling
-
- INetURLObject aURL( m_pImpl->m_aURL );
- aURL.Append( aElementName );
-
- return ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::removeElement( const ::rtl::OUString& aElementName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- INetURLObject aURL( m_pImpl->m_aURL );
- aURL.Append( aElementName );
-
- if ( !::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) )
- && !::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw container::NoSuchElementException(); // TODO:
-
- ::utl::UCBContentHelper::Kill( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::renameElement( const ::rtl::OUString& aElementName, const ::rtl::OUString& aNewName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- container::ElementExistException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- INetURLObject aOldURL( m_pImpl->m_aURL );
- aOldURL.Append( aElementName );
-
- INetURLObject aNewURL( m_pImpl->m_aURL );
- aNewURL.Append( aNewName );
-
- if ( !::utl::UCBContentHelper::IsFolder( aOldURL.GetMainURL( INetURLObject::NO_DECODE ) )
- && !::utl::UCBContentHelper::IsDocument( aOldURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw container::NoSuchElementException(); // TODO:
-
- if ( ::utl::UCBContentHelper::IsFolder( aNewURL.GetMainURL( INetURLObject::NO_DECODE ) )
- || ::utl::UCBContentHelper::IsDocument( aNewURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw container::ElementExistException(); // TODO:
-
- try
- {
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aSourceContent( aOldURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
-
- if ( !GetContent()->transferContent( aSourceContent,
- ::ucbhelper::InsertOperation_MOVE,
- aNewName,
- ucb::NameClash::ERROR ) )
- throw io::IOException(); // TODO: error handling
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( container::NoSuchElementException& )
- {
- throw;
- }
- catch( container::ElementExistException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::copyElementTo( const ::rtl::OUString& aElementName,
- const uno::Reference< embed::XStorage >& xDest,
- const ::rtl::OUString& aNewName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- container::ElementExistException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !xDest.is() )
- throw uno::RuntimeException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- INetURLObject aOwnURL( m_pImpl->m_aURL );
- aOwnURL.Append( aElementName );
-
- if ( xDest->hasByName( aNewName ) )
- throw container::ElementExistException(); // TODO:
-
- try
- {
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- if ( ::utl::UCBContentHelper::IsFolder( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- ::ucbhelper::Content aSourceContent( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
- uno::Reference< embed::XStorage > xDestSubStor(
- xDest->openStorageElement( aNewName, embed::ElementModes::READWRITE ),
- uno::UNO_QUERY_THROW );
-
- CopyContentToStorage_Impl( &aSourceContent, xDestSubStor );
- }
- else if ( ::utl::UCBContentHelper::IsDocument( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- CopyStreamToSubStream( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ), xDest, aNewName );
- }
- else
- throw container::NoSuchElementException(); // TODO:
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( container::NoSuchElementException& )
- {
- throw;
- }
- catch( container::ElementExistException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::moveElementTo( const ::rtl::OUString& aElementName,
- const uno::Reference< embed::XStorage >& xDest,
- const ::rtl::OUString& aNewName )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- container::ElementExistException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- copyElementTo( aElementName, xDest, aNewName );
-
- INetURLObject aOwnURL( m_pImpl->m_aURL );
- aOwnURL.Append( aElementName );
- if ( !::utl::UCBContentHelper::Kill( aOwnURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO: error handling
-}
-
-//____________________________________________________________________________________________________
-// XNameAccess
-//____________________________________________________________________________________________________
-
-//-----------------------------------------------
-uno::Any SAL_CALL FSStorage::getByName( const ::rtl::OUString& aName )
- throw ( container::NoSuchElementException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- if ( !aName.getLength() )
- throw lang::IllegalArgumentException();
-
- INetURLObject aURL( m_pImpl->m_aURL );
- aURL.Append( aName );
-
- uno::Any aResult;
- try
- {
- if ( ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- aResult <<= openStorageElement( aName, embed::ElementModes::READ );
- }
- else if ( ::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- aResult <<= openStreamElement( aName, embed::ElementModes::READ );
- }
- else
- throw container::NoSuchElementException(); // TODO:
- }
- catch( container::NoSuchElementException& )
- {
- throw;
- }
- catch( lang::WrappedTargetException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch ( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw lang::WrappedTargetException( ::rtl::OUString::createFromAscii( "Can not open element!\n" ),
- uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
- uno::UNO_QUERY ),
- aCaught );
- }
-
- return aResult;
-}
-
-
-//-----------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL FSStorage::getElementNames()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- uno::Sequence< ::rtl::OUString > aProps( 1 );
- ::rtl::OUString* pProps = aProps.getArray();
- pProps[0] = ::rtl::OUString::createFromAscii( "Title" );
- ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS;
-
- uno::Sequence< ::rtl::OUString > aResult;
- sal_Int32 nSize = 0;
-
- try
- {
- uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude );
- uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY );
- uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY );
- if ( xResultSet.is() )
- {
- // go through the list
- while ( xResultSet->next() )
- {
- ::rtl::OUString aName( xRow->getString( 1 ) );
- aResult.realloc( ++nSize );
- aResult[nSize-1] = aName;
- }
- }
- }
- catch( ucb::InteractiveIOException& r )
- {
- if ( r.Code == ucb::IOErrorCode_NOT_EXISTING )
- OSL_ENSURE( sal_False, "The folder does not exist!\n" );
- else
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ),
- uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
- uno::UNO_QUERY ),
- aCaught );
- }
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch ( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ),
- uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
- uno::UNO_QUERY ),
- aCaught );
- }
-
- return aResult;
-}
-
-
-//-----------------------------------------------
-sal_Bool SAL_CALL FSStorage::hasByName( const ::rtl::OUString& aName )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- try
- {
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- if ( !aName.getLength() )
- throw lang::IllegalArgumentException();
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch ( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw lang::WrappedTargetRuntimeException( ::rtl::OUString::createFromAscii( "Can not open storage!\n" ),
- uno::Reference< uno::XInterface >( static_cast< OWeakObject* >( this ),
- uno::UNO_QUERY ),
- aCaught );
- }
-
- INetURLObject aURL( m_pImpl->m_aURL );
- aURL.Append( aName );
-
- return ( ::utl::UCBContentHelper::IsFolder( aURL.GetMainURL( INetURLObject::NO_DECODE ) )
- || ::utl::UCBContentHelper::IsDocument( aURL.GetMainURL( INetURLObject::NO_DECODE ) ) );
-}
-
-//-----------------------------------------------
-uno::Type SAL_CALL FSStorage::getElementType()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- // it is a multitype container
- return uno::Type();
-}
-
-//-----------------------------------------------
-sal_Bool SAL_CALL FSStorage::hasElements()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- uno::Sequence< ::rtl::OUString > aProps( 1 );
- aProps[0] = ::rtl::OUString::createFromAscii( "TargetURL" );
- ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS;
-
- try
- {
- uno::Reference< sdbc::XResultSet > xResultSet = GetContent()->createCursor( aProps, eInclude );
- return ( xResultSet.is() && xResultSet->next() );
- }
- catch( uno::Exception& )
- {
- throw uno::RuntimeException();
- }
-}
-
-
-//____________________________________________________________________________________________________
-// XDisposable
-//____________________________________________________________________________________________________
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::dispose()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( m_pImpl->m_pListenersContainer )
- {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
- m_pImpl->m_pListenersContainer->disposeAndClear( aSource );
- }
-
- delete m_pImpl;
- m_pImpl = NULL;
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::addEventListener(
- const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !m_pImpl->m_pListenersContainer )
- m_pImpl->m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex );
-
- m_pImpl->m_pListenersContainer->addInterface( xListener );
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::removeEventListener(
- const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( m_pImpl->m_pListenersContainer )
- m_pImpl->m_pListenersContainer->removeInterface( xListener );
-}
-
-//____________________________________________________________________________________________________
-// XPropertySet
-//____________________________________________________________________________________________________
-
-//-----------------------------------------------
-uno::Reference< beans::XPropertySetInfo > SAL_CALL FSStorage::getPropertySetInfo()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- //TODO:
- return uno::Reference< beans::XPropertySetInfo >();
-}
-
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::setPropertyValue( const ::rtl::OUString& aPropertyName, const uno::Any& )
- throw ( beans::UnknownPropertyException,
- beans::PropertyVetoException,
- lang::IllegalArgumentException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( aPropertyName.equalsAscii( "URL" ) || aPropertyName.equalsAscii( "OpenMode" ) )
- throw beans::PropertyVetoException(); // TODO
- else
- throw beans::UnknownPropertyException(); // TODO
-}
-
-
-//-----------------------------------------------
-uno::Any SAL_CALL FSStorage::getPropertyValue( const ::rtl::OUString& aPropertyName )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( aPropertyName.equalsAscii( "URL" ) )
- return uno::makeAny( m_pImpl->m_aURL );
- else if ( aPropertyName.equalsAscii( "OpenMode" ) )
- return uno::makeAny( m_pImpl->m_nMode );
-
- throw beans::UnknownPropertyException(); // TODO
-}
-
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::addPropertyChangeListener(
- const ::rtl::OUString& /*aPropertyName*/,
- const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- //TODO:
-}
-
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::removePropertyChangeListener(
- const ::rtl::OUString& /*aPropertyName*/,
- const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- //TODO:
-}
-
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::addVetoableChangeListener(
- const ::rtl::OUString& /*PropertyName*/,
- const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- //TODO:
-}
-
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::removeVetoableChangeListener(
- const ::rtl::OUString& /*PropertyName*/,
- const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
- throw ( beans::UnknownPropertyException,
- lang::WrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- //TODO:
-}
-
-//____________________________________________________________________________________________________
-// XHierarchicalStorageAccess
-//____________________________________________________________________________________________________
-//-----------------------------------------------
-uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- packages::WrongPasswordException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( sStreamPath.toChar() == '/' )
- throw lang::IllegalArgumentException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- INetURLObject aBaseURL( m_pImpl->m_aURL );
- if ( !aBaseURL.setFinalSlash() )
- throw uno::RuntimeException();
-
- INetURLObject aFileURL = INetURLObject::GetAbsURL(
- aBaseURL.GetMainURL( INetURLObject::NO_DECODE ),
- sStreamPath );
-
- if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException();
-
- if ( ( nOpenMode & embed::ElementModes::NOCREATE )
- && !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO:
-
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv; // TODO: provide InteractionHandler if any
- uno::Reference< io::XStream > xResult;
- try
- {
- if ( nOpenMode & embed::ElementModes::WRITE )
- {
- if ( isLocalFile_Impl( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- uno::Reference< ucb::XSimpleFileAccess > xSimpleFileAccess(
- m_pImpl->m_xFactory->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ),
- uno::UNO_QUERY_THROW );
- uno::Reference< io::XStream > xStream =
- xSimpleFileAccess->openFileReadWrite( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) );
-
- xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) );
- }
- else
- {
- // TODO: test whether it really works for http and fwp
- SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::NO_DECODE ),
- STREAM_STD_WRITE );
- if ( pStream )
- {
- if ( !pStream->GetError() )
- {
- uno::Reference< io::XStream > xStream =
- uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) );
- xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) );
- }
- else
- delete pStream;
- }
- }
-
- if ( !xResult.is() )
- throw io::IOException();
-
- if ( ( nOpenMode & embed::ElementModes::TRUNCATE ) )
- {
- uno::Reference< io::XTruncate > xTrunc( xResult->getOutputStream(), uno::UNO_QUERY_THROW );
- xTrunc->truncate();
- }
- }
- else
- {
- if ( ( nOpenMode & embed::ElementModes::TRUNCATE )
- || !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO: access denied
-
- ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
- uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
- xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
- }
- }
- catch( embed::InvalidStorageException& )
- {
- throw;
- }
- catch( lang::IllegalArgumentException& )
- {
- throw;
- }
- catch( packages::WrongPasswordException& )
- {
- throw;
- }
- catch( embed::StorageWrappedTargetException& )
- {
- throw;
- }
- catch( io::IOException& )
- {
- throw;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- uno::Any aCaught( ::cppu::getCaughtException() );
- throw embed::StorageWrappedTargetException( ::rtl::OUString::createFromAscii( "Can't copy raw stream" ),
- uno::Reference< io::XInputStream >(),
- aCaught );
- }
-
- return uno::Reference< embed::XExtendedStorageStream >( xResult, uno::UNO_QUERY_THROW );
-}
-
-//-----------------------------------------------
-uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& /*sStreamName*/, ::sal_Int32 /*nOpenMode*/, const ::rtl::OUString& /*sPassword*/ )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- packages::NoEncryptionException,
- packages::WrongPasswordException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- throw packages::NoEncryptionException();
-}
-
-//-----------------------------------------------
-void SAL_CALL FSStorage::removeStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath )
- throw ( embed::InvalidStorageException,
- lang::IllegalArgumentException,
- container::NoSuchElementException,
- io::IOException,
- embed::StorageWrappedTargetException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !m_pImpl )
- throw lang::DisposedException();
-
- if ( !GetContent() )
- throw io::IOException(); // TODO: error handling
-
- // TODO/LATER: may need possibility to create folder if it was removed, since the folder can not be locked
- INetURLObject aBaseURL( m_pImpl->m_aURL );
- if ( !aBaseURL.setFinalSlash() )
- throw uno::RuntimeException();
-
- INetURLObject aFileURL = INetURLObject::GetAbsURL(
- aBaseURL.GetMainURL( INetURLObject::NO_DECODE ),
- sStreamPath );
-
- if ( !::utl::UCBContentHelper::IsDocument( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- {
- if ( ::utl::UCBContentHelper::IsFolder( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw lang::IllegalArgumentException();
- else
- throw container::NoSuchElementException(); // TODO:
- }
-
- if ( !::utl::UCBContentHelper::Kill( aFileURL.GetMainURL( INetURLObject::NO_DECODE ) ) )
- throw io::IOException(); // TODO: error handling
-}
-
-
diff --git a/svtools/source/fsstor/fsstorage.hxx b/svtools/source/fsstor/fsstorage.hxx
deleted file mode 100644
index 670a6917dd40..000000000000
--- a/svtools/source/fsstor/fsstorage.hxx
+++ /dev/null
@@ -1,340 +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: fsstorage.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 __XSTORAGE_HXX_
-#define __XSTORAGE_HXX_
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/XHierarchicalStorageAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/packages/NoEncryptionException.hpp>
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/interfacecontainer.h>
-
-#include <ucbhelper/content.hxx>
-
-struct FSStorage_Impl;
-class FSStorage : public ::com::sun::star::lang::XTypeProvider
- , public ::com::sun::star::embed::XStorage
- , public ::com::sun::star::embed::XHierarchicalStorageAccess
- , public ::com::sun::star::beans::XPropertySet
- , public ::cppu::OWeakObject
-{
- ::osl::Mutex m_aMutex;
- FSStorage_Impl* m_pImpl;
-
-protected:
-
-public:
-
- FSStorage( const ::ucbhelper::Content& aContent,
- sal_Int32 nMode,
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > xProperties,
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory );
-
- virtual ~FSStorage();
-
- ::ucbhelper::Content* GetContent();
-
- void CopyStreamToSubStream( const ::rtl::OUString& aSourceURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
- const ::rtl::OUString& aNewEntryName );
-
- void CopyContentToStorage_Impl( ::ucbhelper::Content* pContent,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest );
-
- static sal_Bool MakeFolderNoUI( const String& rFolder, sal_Bool bNewOnly );
-
- //____________________________________________________________________________________________________
- // XInterface
- //____________________________________________________________________________________________________
-
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL acquire() throw();
-
- virtual void SAL_CALL release() throw();
-
- //____________________________________________________________________________________________________
- // XTypeProvider
- //____________________________________________________________________________________________________
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
- throw( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
- throw( ::com::sun::star::uno::RuntimeException );
-
- //____________________________________________________________________________________________________
- // XStorage
- //____________________________________________________________________________________________________
-
- virtual void SAL_CALL copyToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openStreamElement(
- const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::packages::WrongPasswordException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL openEncryptedStreamElement(
- const ::rtl::OUString& aStreamName, sal_Int32 nOpenMode, const ::rtl::OUString& aPass )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::packages::NoEncryptionException,
- ::com::sun::star::packages::WrongPasswordException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > SAL_CALL openStorageElement(
- const ::rtl::OUString& aStorName, sal_Int32 nStorageMode )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneStreamElement(
- const ::rtl::OUString& aStreamName )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::packages::WrongPasswordException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > SAL_CALL cloneEncryptedStreamElement(
- const ::rtl::OUString& aStreamName, const ::rtl::OUString& aPass )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::packages::NoEncryptionException,
- ::com::sun::star::packages::WrongPasswordException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL copyLastCommitTo(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL copyStorageElementLastCommitTo(
- const ::rtl::OUString& aStorName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xTargetStorage )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isStreamElement( const ::rtl::OUString& aElementName )
- throw ( ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isStorageElement( const ::rtl::OUString& aElementName )
- throw ( ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeElement( const ::rtl::OUString& aElementName )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL renameElement( const ::rtl::OUString& rEleName, const ::rtl::OUString& rNewName )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL copyElementTo( const ::rtl::OUString& aElementName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
- const ::rtl::OUString& aNewName )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL moveElementTo( const ::rtl::OUString& aElementName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xDest,
- const ::rtl::OUString& rNewName )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- //____________________________________________________________________________________________________
- // XNameAccess
- //____________________________________________________________________________________________________
-
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw ( ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL hasElements()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- //____________________________________________________________________________________________________
- // XComponent
- //____________________________________________________________________________________________________
-
- virtual void SAL_CALL dispose()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- //____________________________________________________________________________________________________
- // XPropertySet
- //____________________________________________________________________________________________________
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
- throw ( ::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName )
- throw ( ::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addPropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
- throw ( ::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removePropertyChangeListener(
- const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
- throw ( ::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addVetoableChangeListener(
- const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw ( ::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw ( ::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- //____________________________________________________________________________________________________
- // XHierarchicalStorageAccess
- //____________________________________________________________________________________________________
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName( const ::rtl::OUString& sStreamPath, ::sal_Int32 nOpenMode )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::packages::WrongPasswordException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName( const ::rtl::OUString& sStreamName, ::sal_Int32 nOpenMode, const ::rtl::OUString& sPassword )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::packages::NoEncryptionException,
- ::com::sun::star::packages::WrongPasswordException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeStreamElementByHierarchicalName( const ::rtl::OUString& sElementPath )
- throw ( ::com::sun::star::embed::InvalidStorageException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::embed::StorageWrappedTargetException,
- ::com::sun::star::uno::RuntimeException );
-};
-
-#endif
-
diff --git a/svtools/source/fsstor/makefile.mk b/svtools/source/fsstor/makefile.mk
deleted file mode 100644
index f55f6747f9e1..000000000000
--- a/svtools/source/fsstor/makefile.mk
+++ /dev/null
@@ -1,70 +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: makefile.mk,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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJNAME=svtools
-TARGET=fsstorage.uno
-LIBTARGET=NO
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : settings.mk
-DLLPRE=
-
-# --- Files -------------------------------------
-
-SLOFILES=\
- $(SLO)$/fsfactory.obj \
- $(SLO)$/fsstorage.obj \
- $(SLO)$/oinputstreamcontainer.obj \
- $(SLO)$/ostreamcontainer.obj
-
-SHL1TARGET= $(TARGET)
-SHL1IMPLIB= i$(TARGET)
-SHL1OBJS= $(SLOFILES)
-SHL1STDLIBS=\
- $(UNOTOOLSLIB) \
- $(TOOLSLIB) \
- $(COMPHELPERLIB) \
- $(UCBHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
-SHL1VERSIONMAP=exports.map
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-DEF1NAME= $(SHL1TARGET)
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/fsstor/oinputstreamcontainer.cxx b/svtools/source/fsstor/oinputstreamcontainer.cxx
deleted file mode 100644
index dc08a7a34602..000000000000
--- a/svtools/source/fsstor/oinputstreamcontainer.cxx
+++ /dev/null
@@ -1,350 +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: oinputstreamcontainer.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include "oinputstreamcontainer.hxx"
-#include <cppuhelper/typeprovider.hxx>
-
-using namespace ::com::sun::star;
-
-//-----------------------------------------------
-OFSInputStreamContainer::OFSInputStreamContainer( const uno::Reference< io::XInputStream >& xStream )
-: m_xInputStream( xStream )
-, m_xSeekable( xStream, uno::UNO_QUERY )
-, m_bSeekable( sal_False )
-, m_bDisposed( sal_False )
-, m_pListenersContainer( NULL )
-{
- m_bSeekable = m_xSeekable.is();
-}
-
-//-----------------------------------------------
-OFSInputStreamContainer::~OFSInputStreamContainer()
-{
- if ( m_pListenersContainer )
- {
- delete m_pListenersContainer;
- m_pListenersContainer = NULL;
- }
-}
-
-//-----------------------------------------------
-uno::Sequence< uno::Type > SAL_CALL OFSInputStreamContainer::getTypes()
- throw ( uno::RuntimeException )
-{
- static ::cppu::OTypeCollection* pTypeCollection = NULL ;
-
- if ( pTypeCollection == NULL )
- {
- ::osl::MutexGuard aGuard( m_aMutex ) ;
-
- if ( pTypeCollection == NULL )
- {
- if ( m_bSeekable )
- {
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType(( const uno::Reference< io::XStream >* )NULL ),
- ::getCppuType(( const uno::Reference< io::XInputStream >* )NULL ),
- ::getCppuType(( const uno::Reference< io::XSeekable >* )NULL ) );
-
- pTypeCollection = &aTypeCollection ;
- }
- else
- {
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType(( const uno::Reference< io::XStream >* )NULL ),
- ::getCppuType(( const uno::Reference< io::XInputStream >* )NULL ) );
-
- pTypeCollection = &aTypeCollection ;
- }
- }
- }
-
- return pTypeCollection->getTypes() ;
-
-}
-
-//-----------------------------------------------
-uno::Any SAL_CALL OFSInputStreamContainer::queryInterface( const uno::Type& rType )
- throw( uno::RuntimeException )
-{
- // Attention:
- // Don't use mutex or guard in this method!!! Is a method of XInterface.
-
- uno::Any aReturn;
- if ( m_bSeekable )
- aReturn = uno::Any( ::cppu::queryInterface( rType,
- static_cast< io::XStream* >( this ),
- static_cast< io::XInputStream* >( this ),
- static_cast< io::XSeekable* >( this ) ) );
- else
- aReturn = uno::Any( ::cppu::queryInterface( rType,
- static_cast< io::XStream* >( this ),
- static_cast< io::XInputStream* >( this ) ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
-
- return ::cppu::OWeakObject::queryInterface( rType ) ;
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::acquire()
- throw()
-{
- ::cppu::OWeakObject::acquire();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::release()
- throw()
-{
- ::cppu::OWeakObject::release();
-}
-
-//-----------------------------------------------
-sal_Int32 SAL_CALL OFSInputStreamContainer::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw ( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- return m_xInputStream->readBytes( aData, nBytesToRead );
-}
-
-//-----------------------------------------------
-sal_Int32 SAL_CALL OFSInputStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw ( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead );
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::skipBytes( sal_Int32 nBytesToSkip )
- throw ( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- m_xInputStream->skipBytes( nBytesToSkip );
-}
-
-//-----------------------------------------------
-sal_Int32 SAL_CALL OFSInputStreamContainer::available( )
- throw ( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- return m_xInputStream->available();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::closeInput( )
- throw ( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- dispose();
-}
-
-//-----------------------------------------------
-uno::Reference< io::XInputStream > SAL_CALL OFSInputStreamContainer::getInputStream()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- return uno::Reference< io::XInputStream >();
-
- return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY );
-}
-
-//-----------------------------------------------
-uno::Reference< io::XOutputStream > SAL_CALL OFSInputStreamContainer::getOutputStream()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- return uno::Reference< io::XOutputStream >();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::seek( sal_Int64 location )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- m_xSeekable->seek( location );
-}
-
-//-----------------------------------------------
-sal_Int64 SAL_CALL OFSInputStreamContainer::getPosition()
- throw ( io::IOException,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- return m_xSeekable->getPosition();
-}
-
-//-----------------------------------------------
-sal_Int64 SAL_CALL OFSInputStreamContainer::getLength()
- throw ( io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- return m_xSeekable->getLength();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::dispose( )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- m_xInputStream->closeInput();
-
- if ( m_pListenersContainer )
- {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) );
- m_pListenersContainer->disposeAndClear( aSource );
- }
-
- m_bDisposed = sal_True;
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_pListenersContainer )
- m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex );
-
- m_pListenersContainer->addInterface( xListener );
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSInputStreamContainer::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( m_pListenersContainer )
- m_pListenersContainer->removeInterface( xListener );
-}
-
-
-
diff --git a/svtools/source/fsstor/oinputstreamcontainer.hxx b/svtools/source/fsstor/oinputstreamcontainer.hxx
deleted file mode 100644
index 308f4283b430..000000000000
--- a/svtools/source/fsstor/oinputstreamcontainer.hxx
+++ /dev/null
@@ -1,99 +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: oinputstreamcontainer.hxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _OINPUTSTREAMCONTAINER_HXX_
-#define _OINPUTSTREAMCONTAINER_HXX_
-
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/embed/XExtendedStorageStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-
-
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/interfacecontainer.h>
-
-#include <osl/mutex.hxx>
-
-class OFSInputStreamContainer : public cppu::WeakImplHelper2 < ::com::sun::star::io::XInputStream
- ,::com::sun::star::embed::XExtendedStorageStream >
- , public ::com::sun::star::io::XSeekable
-{
-protected:
- ::osl::Mutex m_aMutex;
-
- ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream > m_xInputStream;
- ::com::sun::star::uno::Reference < ::com::sun::star::io::XSeekable > m_xSeekable;
-
- sal_Bool m_bSeekable;
-
- sal_Bool m_bDisposed;
-
- ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
-
-public:
- OFSInputStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream );
-
- virtual ~OFSInputStreamContainer();
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType ) throw( ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- //XStream
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException);
-
- //XSeekable
- virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- //XComponent
- virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
diff --git a/svtools/source/fsstor/ostreamcontainer.cxx b/svtools/source/fsstor/ostreamcontainer.cxx
deleted file mode 100644
index d801f49532b2..000000000000
--- a/svtools/source/fsstor/ostreamcontainer.cxx
+++ /dev/null
@@ -1,570 +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: ostreamcontainer.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include "ostreamcontainer.hxx"
-
-
-using namespace ::com::sun::star;
-
-//-----------------------------------------------
-OFSStreamContainer::OFSStreamContainer( const uno::Reference < io::XStream >& xStream )
-: m_bDisposed( sal_False )
-, m_bInputClosed( sal_False )
-, m_bOutputClosed( sal_False )
-, m_pListenersContainer( NULL )
-, m_pTypeCollection( NULL )
-{
- try
- {
- m_xStream = xStream;
- if ( !m_xStream.is() )
- throw uno::RuntimeException();
-
- m_xSeekable = uno::Reference< io::XSeekable >( xStream, uno::UNO_QUERY );
- m_xInputStream = xStream->getInputStream();
- m_xOutputStream = xStream->getOutputStream();
- m_xTruncate = uno::Reference< io::XTruncate >( m_xOutputStream, uno::UNO_QUERY );
- m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >( m_xOutputStream, uno::UNO_QUERY );
- }
- catch( uno::Exception& )
- {
- m_xStream = uno::Reference< io::XStream >();
- m_xSeekable = uno::Reference< io::XSeekable >();
- m_xInputStream = uno::Reference< io::XInputStream >();
- m_xOutputStream = uno::Reference< io::XOutputStream >();
- m_xTruncate = uno::Reference< io::XTruncate >();
- m_xAsyncOutputMonitor = uno::Reference< io::XAsyncOutputMonitor >();
- }
-}
-
-//-----------------------------------------------
-OFSStreamContainer::~OFSStreamContainer()
-{
- if ( m_pListenersContainer )
- {
- delete m_pListenersContainer;
- m_pListenersContainer = NULL;
- }
-}
-
-// XInterface
-//-----------------------------------------------
-uno::Any SAL_CALL OFSStreamContainer::queryInterface( const uno::Type& rType )
- throw( uno::RuntimeException )
-{
- uno::Any aReturn;
-
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<lang::XTypeProvider*> ( this )
- , static_cast<io::XStream*> ( this )
- , static_cast<embed::XExtendedStorageStream*> ( this )
- , static_cast<lang::XComponent*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
-
- if ( m_xSeekable.is() )
- {
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<io::XSeekable*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
- }
-
- if ( m_xInputStream.is() )
- {
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<io::XInputStream*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
- }
- if ( m_xOutputStream.is() )
- {
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<io::XOutputStream*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
- }
- if ( m_xTruncate.is() )
- {
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<io::XTruncate*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
- }
- if ( m_xAsyncOutputMonitor.is() )
- {
- aReturn <<= ::cppu::queryInterface
- ( rType
- , static_cast<io::XAsyncOutputMonitor*> ( this ) );
-
- if ( aReturn.hasValue() == sal_True )
- return aReturn ;
- }
-
- return OWeakObject::queryInterface( rType );
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::acquire()
- throw()
-{
- OWeakObject::acquire();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::release()
- throw()
-{
- OWeakObject::release();
-}
-
-// XTypeProvider
-//-----------------------------------------------
-uno::Sequence< uno::Type > SAL_CALL OFSStreamContainer::getTypes()
- throw( uno::RuntimeException )
-{
- if ( m_pTypeCollection == NULL )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pTypeCollection == NULL )
- {
- ::cppu::OTypeCollection aTypeCollection
- ( ::getCppuType( ( const uno::Reference< lang::XTypeProvider >* )NULL )
- , ::getCppuType( ( const uno::Reference< embed::XExtendedStorageStream >* )NULL ) );
-
- if ( m_xSeekable.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( ::getCppuType( ( const uno::Reference< io::XSeekable >* )NULL ),
- aTypeCollection.getTypes() );
- if ( m_xInputStream.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( ::getCppuType( ( const uno::Reference< io::XInputStream >* )NULL ),
- aTypeCollection.getTypes() );
-
- if ( m_xOutputStream.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( ::getCppuType( ( const uno::Reference< io::XOutputStream >* )NULL ),
- aTypeCollection.getTypes() );
- if ( m_xTruncate.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( ::getCppuType( ( const uno::Reference< io::XTruncate >* )NULL ),
- aTypeCollection.getTypes() );
- if ( m_xAsyncOutputMonitor.is() )
- aTypeCollection = ::cppu::OTypeCollection
- ( ::getCppuType( ( const uno::Reference< io::XAsyncOutputMonitor >* )NULL ),
- aTypeCollection.getTypes() );
-
- m_pTypeCollection = new ::cppu::OTypeCollection( aTypeCollection );
- }
- }
- return m_pTypeCollection->getTypes() ;
-}
-
-//-----------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL OFSStreamContainer::getImplementationId()
- throw( uno::RuntimeException )
-{
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( pID == NULL )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
-
- if ( pID == NULL )
- {
- static ::cppu::OImplementationId aID( sal_False ) ;
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-}
-
-// XStream
-//-----------------------------------------------
-uno::Reference< io::XInputStream > SAL_CALL OFSStreamContainer::getInputStream()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() )
- throw uno::RuntimeException();
-
- if ( m_xInputStream.is() )
- return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ) );
-
- return uno::Reference< io::XInputStream >();
-}
-
-//-----------------------------------------------
-uno::Reference< io::XOutputStream > SAL_CALL OFSStreamContainer::getOutputStream()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() )
- throw uno::RuntimeException();
-
- if ( m_xOutputStream.is() )
- return uno::Reference< io::XOutputStream >( static_cast< io::XOutputStream* >( this ) );
-
- return uno::Reference< io::XOutputStream >();
-}
-
-// XComponent
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::dispose()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() )
- throw uno::RuntimeException();
-
- if ( m_xInputStream.is() && !m_bInputClosed )
- {
- m_xInputStream->closeInput();
- m_bInputClosed = sal_True;
- }
-
- if ( m_xOutputStream.is() && !m_bOutputClosed )
- {
- m_xOutputStream->closeOutput();
- m_bOutputClosed = sal_True;
- }
-
- if ( m_pListenersContainer )
- {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>( this ) );
- m_pListenersContainer->disposeAndClear( aSource );
- }
-
- m_bDisposed = sal_True;
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_pListenersContainer )
- m_pListenersContainer = new ::cppu::OInterfaceContainerHelper( m_aMutex );
-
- m_pListenersContainer->addInterface( xListener );
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( m_pListenersContainer )
- m_pListenersContainer->removeInterface( xListener );
-}
-
-
-// XSeekable
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::seek( sal_Int64 location )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- m_xSeekable->seek( location );
-}
-
-//-----------------------------------------------
-sal_Int64 SAL_CALL OFSStreamContainer::getPosition()
- throw ( io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- return m_xSeekable->getPosition();
-}
-
-//-----------------------------------------------
-sal_Int64 SAL_CALL OFSStreamContainer::getLength()
- throw ( io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- return m_xSeekable->getLength();
-}
-
-
-// XInputStream
-//-----------------------------------------------
-sal_Int32 SAL_CALL OFSStreamContainer::readBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- return m_xInputStream->readBytes( aData, nBytesToRead );
-}
-
-//-----------------------------------------------
-sal_Int32 SAL_CALL OFSStreamContainer::readSomeBytes( uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- return m_xInputStream->readSomeBytes( aData, nMaxBytesToRead );
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::skipBytes( sal_Int32 nBytesToSkip )
- throw( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- m_xInputStream->skipBytes( nBytesToSkip );
-}
-
-//-----------------------------------------------
-sal_Int32 SAL_CALL OFSStreamContainer::available()
- throw( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- return m_xInputStream->available();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::closeInput()
- throw( io::NotConnectedException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xInputStream.is() )
- throw uno::RuntimeException();
-
- if ( m_xInputStream.is() )
- {
- m_xInputStream->closeInput();
- m_bInputClosed = sal_True;
- }
-
- if ( m_bOutputClosed )
- dispose();
-}
-
-// XOutputStream
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::writeBytes( const uno::Sequence< sal_Int8 >& aData )
- throw ( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xOutputStream.is() )
- throw uno::RuntimeException();
-
- return m_xOutputStream->writeBytes( aData );
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::flush()
- throw ( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xOutputStream.is() )
- throw uno::RuntimeException();
-
- return m_xOutputStream->flush();
-}
-
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::closeOutput()
- throw ( io::NotConnectedException,
- io::BufferSizeExceededException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xOutputStream.is() )
- throw uno::RuntimeException();
-
- if ( m_xOutputStream.is() )
- {
- m_xOutputStream->closeOutput();
- m_bOutputClosed = sal_True;
- }
-
- if ( m_bInputClosed )
- dispose();
-}
-
-
-// XTruncate
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::truncate()
- throw ( io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xTruncate.is() )
- throw uno::RuntimeException();
-
- m_xTruncate->truncate();
-}
-
-
-// XAsyncOutputMonitor
-//-----------------------------------------------
-void SAL_CALL OFSStreamContainer::waitForCompletion()
- throw ( io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( !m_xStream.is() || !m_xAsyncOutputMonitor.is() )
- throw uno::RuntimeException();
-
- m_xAsyncOutputMonitor->waitForCompletion();
-}
-
-
-
diff --git a/svtools/source/fsstor/ostreamcontainer.hxx b/svtools/source/fsstor/ostreamcontainer.hxx
deleted file mode 100644
index 6198587c3d35..000000000000
--- a/svtools/source/fsstor/ostreamcontainer.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: ostreamcontainer.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _OSTREAMCONTAINER_HXX_
-#define _OSTREAMCONTAINER_HXX_
-
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
-#include <com/sun/star/embed/XExtendedStorageStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include "com/sun/star/io/XAsyncOutputMonitor.hpp"
-#include <cppuhelper/weak.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <osl/mutex.hxx>
-
-class OFSStreamContainer : public cppu::OWeakObject,
- public ::com::sun::star::lang::XTypeProvider,
- public ::com::sun::star::embed::XExtendedStorageStream,
- public ::com::sun::star::io::XSeekable,
- public ::com::sun::star::io::XInputStream,
- public ::com::sun::star::io::XOutputStream,
- public ::com::sun::star::io::XTruncate,
- public ::com::sun::star::io::XAsyncOutputMonitor
-{
- ::osl::Mutex m_aMutex;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xStream;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xSeekable;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > m_xOutputStream;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XTruncate > m_xTruncate;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XAsyncOutputMonitor > m_xAsyncOutputMonitor;
-
- sal_Bool m_bDisposed;
- sal_Bool m_bInputClosed;
- sal_Bool m_bOutputClosed;
-
- ::cppu::OInterfaceContainerHelper* m_pListenersContainer; // list of listeners
- ::cppu::OTypeCollection* m_pTypeCollection;
-
-public:
- OFSStreamContainer( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream );
- virtual ~OFSStreamContainer();
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
- throw( ::com::sun::star::uno::RuntimeException );
- virtual void SAL_CALL acquire() throw();
- virtual void SAL_CALL release() throw();
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
- throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
- throw( ::com::sun::star::uno::RuntimeException );
-
- // XStream
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getInputStream( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > SAL_CALL getOutputStream( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XSeekable
- virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XInputStream
- virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL available( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeInput( )
- throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XOutputStream
- virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL flush( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL closeOutput( ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XTruncate
- virtual void SAL_CALL truncate() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XAsyncOutputMonitor
- virtual void SAL_CALL waitForCompletion( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
diff --git a/svtools/source/inc/hatchwindowfactory.hxx b/svtools/source/hatchwindow/hatchwindowfactory.hxx
index 72eaa58bb16d..72eaa58bb16d 100644
--- a/svtools/source/inc/hatchwindowfactory.hxx
+++ b/svtools/source/hatchwindow/hatchwindowfactory.hxx
diff --git a/svtools/source/inc/configitems/historyoptions_const.hxx b/svtools/source/inc/configitems/historyoptions_const.hxx
deleted file mode 100644
index c9148aeb26f8..000000000000
--- a/svtools/source/inc/configitems/historyoptions_const.hxx
+++ /dev/null
@@ -1,63 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: historyoptions_const.hxx,v $
- *
- * $Revision: 1.1.4.2 $
- *
- * last change: $Author: as $ $Date: 2008/03/19 11:17:49 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifndef INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
-#define INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
-
-#include <rtl/ustring.hxx>
-
-namespace
-{
- static const ::rtl::OUString s_sCommonHistory = ::rtl::OUString::createFromAscii("org.openoffice.Office.Common/History");
- static const ::rtl::OUString s_sHistories = ::rtl::OUString::createFromAscii("org.openoffice.Office.Histories/Histories");
- static const ::rtl::OUString s_sPickListSize = ::rtl::OUString::createFromAscii("PickListSize");
- static const ::rtl::OUString s_sURLHistorySize = ::rtl::OUString::createFromAscii("Size");
- static const ::rtl::OUString s_sHelpBookmarksSize = ::rtl::OUString::createFromAscii("HelpBookmarkSize");
- static const ::rtl::OUString s_sPickList = ::rtl::OUString::createFromAscii("PickList");
- static const ::rtl::OUString s_sURLHistory = ::rtl::OUString::createFromAscii("URLHistory");
- static const ::rtl::OUString s_sHelpBookmarks = ::rtl::OUString::createFromAscii("HelpBookmarks");
- static const ::rtl::OUString s_sItemList = ::rtl::OUString::createFromAscii("ItemList");
- static const ::rtl::OUString s_sOrderList = ::rtl::OUString::createFromAscii("OrderList");
- static const ::rtl::OUString s_sHistoryItemRef = ::rtl::OUString::createFromAscii("HistoryItemRef");
- static const ::rtl::OUString s_sURL = ::rtl::OUString::createFromAscii("URL");
- static const ::rtl::OUString s_sFilter = ::rtl::OUString::createFromAscii("Filter");
- static const ::rtl::OUString s_sTitle = ::rtl::OUString::createFromAscii("Title");
- static const ::rtl::OUString s_sPassword = ::rtl::OUString::createFromAscii("Password");
-}
-
-#endif // INCLUDE_CONFIGITEMS_HISTORYOPTIONS_CONST_HXX
diff --git a/svtools/source/inc/configitems/useroptions_const.hxx b/svtools/source/inc/configitems/useroptions_const.hxx
deleted file mode 100644
index 4dbd6da8bba3..000000000000
--- a/svtools/source/inc/configitems/useroptions_const.hxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/*************************************************************************
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: useroptions_const.hxx,v $
- *
- * $Revision: 1.1.4.2 $
- *
- * last change: $Author: as $ $Date: 2008/03/19 11:17:50 $
- *
- * The Contents of this file are made available subject to
- * the terms of GNU Lesser General Public License Version 2.1.
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2005 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- ************************************************************************/
-
-#ifndef INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
-#define INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
-
-#include <rtl/ustring.hxx>
-
-namespace
-{
- static const ::rtl::OUString s_sData = ::rtl::OUString::createFromAscii("org.openoffice.UserProfile/Data");
- static const ::rtl::OUString s_so = ::rtl::OUString::createFromAscii("o"); // USER_OPT_COMPANY
- static const ::rtl::OUString s_sgivenname = ::rtl::OUString::createFromAscii("givenname"); // USER_OPT_FIRSTNAME
- static const ::rtl::OUString s_ssn = ::rtl::OUString::createFromAscii("sn"); // USER_OPT_LASTNAME
- static const ::rtl::OUString s_sinitials = ::rtl::OUString::createFromAscii("initials"); // USER_OPT_ID
- static const ::rtl::OUString s_sstreet = ::rtl::OUString::createFromAscii("street"); // USER_OPT_STREET
- static const ::rtl::OUString s_sl = ::rtl::OUString::createFromAscii("l"); // USER_OPT_CITY
- static const ::rtl::OUString s_sst = ::rtl::OUString::createFromAscii("st"); // USER_OPT_STATE
- static const ::rtl::OUString s_spostalcode = ::rtl::OUString::createFromAscii("postalcode"); // USER_OPT_ZIP
- static const ::rtl::OUString s_sc = ::rtl::OUString::createFromAscii("c"); // USER_OPT_COUNTRY
- static const ::rtl::OUString s_stitle = ::rtl::OUString::createFromAscii("title"); // USER_OPT_TITLE
- static const ::rtl::OUString s_sposition = ::rtl::OUString::createFromAscii("position"); // USER_OPT_POSITION
- static const ::rtl::OUString s_shomephone = ::rtl::OUString::createFromAscii("homephone"); // USER_OPT_TELEPHONEHOME
- static const ::rtl::OUString s_stelephonenumber = ::rtl::OUString::createFromAscii("telephonenumber"); // USER_OPT_TELEPHONEWORK
- static const ::rtl::OUString s_sfacsimiletelephonenumber = ::rtl::OUString::createFromAscii("facsimiletelephonenumber"); // USER_OPT_FAX
- static const ::rtl::OUString s_smail = ::rtl::OUString::createFromAscii("mail"); // USER_OPT_EMAIL
- static const ::rtl::OUString s_scustomernumber = ::rtl::OUString::createFromAscii("customernumber"); // USER_OPT_CUSTOMERNUMBER
- static const ::rtl::OUString s_sfathersname = ::rtl::OUString::createFromAscii("fathersname"); // USER_OPT_FATHERSNAME
- static const ::rtl::OUString s_sapartment = ::rtl::OUString::createFromAscii("apartment"); // USER_OPT_APARTMENT
-}
-
-#endif // INCLUDE_CONFIGITEMS_USEROPTIONS_CONST_HXX
diff --git a/svtools/source/misc/config.src b/svtools/source/inc/filectrl.hrc
index e11aeb86f402..13fb89afd382 100644
--- a/svtools/source/misc/config.src
+++ b/svtools/source/inc/filectrl.hrc
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: config.src,v $
- * $Revision: 1.29 $
+ * $RCSfile: filectrl.hrc,v $
+ * $Revision: 1.3 $
*
* This file is part of OpenOffice.org.
*
@@ -28,39 +28,10 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
-
-String STR_WARNING_ITEM
-{
- Text [ en-US ] = "Incorrect Version!" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#ifndef _SV_FILECTRL_HRC
+#define _SV_FILECTRL_HRC
+#define STR_FILECTRL_BUTTONTEXT 333 // ID-Range?!
+#endif
diff --git a/svtools/source/inc/fsfactory.hxx b/svtools/source/inc/fsfactory.hxx
deleted file mode 100644
index 5954ecebabc2..000000000000
--- a/svtools/source/inc/fsfactory.hxx
+++ /dev/null
@@ -1,75 +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: fsfactory.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.
- *
- ************************************************************************/
-
-#ifndef __FSFACTORY_HXX_
-#define __FSACTORY_HXX_
-
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-
-class FSStorage;
-
-class FSStorageFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
-public:
- FSStorageFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XSingleServiceFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
diff --git a/svtools/source/inc/gifread.hxx b/svtools/source/inc/gifread.hxx
new file mode 100644
index 000000000000..8a9d299930c9
--- /dev/null
+++ b/svtools/source/inc/gifread.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * 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: gifread.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 _GIFREAD_HXX
+#define _GIFREAD_HXX
+
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+
+#ifdef _GIFPRIVATE
+
+// ---------
+// - Enums -
+// ---------
+
+enum GIFAction
+{
+ GLOBAL_HEADER_READING,
+ MARKER_READING,
+ EXTENSION_READING,
+ LOCAL_HEADER_READING,
+ FIRST_BLOCK_READING,
+ NEXT_BLOCK_READING,
+ ABORT_READING,
+ END_READING
+};
+
+// ------------------------------------------------------------------------
+
+enum ReadState
+{
+ GIFREAD_OK,
+ GIFREAD_ERROR,
+ GIFREAD_NEED_MORE
+};
+
+// -------------
+// - GIFReader -
+// -------------
+
+class GIFLZWDecompressor;
+
+class SvStream;
+
+class GIFReader : public GraphicReader
+{
+ Graphic aImGraphic;
+ Animation aAnimation;
+ Bitmap aBmp8;
+ Bitmap aBmp1;
+ BitmapPalette aGPalette;
+ BitmapPalette aLPalette;
+ SvStream& rIStm;
+ void* pCallerData;
+ HPBYTE pSrcBuf;
+ GIFLZWDecompressor* pDecomp;
+ BitmapWriteAccess* pAcc8;
+ BitmapWriteAccess* pAcc1;
+ long nYAcc;
+ long nLastPos;
+ sal_uInt32 nLogWidth100;
+ sal_uInt32 nLogHeight100;
+ USHORT nTimer;
+ USHORT nGlobalWidth; // maximale Bildbreite aus Header
+ USHORT nGlobalHeight; // maximale Bildhoehe aus Header
+ USHORT nImageWidth; // maximale Bildbreite aus Header
+ USHORT nImageHeight; // maximale Bildhoehe aus Header
+ USHORT nImagePosX;
+ USHORT nImagePosY;
+ USHORT nImageX; // maximale Bildbreite aus Header
+ USHORT nImageY; // maximale Bildhoehe aus Header
+ USHORT nLastImageY;
+ USHORT nLastInterCount;
+ USHORT nLoops;
+ GIFAction eActAction;
+ BOOL bStatus;
+ BOOL bGCTransparent; // Ob das Bild Transparent ist, wenn ja:
+ BOOL bInterlaced;
+ BOOL bOverreadBlock;
+ BOOL bImGraphicReady;
+ BOOL bGlobalPalette;
+ BYTE nBackgroundColor; // Hintergrundfarbe
+ BYTE nGCTransparentIndex; // Pixel von diesem Index sind durchsichtig
+ BYTE nGCDisposalMethod; // 'Disposal Method' (siehe GIF-Doku)
+ BYTE cTransIndex1;
+ BYTE cNonTransIndex1;
+
+ void ReadPaletteEntries( BitmapPalette* pPal, ULONG nCount );
+ void ClearImageExtensions();
+ BOOL CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal, BOOL bWatchForBackgroundColor );
+ BOOL ReadGlobalHeader();
+ BOOL ReadExtension();
+ BOOL ReadLocalHeader();
+ ULONG ReadNextBlock();
+ void FillImages( HPBYTE pBytes, ULONG nCount );
+ void CreateNewBitmaps();
+ BOOL ProcessGIF();
+
+public:
+
+ ReadState ReadGIF( Graphic& rGraphic );
+ const Graphic& GetIntermediateGraphic();
+
+ GIFReader( SvStream& rStm );
+ virtual ~GIFReader();
+};
+
+#endif // _GIFPRIVATE
+
+// -------------
+// - ImportGIF -
+// -------------
+
+ BOOL ImportGIF( SvStream& rStream, Graphic& rGraphic );
+
+#endif // _GIFREAD_HXX
diff --git a/svtools/source/inc/gradwrap.hxx b/svtools/source/inc/gradwrap.hxx
new file mode 100644
index 000000000000..28c9d8db1fcd
--- /dev/null
+++ b/svtools/source/inc/gradwrap.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * 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: gradwrap.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SVGEN_HXX
+#include <svgen.hxx>
+#endif
+
+
+/******************************************************************************
+|*
+|* class GradientWrapper
+|*
+|* Ersterstellung: KA 24.11.95
+|* letzte Aenderung: KA 24.11.95
+|*
+|* Zeck: dient beim MetaFile-Export dazu, die eigentliche Berechungs-
+|* funktionalitaet zu kapseln. Das Schreiben der Records fuer
+|* die unterschiedlichen File-Formate geschieht ueber LinkHandler.
+|*
+|* Klassen, die diesen Wrapper benutzen, muessen drei Linkhandler
+|* zur Verfuegung stellen, die im Ctor uebergeben werden:
+|*
+|* 1. Linkhandler zum Schreiben eines Records fuer Polygonausgabe
+|* 2. Linkhandler zum Schreiben eines Records fuer PolyPolygonausgabe
+|* 3. Linkhandler zum Schreiben eines Records fuer Setzen der Brush
+|*
+\******************************************************************************/
+
+
+class GradientWrapper
+{
+ Link aDrawPolyRecordHdl;
+ Link aDrawPolyPolyRecordHdl;
+ Link aSetFillInBrushRecordHdl;
+
+ GradientWrapper() {};
+
+
+public:
+ GradientWrapper(const Link& rDrawPolyRecordHdl,
+ const Link& rDrawPolyPolyRecordHdl,
+ const Link& rSetFillInBrushHdl);
+ ~GradientWrapper();
+
+
+ void WriteLinearGradient(const Rectangle& rRect,
+ const Gradient& rGradient);
+ void WriteRadialGradient(const Rectangle& rRect,
+ const Gradient& rGradient);
+ void WriteRectGradient(const Rectangle& rRect,
+ const Gradient& rGradient);
+};
diff --git a/svtools/source/inc/iodlg.hrc b/svtools/source/inc/iodlg.hrc
new file mode 100644
index 000000000000..9c41e06a2b6c
--- /dev/null
+++ b/svtools/source/inc/iodlg.hrc
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * 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: iodlg.hrc,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_IODLGIMPL_HRC
+#define _SVTOOLS_IODLGIMPL_HRC
+
+#ifndef _SVTOOLS_HRC
+#include <svl/svtools.hrc>
+#endif
+
+// ModalDialog DLG_SVT_EXPLORERFILE
+
+#define FT_EXPLORERFILE_CURRENTPATH 10
+#define BTN_EXPLORERFILE_NEWFOLDER 11
+#define BTN_EXPLORERFILE_LISTVIEW 12
+#define BTN_EXPLORERFILE_DETAILSVIEW 13
+#define BTN_EXPLORERFILE_UP 14
+#define BTN_EXPLORERFILE_STANDARD 15
+#define BTN_EXPLORERFILE_OPEN 16
+#define BTN_EXPLORERFILE_CANCEL 17
+#define BTN_EXPLORERFILE_HELP 18
+
+#define IMG_FILEDLG_BTN_UP 10
+#define IMG_FILEDLG_BTN_STD 11
+#define IMG_FILEDLG_CREATEFOLDER 15
+
+#define CTL_EXPLORERFILE_FILELIST 20
+
+#define FT_EXPLORERFILE_FILENAME 30
+#define ED_EXPLORERFILE_FILENAME 31
+#define FT_EXPLORERFILE_SHARED_LISTBOX 32
+#define LB_EXPLORERFILE_SHARED_LISTBOX 33
+#define FT_EXPLORERFILE_FILETYPE 34
+#define LB_EXPLORERFILE_FILETYPE 35
+
+#define CB_EXPLORERFILE_READONLY 40
+#define CB_EXPLORERFILE_PASSWORD 41
+#define CB_AUTO_EXTENSION 42
+#define CB_OPTIONS 43
+
+// -----------------------------------------------
+
+#define STR_EXPLORERFILE_OPEN 1
+#define STR_EXPLORERFILE_SAVE 2
+#define STR_EXPLORERFILE_BUTTONSAVE 3
+#define STR_PATHNAME 4
+#define STR_PATHSELECT 5
+#define STR_BUTTONSELECT 6
+#define STR_ACTUALVERSION 7
+
+// DLG_SVT_QUERYFOLDERNAME -----------------------
+
+#define FT_SVT_QUERYFOLDERNAME_DLG_NAME 10
+#define ED_SVT_QUERYFOLDERNAME_DLG_NAME 11
+#define FL_SVT_QUERYFOLDERNAME_DLG_NAME 12
+#define BT_SVT_QUERYFOLDERNAME_DLG_OK 13
+#define BT_SVT_QUERYFOLDERNAME_DLG_CANCEL 14
+#define BT_SVT_QUERYFOLDERNAME_DLG_HELP 15
+
+// -----------------------------------------------
+
+#define SID_SFX_START 5000
+#define SID_OPENURL (SID_SFX_START + 596)
+
+#define HID_FILEDLG_STANDARD (HID_SFX_START + 27)
+#define HID_FILEDLG_MANAGER (HID_SFX_START + 28)
+#define HID_FILEDLG_URL (HID_SFX_START + 29)
+#define HID_FILEDLG_USE_PASSWD (HID_SFX_START + 31)
+#define HID_FILEDLG_READ_ONLY (HID_SFX_START + 32)
+
+#define HID_FILEDLG_AUTOCOMPLETEBOX (HID_SFX_START + 218)
+#define HID_FILEDLG_SAVE_BTN (HID_SFX_START + 219)
+#define HID_FILEDLG_SAVE_FILENAME (HID_SFX_START + 220)
+#define HID_FILEDLG_SAVE_FILETYPE (HID_SFX_START + 221)
+#define HID_FILEDLG_INSERT_BTN (HID_SFX_START + 222)
+#define HID_FILEDLG_PATH_BTN (HID_SFX_START + 223)
+#define HID_FILEDLG_PATH_FILENAME (HID_SFX_START + 224)
+#define HID_FILEDLG_FOLDER_BTN (HID_SFX_START + 225)
+#define HID_FILEDLG_FOLDER_FILENAME (HID_SFX_START + 226)
+#define HID_FILEDLG_SRCHFOLDER_BTN (HID_SFX_START + 227)
+
+#endif
+
diff --git a/svtools/source/inc/jpeg.hxx b/svtools/source/inc/jpeg.hxx
new file mode 100644
index 000000000000..d8de26c31009
--- /dev/null
+++ b/svtools/source/inc/jpeg.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * 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: jpeg.hxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _JPEG_HXX
+#define _JPEG_HXX
+
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#include <svtools/fltcall.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/task/XStatusIndicator.hpp>
+
+#ifdef _JPEGPRIVATE
+
+// --------
+// - Enum -
+// --------
+
+enum ReadState
+{
+ JPEGREAD_OK,
+ JPEGREAD_ERROR,
+ JPEGREAD_NEED_MORE
+};
+
+// --------------
+// - JPEGReader -
+// --------------
+
+class JPEGReader : public GraphicReader
+{
+ SvStream& rIStm;
+ Bitmap aBmp;
+ Bitmap aBmp1;
+ BitmapWriteAccess* pAcc;
+ BitmapWriteAccess* pAcc1;
+ void* pBuffer;
+ long nLastPos;
+ long nFormerPos;
+ long nLastLines;
+ sal_Bool bSetLogSize;
+
+ Graphic CreateIntermediateGraphic( const Bitmap& rBitmap, long nLines );
+ void FillBitmap();
+
+public:
+
+ void* CreateBitmap( void* JPEGCreateBitmapParam );
+
+public:
+
+
+
+ JPEGReader( SvStream& rStm, void* pCallData, sal_Bool bSetLogSize );
+ virtual ~JPEGReader();
+
+
+ ReadState Read( Graphic& rGraphic );
+};
+
+// --------------
+// - JPEGWriter -
+// --------------
+
+class JPEGWriter
+{
+ SvStream& rOStm;
+ Bitmap aBmp;
+ BitmapReadAccess* pAcc;
+ BYTE* pBuffer;
+ BOOL bNative;
+
+ sal_Bool bGreys;
+ sal_Int32 nQuality;
+
+ com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator > xStatusIndicator;
+
+public:
+
+ void* GetScanline( long nY );
+
+ JPEGWriter( SvStream& rOStm, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+ ~JPEGWriter() {};
+
+ BOOL Write( const Graphic& rGraphic );
+};
+
+#endif // _JPEGPRIVATE
+
+// ---------------------
+// - Import/ExportJPEG -
+// ---------------------
+
+BOOL ImportJPEG( SvStream& rStream, Graphic& rGraphic, void* pCallerData, sal_Int32 nImportFlags );
+
+BOOL ExportJPEG( SvStream& rStream, const Graphic& rGraphic, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >* pFilterData );
+
+#endif // _JPEG_HXX
diff --git a/svtools/source/misc/iniman.src b/svtools/source/inc/msgrd.hxx
index afc129318653..381ae71c7b83 100644
--- a/svtools/source/misc/iniman.src
+++ b/svtools/source/inc/msgrd.hxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: iniman.src,v $
- * $Revision: 1.27 $
+ * $RCSfile: msgrd.hxx,v $
+ * $Revision: 1.3 $
*
* This file is part of OpenOffice.org.
*
@@ -28,41 +28,13 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
-
-ErrorBox ERRBOX_CHECK_PLZ
-{
- BUTTONS = WB_OK ;
- Message [ en-US ] = "The ZIP code specified is invalid.\nA ZIP code should begin with a number (or in some cases a letter) and\ncan only contain numbers, letters, spaces and dashes.";
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+#ifndef _MSGRD_HXX
+#define _MSGRD_HXX
+BOOL ConvertMSGToGDIMetaFile( SvStream & rMSG, GDIMetaFile & rGDIMetaFile,
+ BOOL(*pCallback)(void *, USHORT), void * pCallerData,
+ ULONG nMinPercent, ULONG nMaxPercent);
+#endif // _MSGRD_HXX
diff --git a/svtools/source/config/options.cxx b/svtools/source/inc/msgwr.hxx
index b418b90530a3..c347938fd34d 100644
--- a/svtools/source/config/options.cxx
+++ b/svtools/source/inc/msgwr.hxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: options.cxx,v $
- * $Revision: 1.5 $
+ * $RCSfile: msgwr.hxx,v $
+ * $Revision: 1.3 $
*
* This file is part of OpenOffice.org.
*
@@ -28,15 +28,14 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
+#ifndef _MSGWR_HXX
+#define _MSGWR_HXX
-#include "sal/config.h"
-#include <svtools/options.hxx>
+BOOL ConvertGraphicToMSG(const Graphic & rGraphic, SvStream & rTargetStream,
+ BOOL(*pCallback)(void *, USHORT), void * pCallerData,
+ ULONG nMinPercent, ULONG nMaxPercent);
-using svt::detail::Options;
-Options::Options() {}
+#endif // _MSGWR_HXX
-Options::~Options() {}
diff --git a/svtools/source/inc/passwordcontainer.hxx b/svtools/source/inc/passwordcontainer.hxx
deleted file mode 100644
index a067672f3cf6..000000000000
--- a/svtools/source/inc/passwordcontainer.hxx
+++ /dev/null
@@ -1,429 +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: passwordcontainer.hxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_COMPHELPER_PASSWORDCONTAINER_HXX
-#define INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX
-
-#include <list>
-#include <vector>
-#include <map>
-#include <com/sun/star/task/XPasswordContainer.hpp>
-#include <com/sun/star/task/XUrlContainer.hpp>
-#include <com/sun/star/task/PasswordRequestMode.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/task/XMasterPasswordHandling2.hpp>
-#include <cppuhelper/implbase5.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <cppuhelper/factory.hxx>
-
-#include <tools/stream.hxx>
-#include <unotools/configitem.hxx>
-#include <ucbhelper/interactionrequest.hxx>
-
-#include <rtl/ref.hxx>
-#include <osl/mutex.hxx>
-
-#include "syscreds.hxx"
-
-#define MEMORY_RECORD 0
-#define PERSISTENT_RECORD 1
-
-//----------------------------------------------------------------------------------
-
-class NamePassRecord
-{
- ::rtl::OUString m_aName;
-
- // there are two lists of passwords, memory passwords and persistent passwords
- sal_Bool m_bHasMemPass;
- ::std::vector< ::rtl::OUString > m_aMemPass;
-
- // persistent passwords are encrypted in one string
- sal_Bool m_bHasPersPass;
- ::rtl::OUString m_aPersPass;
-
- void InitArrays( sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList,
- sal_Bool bHasPersistentList, const ::rtl::OUString& aPersistentList )
- {
- m_bHasMemPass = bHasMemoryList;
- if ( bHasMemoryList )
- m_aMemPass = aMemoryList;
-
- m_bHasPersPass = bHasPersistentList;
- if ( bHasPersistentList )
- m_aPersPass = aPersistentList;
- }
-
-public:
-
- NamePassRecord( const ::rtl::OUString& aName )
- : m_aName( aName )
- , m_bHasMemPass( sal_False )
- , m_bHasPersPass( sal_False )
- {
- }
-
- NamePassRecord( const ::rtl::OUString& aName, const ::std::vector< ::rtl::OUString >& aMemoryList )
- : m_aName( aName )
- , m_bHasMemPass( sal_True )
- , m_aMemPass( aMemoryList )
- , m_bHasPersPass( sal_False )
- {
- }
-
- NamePassRecord( const ::rtl::OUString& aName, const ::rtl::OUString& aPersistentList )
- : m_aName( aName )
- , m_bHasMemPass( sal_False )
- , m_bHasPersPass( sal_True )
- , m_aPersPass( aPersistentList )
- {
- }
-
- NamePassRecord( const ::rtl::OUString& aName,
- sal_Bool bHasMemoryList, const ::std::vector< ::rtl::OUString >& aMemoryList,
- sal_Bool bHasPersistentList, const ::rtl::OUString aPersistentList )
- : m_aName( aName )
- , m_bHasMemPass( bHasMemoryList )
- , m_bHasPersPass( bHasPersistentList )
- {
- InitArrays( bHasMemoryList, aMemoryList, bHasPersistentList, aPersistentList );
- }
-
- NamePassRecord( const NamePassRecord& aRecord )
- : m_aName( aRecord.m_aName )
- , m_bHasMemPass( sal_False )
- , m_bHasPersPass( sal_False )
- {
- InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass );
- }
-
- NamePassRecord& operator=( const NamePassRecord& aRecord )
- {
- m_aName = aRecord.m_aName;
-
- m_aMemPass.clear();
- m_aPersPass = ::rtl::OUString();
- InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass );
-
- return *this;
- }
-
- ::rtl::OUString GetUserName() const
- {
- return m_aName;
- }
-
- sal_Bool HasPasswords( sal_Int8 nStatus ) const
- {
- if ( nStatus == MEMORY_RECORD )
- return m_bHasMemPass;
- if ( nStatus == PERSISTENT_RECORD )
- return m_bHasPersPass;
-
- return sal_False;
- }
-
- ::std::vector< ::rtl::OUString > GetMemPasswords() const
- {
- if ( m_bHasMemPass )
- return m_aMemPass;
-
- return ::std::vector< ::rtl::OUString >();
- }
-
- ::rtl::OUString GetPersPasswords() const
- {
- if ( m_bHasPersPass )
- return m_aPersPass;
-
- return ::rtl::OUString();
- }
-
- void SetMemPasswords( const ::std::vector< ::rtl::OUString >& aMemList )
- {
- m_aMemPass = aMemList;
- m_bHasMemPass = sal_True;
- }
-
- void SetPersPasswords( const ::rtl::OUString& aPersList )
- {
- m_aPersPass = aPersList;
- m_bHasPersPass = sal_True;
- }
-
- void RemovePasswords( sal_Int8 nStatus )
- {
- if ( nStatus == MEMORY_RECORD )
- {
- m_bHasMemPass = sal_False;
- m_aMemPass.clear();
- }
- else if ( nStatus == PERSISTENT_RECORD )
- {
- m_bHasPersPass = sal_False;
- m_aPersPass = ::rtl::OUString();
- }
- }
-
-};
-
-//----------------------------------------------------------------------------------
-
-typedef ::std::pair< const ::rtl::OUString, ::std::list< NamePassRecord > > PairUrlRecord;
-typedef ::std::map< ::rtl::OUString, ::std::list< NamePassRecord > > PassMap;
-
-//----------------------------------------------------------------------------------
-
-class PasswordContainer;
-
-class StorageItem : public ::utl::ConfigItem {
- PasswordContainer* mainCont;
- sal_Bool hasEncoded;
- ::rtl::OUString mEncoded;
-public:
- StorageItem( PasswordContainer* point, const ::rtl::OUString& path ) :
- ConfigItem( path, CONFIG_MODE_IMMEDIATE_UPDATE ),
- mainCont( point ),
- hasEncoded( sal_False )
- {
- ::com::sun::star::uno::Sequence< ::rtl::OUString > aNode( 1 );
- *aNode.getArray() = path;
- *aNode.getArray() += ::rtl::OUString::createFromAscii( "/Store" );
- EnableNotification( aNode );
- }
-
- PassMap getInfo();
- void update( const ::rtl::OUString& url, const NamePassRecord& rec );
- void remove( const ::rtl::OUString& url, const ::rtl::OUString& rec );
- void clear();
-
- sal_Bool getEncodedMP( ::rtl::OUString& aResult );
- void setEncodedMP( const ::rtl::OUString& aResult, sal_Bool bAcceptEnmpty = sal_False );
- void setUseStorage( sal_Bool bUse );
- sal_Bool useStorage();
-
- virtual void Notify( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames );
- virtual void Commit();
-};
-
-//----------------------------------------------------------------------------------
-
-enum PasswordState {
- no_password,
- entered,
- cancelled
-};
-
-class PasswordContainer : public ::cppu::WeakImplHelper5<
- ::com::sun::star::task::XPasswordContainer,
- ::com::sun::star::task::XMasterPasswordHandling2,
- ::com::sun::star::task::XUrlContainer,
- ::com::sun::star::lang::XServiceInfo,
- ::com::sun::star::lang::XEventListener >
-{
-private:
- PassMap m_aContainer;
- StorageItem* m_pStorageFile;
- ::osl::Mutex mMutex;
- ::rtl::OUString m_aMasterPasswd; // master password is set when the string is not empty
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mComponent;
- SysCredentialsConfig mUrlContainer;
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > CopyToUserRecordSequence(
- const ::std::list< NamePassRecord >& original,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- ::com::sun::star::task::UserRecord CopyToUserRecord(
- const NamePassRecord& aRecord,
- sal_Bool& io_bTryToDecode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler );
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::task::UserRecord > FindUsr(
- const ::std::list< NamePassRecord >& userlist,
- const ::rtl::OUString& name,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-bool createUrlRecord(
- const PassMap::iterator & rIter,
- bool bName,
- const ::rtl::OUString & aName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler,
- ::com::sun::star::task::UrlRecord & rRec )
- throw( ::com::sun::star::uno::RuntimeException );
-
-::com::sun::star::task::UrlRecord find(
- const ::rtl::OUString& aURL,
- const ::rtl::OUString& aName,
- bool bName, // only needed to support empty user names
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler ) throw(::com::sun::star::uno::RuntimeException);
-
- ::rtl::OUString GetDefaultMasterPassword();
-
- ::rtl::OUString RequestPasswordFromUser(
- ::com::sun::star::task::PasswordRequestMode aRMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
-
- ::rtl::OUString GetMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- void UpdateVector( const ::rtl::OUString& url, ::std::list< NamePassRecord >& toUpdate, NamePassRecord& rec, sal_Bool writeFile )
- throw(::com::sun::star::uno::RuntimeException);
-
- void PrivateAdd( const ::rtl::OUString& aUrl,
- const ::rtl::OUString& aUserName,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords,
- char aMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- ::std::vector< ::rtl::OUString > DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPassword )
- throw(::com::sun::star::uno::RuntimeException);
-
- ::rtl::OUString EncodePasswords( ::std::vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPassword )
- throw(::com::sun::star::uno::RuntimeException);
-
-public:
- PasswordContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
- ~PasswordContainer();
-
- virtual void SAL_CALL add( const ::rtl::OUString& aUrl,
- const ::rtl::OUString& aUserName,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL addPersistent( const ::rtl::OUString& aUrl,
- const ::rtl::OUString& aUserName,
- const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPasswords,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::task::UrlRecord SAL_CALL
- find( const ::rtl::OUString& aUrl,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::task::UrlRecord SAL_CALL
- findForName( const ::rtl::OUString& aUrl,
- const ::rtl::OUString& aUserName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL remove( const ::rtl::OUString& aUrl,
- const ::rtl::OUString& aUserName )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL removePersistent( const ::rtl::OUString& aUrl,
- const ::rtl::OUString& aUserName )
- throw(::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL removeAllPersistent() throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::task::UrlRecord > SAL_CALL
- getAllPersistent( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler ) throw(::com::sun::star::uno::RuntimeException);
-
-
- // provide factory
- static ::rtl::OUString SAL_CALL impl_getStaticImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- impl_getStaticSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > SAL_CALL
- impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ServiceManager ) throw(::com::sun::star::uno::RuntimeException);
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ) throw( ::com::sun::star::uno::RuntimeException );
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XMasterPasswordHandling
- virtual ::sal_Bool SAL_CALL authorizateWithMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler )
- throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL changeMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeMasterPassword() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL hasMasterPassword( ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL allowPersistentStoring( ::sal_Bool bAllow ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isPersistentStoringAllowed( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XMasterPasswordHandling2
- virtual ::sal_Bool SAL_CALL useDefaultMasterPassword( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isDefaultMasterPasswordUsed( ) throw (::com::sun::star::uno::RuntimeException);
-
- // XUrlContainer
- virtual void SAL_CALL addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL findUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeUrl( const ::rtl::OUString& Url ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getUrls( ::sal_Bool OnlyPersistent ) throw (::com::sun::star::uno::RuntimeException);
-
- void Notify();
-};
-
-//----------------------------------------------------------------------------------
-
-class MasterPasswordRequest_Impl : public ucbhelper::InteractionRequest
-{
- ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > m_xAuthSupplier;
-
-public:
- MasterPasswordRequest_Impl( ::com::sun::star::task::PasswordRequestMode Mode );
-
- const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > &
- getAuthenticationSupplier() const { return m_xAuthSupplier; }
-
-};
-
-//----------------------------------------------------------------------------------
-
-class RW_SvMemoryStream : public SvMemoryStream {
-public:
- RW_SvMemoryStream( void* Buf, ULONG Size, StreamMode eMode ):
- SvMemoryStream( Buf, Size, eMode){}
-
- RW_SvMemoryStream( ULONG InitSize=512, ULONG Resize=64 ):
- SvMemoryStream( InitSize, Resize ){}
-
- ULONG getActualSize(){ return nEndOfData; }
-};
-
-
-
-#endif // #ifndef INCLUDED_COMPHELPER_PASSWORDCONTAINER_HXX
-
diff --git a/svtools/source/inc/poolio.hxx b/svtools/source/inc/poolio.hxx
deleted file mode 100644
index fb30fc04832d..000000000000
--- a/svtools/source/inc/poolio.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: poolio.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.
- *
- ************************************************************************/
-#include <svtools/brdcst.hxx>
-
-
-#ifndef DELETEZ
-#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
-#endif
-
-
-struct SfxPoolVersion_Impl
-{
- USHORT _nVer;
- USHORT _nStart, _nEnd;
- USHORT* _pMap;
-
- SfxPoolVersion_Impl( USHORT nVer, USHORT nStart, USHORT nEnd,
- USHORT *pMap )
- : _nVer( nVer ),
- _nStart( nStart ),
- _nEnd( nEnd ),
- _pMap( pMap )
- {}
- SfxPoolVersion_Impl( const SfxPoolVersion_Impl &rOrig )
- : _nVer( rOrig._nVer ),
- _nStart( rOrig._nStart ),
- _nEnd( rOrig._nEnd ),
- _pMap( rOrig._pMap )
- {}
-};
-
-SV_DECL_PTRARR( SfxPoolItemArrayBase_Impl, SfxPoolItem*, 0, 5 )
-SV_DECL_PTRARR_DEL( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl*, 0, 2 )
-
-struct SfxPoolItemArray_Impl: public SfxPoolItemArrayBase_Impl
-{
- USHORT nFirstFree;
-
- SfxPoolItemArray_Impl (USHORT nInitSize = 0)
- : SfxPoolItemArrayBase_Impl( nInitSize ),
- nFirstFree( 0 )
- {}
-};
-
-class SfxStyleSheetIterator;
-
-struct SfxItemPool_Impl
-{
- SfxBroadcaster aBC;
- SfxPoolItemArray_Impl** ppPoolItems;
- SfxPoolVersionArr_Impl aVersions;
- USHORT nVersion;
- USHORT nLoadingVersion;
- USHORT nInitRefCount; // 1, beim Laden ggf. 2
- USHORT nVerStart, nVerEnd; // WhichRange in Versions
- USHORT nStoringStart, nStoringEnd; // zu speichernder Range
- BYTE nMajorVer, nMinorVer; // Pool selbst
- SfxMapUnit eDefMetric;
- FASTBOOL bInSetItem;
- FASTBOOL bStreaming; // in Load() bzw. Store()
-
- SfxItemPool_Impl( USHORT nStart, USHORT nEnd )
- : ppPoolItems (new SfxPoolItemArray_Impl*[ nEnd - nStart + 1])
- {
- memset( ppPoolItems, 0, sizeof( SfxPoolItemArray_Impl* ) * ( nEnd - nStart + 1) );
- }
-
- ~SfxItemPool_Impl()
- {
- delete[] ppPoolItems;
- }
-
- void DeleteItems()
- {
- delete[] ppPoolItems; ppPoolItems = 0;
- }
-};
-
-// -----------------------------------------------------------------------
-
-// IBM-C-Set mag keine doppelten Defines
-#ifdef DBG
-# undef DBG
-#endif
-
-#if defined(DBG_UTIL) && defined(MSC)
-#define SFX_TRACE(s,p) \
- { \
- ByteString aPtr(RTL_CONSTASCII_STRINGPARAM("0x0000:0x0000")); \
- _snprintf(const_cast< sal_Char *>(aPtr.GetBuffer()), aPtr.Len(), \
- "%lp", p ); \
- aPtr.Insert(s, 0); \
- DbgTrace( aPtr.GetBuffer() ); \
- }
-#define DBG(x) x
-#else
-#define SFX_TRACE(s,p)
-#define DBG(x)
-#endif
-
-#define CHECK_FILEFORMAT( rStream, nTag ) \
- { USHORT nFileTag; \
- rStream >> nFileTag; \
- if ( nTag != nFileTag ) \
- { \
- DBG_ERROR( #nTag ); /*! s.u. */ \
- /*! error-code setzen und auswerten! */ \
- (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
- pImp->bStreaming = FALSE; \
- return rStream; \
- } \
- }
-
-#define CHECK_FILEFORMAT_RELEASE( rStream, nTag, pPointer ) \
- { USHORT nFileTag; \
- rStream >> nFileTag; \
- if ( nTag != nFileTag ) \
- { \
- DBG_ERROR( #nTag ); /*! s.u. */ \
- /*! error-code setzen und auswerten! */ \
- (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
- pImp->bStreaming = FALSE; \
- delete pPointer; \
- return rStream; \
- } \
- }
-
-#define CHECK_FILEFORMAT2( rStream, nTag1, nTag2 ) \
- { USHORT nFileTag; \
- rStream >> nFileTag; \
- if ( nTag1 != nFileTag && nTag2 != nFileTag ) \
- { \
- DBG_ERROR( #nTag1 ); /*! s.u. */ \
- /*! error-code setzen und auswerten! */ \
- (rStream).SetError(SVSTREAM_FILEFORMAT_ERROR); \
- pImp->bStreaming = FALSE; \
- return rStream; \
- } \
- }
-
-#define SFX_ITEMPOOL_VER_MAJOR BYTE(2)
-#define SFX_ITEMPOOL_VER_MINOR BYTE(0)
-
-#define SFX_ITEMPOOL_TAG_STARTPOOL_4 USHORT(0x1111)
-#define SFX_ITEMPOOL_TAG_STARTPOOL_5 USHORT(0xBBBB)
-#define SFX_ITEMPOOL_TAG_ITEMPOOL USHORT(0xAAAA)
-#define SFX_ITEMPOOL_TAG_ITEMS USHORT(0x2222)
-#define SFX_ITEMPOOL_TAG_ITEM USHORT(0x7777)
-#define SFX_ITEMPOOL_TAG_SIZES USHORT(0x3333)
-#define SFX_ITEMPOOL_TAG_DEFAULTS USHORT(0x4444)
-#define SFX_ITEMPOOL_TAG_VERSIONMAP USHORT(0x5555)
-#define SFX_ITEMPOOL_TAG_HEADER USHORT(0x6666)
-#define SFX_ITEMPOOL_TAG_ENDPOOL USHORT(0xEEEE)
-#define SFX_ITEMPOOL_TAG_TRICK4OLD USHORT(0xFFFF)
-
-#define SFX_ITEMPOOL_REC BYTE(0x01)
-#define SFX_ITEMPOOL_REC_HEADER BYTE(0x10)
-#define SFX_ITEMPOOL_REC_VERSIONMAP USHORT(0x0020)
-#define SFX_ITEMPOOL_REC_WHICHIDS USHORT(0x0030)
-#define SFX_ITEMPOOL_REC_ITEMS USHORT(0x0040)
-#define SFX_ITEMPOOL_REC_DEFAULTS USHORT(0x0050)
-
-#define SFX_ITEMSET_REC BYTE(0x02)
-
-#define SFX_STYLES_REC BYTE(0x03)
-#define SFX_STYLES_REC_HEADER USHORT(0x0010)
-#define SFX_STYLES_REC_STYLES USHORT(0x0020)
-
-//========================================================================
-
-inline USHORT SfxItemPool::GetIndex_Impl(USHORT nWhich) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- DBG_ASSERT(nWhich >= nStart && nWhich <= nEnd, "Which-Id nicht im Pool-Bereich");
- return nWhich - nStart;
-}
-
diff --git a/svtools/source/inc/property.hxx b/svtools/source/inc/property.hxx
new file mode 100644
index 000000000000..2a756f177608
--- /dev/null
+++ b/svtools/source/inc/property.hxx
@@ -0,0 +1,588 @@
+/*************************************************************************
+ *
+ * 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: property.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 SV_PROPERTY_HXX
+#define SV_PROPERTY_HXX
+
+#ifndef _VIRDEV_HXX //autogen
+#include <vcl/virdev.hxx>
+#endif
+#ifndef SV_FIXED_HXX
+#include <vcl/fixed.hxx>
+#endif
+#ifndef SV_LSTBOX_HXX
+#include <vcl/lstbox.hxx>
+#endif
+#ifndef SV_GROUP_HXX
+#include <vcl/group.hxx>
+#endif
+#ifndef SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#ifndef SV_MOREBTN_HXX
+#include <vcl/morebtn.hxx>
+#endif
+#ifndef _DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+#include <vcl/combobox.hxx>
+#include <vcl/field.hxx>
+#include <svl/svarray.hxx>
+
+#define _SVSTDARR_USHORTS
+#include <svl/svstdarr.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/scrbar.hxx>
+#include <svl/svarray.hxx>
+
+#ifndef _SVSTDARR_STRINGS
+#define _SVSTDARR_STRINGS
+#include <svl/svstdarr.hxx>
+#endif
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+
+//------------------------------------------------------------------------
+
+//========================================================================
+enum eKindOfControl { KOC_UNDEFINED=0,KOC_LISTBOX=1, KOC_COMBOBOX=2,
+ KOC_EDIT=3,KOC_USERDEFINED=5};
+
+class SvXPropertyCtrListener;
+
+class SvXPropertyControl : public Control
+{
+public:
+ SvXPropertyControl( Window* pParent, WinBits nWinStyle = 0 );
+ SvXPropertyControl( Window* pParent, const ResId& rResId );
+
+ virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*)=0;
+
+ virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener()=0;
+ virtual void SetProperty(const String &rString)=0;
+ virtual String GetProperty()const=0;
+ virtual BOOL HasList()=0;
+ virtual void ClearList()=0;
+ virtual void InsertEntry( const String& rString,
+ USHORT nPos = LISTBOX_APPEND )=0;
+
+ virtual void SetCtrSize(const Size& rSize)=0;
+ virtual void SetLocked(BOOL bLocked=TRUE)=0;
+
+ virtual void SetMyName(const String &rString)=0;
+ virtual String GetMyName()const=0;
+
+ virtual void SetMyData(void*)=0;
+ virtual void* GetMyData()=0;
+};
+
+class SvXPropertyCtrListener
+{
+
+public:
+ virtual void Modified (SvXPropertyControl *pSvXPCtr)=0;
+ virtual void GetFocus (SvXPropertyControl *pSvXPCtr)=0;
+ virtual void LoseFocus(SvXPropertyControl *pSvXPCtr)=0;
+ virtual void KeyInput (SvXPropertyControl *pSvXPCtr ,const KeyCode&)=0;
+};
+
+
+class SvXPropertyEdit : public SvXPropertyControl
+{
+private:
+
+ String aName;
+ SvXPropertyCtrListener* pListener;
+ Edit aEdit;
+ void* pData;
+
+ DECL_LINK(ModifiedHdl,Edit*);
+ DECL_LINK(GetFocusHdl,Edit*);
+ DECL_LINK(LoseFocusHdl,Edit*);
+
+public:
+ SvXPropertyEdit( Window* pParent, WinBits nWinStyle = 0 );
+ SvXPropertyEdit( Window* pParent, const ResId& rResId );
+
+ virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*);
+
+ virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener();
+
+ virtual void SetProperty(const String &rString);
+ virtual String GetProperty()const;
+
+ virtual BOOL HasList();
+ virtual void ClearList();
+ virtual void InsertEntry( const String& rString,
+ USHORT nPos = LISTBOX_APPEND );
+
+ virtual void SetCtrSize(const Size& rSize);
+ virtual void SetLocked(BOOL bLocked=TRUE);
+
+ virtual void SetMyName(const String &rString);
+ virtual String GetMyName()const;
+
+ virtual void SetMyData(void*);
+ virtual void* GetMyData();
+};
+
+
+class SvXPropertyListBox : public SvXPropertyControl
+{
+private:
+
+ String aName;
+ SvXPropertyCtrListener* pListener;
+ ListBox aListBox;
+ void* pData;
+
+ DECL_LINK(ModifiedHdl,ListBox*);
+ DECL_LINK(GetFocusHdl,ListBox*);
+ DECL_LINK(LoseFocusHdl,ListBox*);
+
+
+public:
+ SvXPropertyListBox( Window* pParent, WinBits nWinStyle = 0 );
+ SvXPropertyListBox( Window* pParent, const ResId& rResId );
+
+ virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*);
+
+ virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener();
+
+ ListBox* GetListBox();
+
+ virtual void SetProperty(const String &rString);
+ virtual String GetProperty()const;
+
+ virtual BOOL HasList();
+ virtual void ClearList();
+ virtual void InsertEntry( const String& rString,
+ USHORT nPos = LISTBOX_APPEND );
+
+ virtual void SetCtrSize(const Size& rSize);
+ virtual void SetLocked(BOOL bLocked=TRUE);
+
+ virtual void SetMyName(const String &rString);
+ virtual String GetMyName()const;
+
+ virtual void SetMyData(void*);
+ virtual void* GetMyData();
+};
+
+class SvXPropertyComboBox : public SvXPropertyControl
+{
+private:
+
+ String aName;
+ SvXPropertyCtrListener* pListener;
+ ComboBox aComboBox;
+ void* pData;
+
+ DECL_LINK(ModifiedHdl,ComboBox*);
+ DECL_LINK(GetFocusHdl,ComboBox*);
+ DECL_LINK(LoseFocusHdl,ComboBox*);
+
+
+public:
+ SvXPropertyComboBox( Window* pParent, WinBits nWinStyle = 0 );
+ SvXPropertyComboBox( Window* pParent, const ResId& rResId );
+
+ virtual void SetSvXPropertyCtrListener(SvXPropertyCtrListener*);
+
+ virtual SvXPropertyCtrListener* GetSvXPropertyCtrListener();
+
+ ComboBox* GetComboBox();
+
+ virtual void SetProperty(const String &rString);
+ virtual String GetProperty()const;
+
+ virtual BOOL HasList();
+ virtual void ClearList();
+ virtual void InsertEntry( const String& rString,
+ USHORT nPos = LISTBOX_APPEND );
+
+ virtual void SetCtrSize(const Size& rSize);
+ virtual void SetLocked(BOOL bLocked=TRUE);
+
+ virtual void SetMyName(const String &rString);
+ virtual String GetMyName()const;
+
+ virtual void SetMyData(void*);
+ virtual void* GetMyData();
+};
+
+
+
+class SvPropertyLine : public Control
+{
+private:
+ FixedText aName;
+ USHORT nNameWidth;
+ BOOL bNeedsRepaint;
+ SvXPropertyControl* pSvXPropertyControl;
+
+ PushButton aXButton;
+ BOOL bIsLocked;
+ BOOL bHasXButton;
+ BOOL bIsHyperlink;
+ eKindOfControl eKindOfCtr;
+
+protected:
+ virtual void Resize();
+
+public:
+ SvPropertyLine( Window* pParent,
+ WinBits nWinStyle = 0 );
+ SvPropertyLine( Window* pParent,
+ const ResId& rResId );
+
+ BOOL NeedsRepaint();
+ void SetNeedsRepaint(BOOL bFlag);
+ void SetSvXPropertyControl(SvXPropertyControl*);
+ SvXPropertyControl* GetSvXPropertyControl();
+
+ void SetKindOfControl(eKindOfControl);
+ eKindOfControl GetKindOfControl();
+
+ void SetName(const String& rString );
+ String GetName() const;
+ void SetNameWidth(USHORT);
+
+ void ShowXButton();
+ void HideXButton();
+ BOOL IsVisibleXButton();
+ void ShowAsHyperLink(BOOL nFlag=TRUE);
+ BOOL IsShownAsHyperlink();
+
+ void Locked(BOOL nFlag=TRUE);
+ BOOL IsLineLocked();
+
+ void SetClickHdl(const Link&);
+
+};
+
+
+class SvPropertyData
+{
+public:
+ eKindOfControl eKind;
+ String aName;
+ String aValue;
+ SvStrings theValues; // ???
+
+ BOOL bHasVisibleXButton;
+ BOOL bIsHyperLink;
+ BOOL bIsLocked;
+ void* pDataPtr;
+ SvXPropertyControl* pControl;
+};
+
+class SvPropertyDataObjectControl
+{
+};
+
+class SvPropertyDataControl
+{
+public:
+ virtual void Modified( const String& aName,
+ const String& aVal,
+ void* pData)=0;
+
+ virtual void Clicked( const String& aName,
+ const String& aVal,
+ void* pData)=0;
+
+ virtual void Commit( const String& aName,
+ const String& aVal,
+ void* pData)=0;
+
+ virtual void Select( const String& aName,
+ void* pData)=0;
+
+ virtual void LinkClicked(const String& aName,
+ void* pData)=0;
+};
+
+class SvXPropEvListener: public SvXPropertyCtrListener
+{
+ Link aModifyLink;
+ Link aGetFocusLink;
+ Link aLoseFocusLink;
+ Link aKeyInputLink;
+ String aModifiedResult;
+
+ SvXPropertyControl * pTheActiveControl;
+ KeyCode aKeyCode;
+
+public:
+ SvXPropEvListener();
+ virtual ~SvXPropEvListener();
+
+ virtual void Modified (SvXPropertyControl *pSvXPCtr);
+ virtual void GetFocus (SvXPropertyControl *pSvXPCtr);
+ virtual void LoseFocus(SvXPropertyControl *pSvXPCtr);
+ virtual void KeyInput(SvXPropertyControl *pSvXPCtr ,const KeyCode&);
+
+ SvXPropertyControl * GetPropertyControl();
+ KeyCode GetKeyCode() const;
+
+ void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; }
+ const Link& GetModifyHdl() const { return aModifyLink; }
+
+ void SetGetFocusHdl( const Link& rLink ) { aGetFocusLink = rLink; }
+ const Link& GetGetFocusHdl() const { return aGetFocusLink; }
+
+ void SetLoseFocusHdl( const Link& rLink ) { aLoseFocusLink = rLink; }
+ const Link& GetLoseFocusHdl() const { return aLoseFocusLink; }
+
+ void SetKeyInputHdl( const Link& rLink ) { aKeyInputLink = rLink; }
+ const Link& GetKeyInputHdl() const { return aKeyInputLink; }
+
+
+};
+
+typedef SvPropertyLine * SvPropertyLinePtr;
+
+SV_DECL_PTRARR(SvPropLineArray,SvPropertyLinePtr,1,1)
+
+class SvListBoxForProperties: public Control
+{
+private:
+
+ SvXPropEvListener aListener;
+ Window aPlayGround;
+ ScrollBar aVScroll;
+ SvPropLineArray PLineArray;
+ SvPropertyDataControl* pPropDataControl;
+ USHORT nRowHeight;
+ BOOL bUpdate;
+ USHORT nTheNameSize;
+ long nYOffset;
+
+ DECL_LINK( ScrollHdl,ScrollBar*);
+ DECL_LINK( ClickHdl ,PushButton*);
+
+ DECL_LINK( ModifyHdl,SvXPropEvListener*);
+ DECL_LINK( GetFocusHdl,SvXPropEvListener*);
+ DECL_LINK(LoseFocusHdl,SvXPropEvListener*);
+ DECL_LINK( KeyInputHdl,SvXPropEvListener*);
+
+protected:
+ void UpdateAll();
+ void UpdatePosNSize();
+ void UpdatePlayGround();
+ void UpdateVScroll();
+
+ void Resize();
+
+public:
+ SvListBoxForProperties( Window* pParent, WinBits nWinStyle = 0 );
+ SvListBoxForProperties( Window* pParent, const ResId& rResId );
+
+ ~SvListBoxForProperties();
+
+ virtual USHORT CalcVisibleLines();
+ virtual void EnableUpdate();
+ virtual void DisableUpdate();
+
+ virtual void SetController(SvPropertyDataControl *);
+
+ virtual void Clear();
+
+ virtual USHORT InsertEntry( const SvPropertyData&, USHORT nPos = LISTBOX_APPEND );
+
+ virtual void ChangeEntry( const SvPropertyData&, USHORT nPos);
+
+ virtual USHORT AppendEntry( const SvPropertyData&);
+
+ virtual void SetPropertyValue( const String & rEntryName, const String & rValue );
+
+ virtual void SetFirstVisibleEntry(USHORT nPos);
+ virtual USHORT GetFirstVisibleEntry();
+
+ virtual void SetSelectedEntry(USHORT nPos);
+ virtual USHORT GetSelectedEntry();
+};
+
+class SvTabPageForProperties: public TabPage
+{
+
+private:
+
+ SvListBoxForProperties aLbProp;
+
+protected:
+
+ virtual void Resize();
+
+public:
+ SvTabPageForProperties(Window* pParent,WinBits nWinStyle = 0 );
+
+ SvListBoxForProperties* GetTheListBox();
+};
+
+
+class SvBasicPropertyDataControl: public SvPropertyDataControl
+{
+private:
+
+ BOOL bCorrectness;
+ String aEntryName;
+ String aEntryProperty;
+ String aCorrectProperty;
+ void* pTheData;
+ Link aModifyLink;
+ Link aClickedLink;
+ Link aCommitLink;
+ Link aSelectLink;
+
+public:
+ virtual ~SvBasicPropertyDataControl();
+
+ virtual void Modified( const String& aName,
+ const String& aVal,
+ void* pData); //User has modified Property
+
+ virtual void Clicked( const String& aName,
+ const String& aVal,
+ void* pData); //Xtension-Button pressed
+
+ virtual void Commit( const String& aName,
+ const String& aVal,
+ void* pData); //User accept changes
+
+ virtual void Select( const String& aName,
+ void* pData); //User select new Row
+
+ virtual void LinkClicked(const String& aName,
+ void* pData);
+
+ virtual void SetIsCorrect(BOOL nFlag);
+
+ //virtual String GetTheCorrectProperty()const;
+ virtual void SetTheCorrectProperty(const String& aName);
+
+ String GetName() const; //Tell's the name of the Property
+ String GetProperty() const; //Tell's the content of the Property
+ void* GetData(); //Tell's the storage
+
+
+ void SetModifyHdl( const Link& rLink ) { aModifyLink = rLink; }
+ const Link& GetModifyHdl() const { return aModifyLink; }
+
+ void SetClickedHdl( const Link& rLink ) { aClickedLink = rLink; }
+ const Link& GetClickedHdl() const { return aClickedLink; }
+
+ void SetCommitHdl( const Link& rLink ) { aCommitLink = rLink; }
+ const Link& GetCommitHdl() const { return aCommitLink; }
+
+ void SetSelectHdl( const Link& rLink ) { aSelectLink = rLink; }
+ const Link& GetSelectHdl() const { return aSelectLink; }
+
+};
+
+
+class SvPropertyBox: public Control
+{
+private:
+ SvPropertyDataControl* pThePropDataCtr;
+ TabControl aTabControl;
+
+protected:
+ virtual void Resize();
+
+public:
+ SvPropertyBox ( Window* pParent, WinBits nWinStyle = 0 );
+ SvPropertyBox ( Window* pParent, const ResId& rResId );
+
+ ~SvPropertyBox();
+
+ virtual USHORT CalcVisibleLines();
+ virtual void EnableUpdate(); // auch IDL?
+ virtual void DisableUpdate(); // auch IDL?
+
+ // AB: Hier beginnt das 'offizielle' Interface, das in IDL uebernommen werden soll
+ virtual void SetController(SvPropertyDataControl *);
+
+ virtual USHORT AppendPage( const String & r );
+ virtual void SetPage( USHORT );
+ virtual USHORT GetCurPage();
+ virtual void ClearAll();
+ virtual void ClearTable();
+
+ virtual void SetPropertyValue( const String & rEntryName, const String & rValue );
+
+ virtual USHORT InsertEntry( const SvPropertyData&, USHORT nPos = LISTBOX_APPEND );
+ virtual void ChangeEntry( const SvPropertyData&, USHORT nPos);
+ virtual USHORT AppendEntry( const SvPropertyData&);
+
+ virtual void SetFirstVisibleEntry(USHORT nPos);
+ virtual USHORT GetFirstVisibleEntry();
+
+ virtual void SetSelectedEntry(USHORT nPos);
+ virtual USHORT GetSelectedEntry();
+};
+
+
+
+/*
+class ScPropertyDlg : public ModalDialog
+{
+private:
+ SvBasicPropertyDataControl aBaProDatCtr;
+ OKButton anOk;
+ CancelButton aCancel;
+ USHORT nCount;
+ USHORT nClickCount;
+
+ SvPropertyData aProperty;
+ SvPropertyBox aPropListBox;
+
+ ListBox aKindOfListBox;
+ FixedText aModAnswer;
+ FixedText aClickAnswer;
+ FixedText aCommitAnswer;
+ FixedText aSelectAnswer;
+
+ DECL_LINK( ModifiedHdl, ListBox*);
+
+ DECL_LINK( RowModifiedHdl, SvBasicPropertyDataControl*);
+ DECL_LINK( ClickHdl , SvBasicPropertyDataControl*);
+ DECL_LINK( SelectHdl , SvBasicPropertyDataControl*);
+ DECL_LINK( CommitHdl , SvBasicPropertyDataControl*);
+
+public:
+ ScPropertyDlg( Window* pParent);
+ ~ScPropertyDlg();
+};
+*/
+#endif // SC_AUTOFMT_HXX
+
+
diff --git a/svtools/source/inc/sgfbram.hxx b/svtools/source/inc/sgfbram.hxx
new file mode 100644
index 000000000000..ca7e90b59cd4
--- /dev/null
+++ b/svtools/source/inc/sgfbram.hxx
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * 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: sgfbram.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.
+ *
+ ************************************************************************/
+
+#ifndef _SGFBRAM_HXX
+#define _SGFBRAM_HXX
+
+#include <tools/solar.h>
+
+#define SgfBitImag0 1 /* Bitmap */
+#define SgfBitImag1 4 /* Bitmap */
+#define SgfBitImag2 5 /* Bitmap */
+#define SgfBitImgMo 6 /* Monochrome Bitmap */
+#define SgfSimpVect 2 /* Einfaches Vectorformat */
+#define SgfPostScrp 3 /* Postscript file */
+#define SgfStarDraw 7 /* StarDraw SGV-Datei */
+#define SgfDontKnow 255 /* Unbekannt oder kein SGF/SGV */
+
+// Konstanten fr SgfHeader.SwGrCol
+#define SgfBlckWhit 1 /* Schwarz/Weiá Bild Äż SimpVector, */
+#define SgfGrayscal 2 /* Bild mit Graustufen ³ StarDraw und */
+#define Sgf16Colors 3 /* Farbbild (16 Farben) ÄÙ Bit Image */
+#define SgfVectFarb 4 /* Farben fr Linien verwenden Äż */
+#define SgfVectGray 5 /* Graustufen fr Linien verwenden ³ Nur fr */
+#define SgfVectWdth 6 /* Strichst„rken fr Linien verwenden ÄÙ SimpVector */
+
+
+#define SgfHeaderSize 42
+class SgfHeader
+{
+public:
+ UINT16 Magic;
+ UINT16 Version;
+ UINT16 Typ;
+ UINT16 Xsize;
+ UINT16 Ysize;
+ INT16 Xoffs;
+ INT16 Yoffs;
+ UINT16 Planes; // Layer
+ UINT16 SwGrCol;
+ char Autor[10];
+ char Programm[10];
+ UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (38 mod 4 =2) !
+
+ UINT32 GetOffset();
+ friend SvStream& operator>>(SvStream& rIStream, SgfHeader& rHead);
+ BOOL ChkMagic();
+};
+
+#define SgfEntrySize 22
+class SgfEntry
+{
+public:
+ UINT16 Typ;
+ UINT16 iFrei;
+ UINT16 lFreiLo,lFreiHi;
+ char cFrei[10];
+ UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (18 mod 4 =2) !
+
+ UINT32 GetOffset();
+ friend SvStream& operator>>(SvStream& rIStream, SgfEntry& rEntr);
+};
+
+#define SgfVectorSize 10
+class SgfVector
+{
+public:
+ UINT16 Flag;
+ INT16 x;
+ INT16 y;
+ UINT16 OfsLo,OfsHi; // DWord-Allignment ist notwendig (6 mod 4 =2) !
+
+ friend SvStream& operator>>(SvStream& rIStream, SgfVector& rEntr);
+};
+
+extern long SgfVectXofs;
+extern long SgfVectYofs;
+extern long SgfVectXmul;
+extern long SgfVectYmul;
+extern long SgfVectXdiv;
+extern long SgfVectYdiv;
+extern BOOL SgfVectScal;
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Windows BMP /////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define BmpFileHeaderSize 14
+class BmpFileHeader
+{
+public:
+ UINT16 Typ; // = "BM"
+ UINT16 SizeLo,SizeHi; // Filesize in Bytes
+ UINT16 Reserve1; // Reserviert
+ UINT16 Reserve2; // Reserviert
+ UINT16 OfsLo,OfsHi; // Offset?
+
+ void SetSize(UINT32 Size);
+ void SetOfs(UINT32 Size);
+ UINT32 GetOfs();
+ friend SvStream& operator<<(SvStream& rOStream, BmpFileHeader& rHead);
+};
+
+#define BmpInfoHeaderSize 40
+class BmpInfoHeader
+{
+public:
+ UINT32 Size; // GrӇe des BmpInfoHeaders
+ INT32 Width; // Breite in Pixel
+ INT32 Hight; // H”he in Pixel
+ UINT16 Planes; // Anzahl der Planes (immer 1)
+ UINT16 PixBits; // Anzahl der Bit je Pixel (1,4,8,oder 24)
+ UINT32 Compress; // Datenkompression
+ UINT32 ImgSize; // GrӇe der Images in Bytes. Ohne Kompression ist auch 0 erlaubt.
+ INT32 xDpmm; // Dot per Meter (0 ist erlaubt)
+ INT32 yDpmm; // Dot per Meter (0 ist erlaubt)
+ UINT32 ColUsed; // Anzahl der verwendeten Farben (0=alle)
+ UINT32 ColMust; // Anzahl der wichtigen Farben (0=alle)
+
+ friend SvStream& operator<<(SvStream& rOStream, BmpInfoHeader& rHead);
+};
+
+#define RGBQuadSize 4
+class RGBQuad {
+private:
+ BYTE Red;
+ BYTE Grn;
+ BYTE Blu;
+ BYTE Fil;
+public:
+ RGBQuad(BYTE R, BYTE G, BYTE B) { Red=R; Grn=G; Blu=B; Fil=0; }
+};
+
+#endif //_SGFBRAM_HXX
diff --git a/svtools/source/items/eitem.cxx b/svtools/source/inc/sgffilt.hxx
index f7b95665391d..a93522fcf590 100644
--- a/svtools/source/items/eitem.cxx
+++ b/svtools/source/inc/sgffilt.hxx
@@ -6,7 +6,7 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: eitem.cxx,v $
+ * $RCSfile: sgffilt.hxx,v $
* $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
@@ -28,23 +28,22 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <svtools/eitem.hxx>
-//============================================================================
-//
-// class SfxEnumItem
-//
-//============================================================================
+#ifndef _SGFFILT_HXX
+#define _SGFFILT_HXX
+#include <tools/urlobj.hxx>
-TYPEINIT1(SfxEnumItem, CntEnumItem);
-
-//============================================================================
-//
-// class SfxBoolItem
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(SfxBoolItem, CntBoolItem);
+BYTE CheckSgfTyp(SvStream& rInp, USHORT& nVersion);
+BOOL SgfBMapFilter(SvStream& rInp, SvStream& rOut);
+BOOL SgfVectFilter(SvStream& rInp, GDIMetaFile& rMtf);
+BOOL SgfSDrwFilter(SvStream& rInp, GDIMetaFile& rMtf, INetURLObject aIniPath );
+// Konstanten fr CheckSgfTyp()
+#define SGF_BITIMAGE 1 /* Bitmap */
+#define SGF_SIMPVECT 2 /* Einfaches Vectorformat */
+#define SGF_POSTSCRP 3 /* Postscript file */
+#define SGF_STARDRAW 7 /* StarDraw SGV-Datei */
+#define SGF_DONTKNOW 255 /* Unbekannt oder kein SGF/SGV */
+#define SGV_VERSION 3 /* SGV mit anderer Version wird abgewiesen */
+ /* 3 entspricht StarDraw 2.00/2.01 M„rz'93 */
+#endif //_SGFFILT_HXX
diff --git a/svtools/source/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx
new file mode 100644
index 000000000000..58e43e0a00b2
--- /dev/null
+++ b/svtools/source/inc/sgvmain.hxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * 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: sgvmain.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 _SGVMAIN_HXX
+#define _SGVMAIN_HXX
+
+#include <vcl/font.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/virdev.hxx>
+
+
+#define UCHAR unsigned char
+
+struct PointType {
+ INT16 x;
+ INT16 y;
+};
+
+#define SgfDpmm 40
+
+#define DtHdSize 256
+class DtHdType {
+public:
+ BYTE Reserved[256];
+ friend SvStream& operator>>(SvStream& rIStream, DtHdType& rDtHd);
+ friend void DtHdOverSeek(SvStream& rInp);
+};
+
+
+struct Seitenformat {
+ PointType Size; // 0.00mm...819.175mm (Papiergrïż½ïż½e)
+ INT16 RandL; // links Rand auf
+ INT16 RandR; // rechts dem Papier
+ INT16 RandO; // oben Rand auf
+ INT16 RandU; // unten dem Papier
+ BYTE PColor; // Future Use
+ BYTE PIntens; // erst recht Future use
+// BOOL BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT)
+};
+
+
+#define PageSize 146
+class PageType {
+public:
+ UINT32 Next; // Nïż½chste Seite
+ UINT32 nList; // Objektdaten, erster Record
+ UINT32 ListEnd; // Objektdaten, letzter Record
+ Seitenformat Paper; // Papierdaten
+ BOOL BorderClip; // Objekte am Rand abschneiden (Schummel wg. Allignment unter NT)
+ BYTE StdPg; // welche Standardseite einblenden ?
+ PointType U; // Nullpunkt
+ INT16 HlpLnH[20]; // Hilfslinien
+ INT16 HlpLnV[20];
+ BYTE LnAnzH;
+ BYTE LnAnzV;
+ UCHAR PgName[32]; // Seitenname
+ friend SvStream& operator>>(SvStream& rIStream, PageType& rPage);
+};
+
+
+enum ObjArtType {ObjStrk,ObjRect,ObjPoly,ObjCirc,ObjSpln,
+ ObjText,ObjGrup,ObjBmap,ObjVirt,ObjTxtX,ObjMaxi};
+
+struct ObjLineType {
+ BYTE LFarbe; // [Index]
+ BYTE LBFarbe; // [Index]
+ BYTE LIntens; // [%]
+ BYTE LMuster; // [Index] inkl. Transparenz
+ INT16 LMSize; // [Koeffizient/100]
+ INT16 LDicke; // Strichstïż½rke
+};
+
+struct ObjAreaType {
+ BYTE FFarbe; // [Index]
+ BYTE FBFarbe; // [Index]
+ BYTE FIntens; // [%]
+ BYTE FDummy1; //
+ INT16 FDummy2; //
+ UINT16 FMuster; // [Index] inkl. Invers, Transparenz
+};
+
+#define ObjTextTypeSize 64
+class ObjTextType {
+public:
+ ObjLineType L; // Text-Outline (future)
+ ObjAreaType F; // Text innen
+ UINT16 FontLo,FontHi;// z.B. 92500 (CG Times), zweigeteilt wegen DWordAllign in TextType.
+ UINT16 Grad; // 0.5..32767.5 Pt - bei 1000 Pt sollte aber schluïż½ sein
+ UINT16 Breite; // 1..65535% bitte nicht mehr als 500%
+ BYTE Justify; // 2 Bit Vert (Hi), 3 Bit Hor (Lo)
+ BYTE Kapit; // 1..255%
+ UINT16 Schnitt; // 8 Flags
+ UINT16 LnFeed; // 1..32767% vom max. Schriftgrad der Zeile
+ UINT16 Slant; // Kursivwinkel 0.00..89.99ïż½ default 15.00ïż½ doppelt Breit angesehen)
+ BYTE ZAbst; // Zeichenabstand 0..255% (0=auf der Stelle; 100=normal; 200=Zeichen wird als
+ INT8 ChrVPos; // Zeichen V-Position default 0= on Baseline, 10= 5Pt drunter (-64..63ïż½)
+ ObjLineType ShdL; // Schatten-Outline (neu 2.0)
+ ObjAreaType ShdF; // Schatten-innen (neu 2.0)
+ PointType ShdVers; // Schattenversatz Max.300.00%
+ BOOL ShdAbs; // True-> Schattenversatz ist absolut statt relativ zum Schriftgrad
+ BOOL NoSpc; // True-> kein Zwischenraum (fïż½r BackArea)
+ ObjAreaType BackF; // Hintergrundflïż½che
+ UINT32 GetFont();
+ void SetFont(UINT32 FontID);
+};
+
+class Obj0Type { // SuperClass fïż½r Apple-VMT
+public:
+ virtual void Draw(OutputDevice& rOut);
+ virtual ~Obj0Type() {}
+};
+
+#define ObjkSize 20 /* eigentlich 21. Wg. Allignment ist Flags jedoch verschoben worden*/
+class ObjkType: public Obj0Type { // Grundkomponenten aller Stardraw-Objekte
+public:
+ UINT32 Last;
+ UINT32 Next;
+ UINT16 MemSize; // in Bytes
+ PointType ObjMin; // XY-Minimum des Objekts
+ PointType ObjMax; // XY-Maximum des Objekts
+ BYTE Art;
+ BYTE Layer;
+// BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ friend SvStream& operator>>(SvStream& rIStream, ObjkType& rObjk);
+ friend BOOL ObjOverSeek(SvStream& rInp, ObjkType& rObjk);
+ virtual void Draw(OutputDevice& rOut);
+};
+
+
+#define StrkSize 38
+class StrkType: public ObjkType {
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE LEnden; // Linienenden
+ ObjLineType L;
+ PointType Pos1; // Anfangspunkt
+ PointType Pos2; // Endpunkt
+ friend SvStream& operator>>(SvStream& rIStream, StrkType& rStrk);
+ virtual void Draw(OutputDevice& rOut);
+};
+
+
+#define RectSize 52
+class RectType: public ObjkType {
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE Reserve;
+ ObjLineType L;
+ ObjAreaType F;
+ PointType Pos1; // LO-Ecke = Bezugspunkt
+ PointType Pos2; // R-Ecke
+ INT16 Radius; // Eckenradius
+ UINT16 DrehWink; // 315...<45
+ UINT16 Slant; // >270...<90
+ friend SvStream& operator>>(SvStream& rIStream, RectType& rRect);
+ virtual void Draw(OutputDevice& rOut);
+};
+
+
+#define PolySize 44
+class PolyType: public ObjkType { // identisch mit Spline !
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE LEnden; // nur fïż½r Polyline
+ ObjLineType L;
+ ObjAreaType F; // nicht fïż½r Polyline
+ BYTE nPoints;
+ BYTE Reserve;
+ UINT32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw)
+ PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!))
+ friend SvStream& operator>>(SvStream& rIStream, PolyType& rPoly);
+ virtual void Draw(OutputDevice& rOut);
+};
+#define PolyClosBit 0x01 // Unterarten von Poly: 0: PolyLine 1: Polygon
+
+
+#define SplnSize 44
+class SplnType: public ObjkType { // identisch mit Poly !
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE LEnden; // nur fïż½r nSpline
+ ObjLineType L;
+ ObjAreaType F; // nicht fïż½r nSpline
+ BYTE nPoints;
+ BYTE Reserve;
+ UINT32 SD_EckP; // Zeiger auf die Eckpunkte (StarDraw)
+ PointType* EckP; // Zeiger auf die Eckpunkte (StarView (wird nicht von Disk gelesen!))
+ friend SvStream& operator>>(SvStream& rIStream, SplnType& rSpln);
+ virtual void Draw(OutputDevice& rOut);
+};
+// Unterarten von Spline: siehe Poly
+
+
+#define CircSize 52
+class CircType: public ObjkType {
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE LEnden; // nur Bogen (Kr & El)
+ ObjLineType L;
+ ObjAreaType F; // nicht fïż½r Bogen (Kr & El)
+ PointType Center; // Mittelpunkt
+ PointType Radius; // Radius
+ UINT16 DrehWink; // nur Ellipse
+ UINT16 StartWink; // ïż½ nicht fïż½r Vollkreis
+ UINT16 RelWink; // ïż½ und Vollellipse
+ friend SvStream& operator>>(SvStream& rIStream, CircType& rCirc);
+ virtual void Draw(OutputDevice& rOut);
+};
+#define CircFull 0x00 /* Unterarten von Kreis: 0: Kreis */
+#define CircSect 0x01 /* 1: Kreissektor */
+#define CircAbsn 0x02 /* 2: Kreisabschnitt */
+#define CircArc 0x03 /* 3: Kreisbogen */
+
+
+#define TextSize 116
+class TextType: public ObjkType {
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE Reserve; // fïż½r Word Allign
+ ObjTextType T; // 64 Bytes << DWord-Allign bei FontID erforderlich
+ PointType Pos1; // Bezugspunkt (ObenLinks)
+ PointType Pos2; // (untenRechts)
+ INT16 TopOfs; // Von Oberkante bis Textbegin (future fïż½r vJustify)
+ UINT16 DrehWink; // 0...<360
+ UINT16 BoxSlant; // >270...<90 (nur Box)
+ UINT16 BufSize; // Grïż½ïż½e von Buf fïż½r Load, Save, Copy und so
+ UINT16 BufLo,BufHi;// (UCHAR*) Zeiger auf den Textbuffer << ShortArr, weil sonst DWord-Allign erforderlich
+ UINT16 ExtLo,ExtHi;// (Ptr) Text ïż½ber mehrere Rahmen << ShortArr, weil sonst DWord-Allign erforderlich
+ PointType FitSize; // Ursprungsgrïż½ïż½e fïż½r Fit2Size
+ INT16 FitBreit; // Breite zum formatieren bei Fit2Size
+ UCHAR* Buffer; // Diese Variable wird nicht durch Lesen von Disk gefïż½llt, sondern explizit!
+ friend SvStream& operator>>(SvStream& rIStream, TextType& rText);
+ virtual void Draw(OutputDevice& rOut);
+};
+#define TextOutlBit 0x01 /* 1=Sourcecode fïż½r Outliner (wird von DrawObjekt() ignoriert) */
+#define TextFitSBit 0x02 /* Bit1: 1=Text-FitToSize, auch Outliner (2.0) */
+#define TextFitZBit 0x08 /* Bit3: 1=Fit2Size Zeilenweise (2.0) */
+#define TextDrftBit 0x04 /* Bit2: 1=DraftDraw (2.0) */
+#define TextFitBits (TextFitSBit | TextFitZBit)
+
+
+enum GrafStat {NoGraf,Pic,Pcx,Hpgl,Img,Msp,Tiff,Dxf,Lot,Usr,Sgf};
+
+#define BmapSize 132
+class BmapType: public ObjkType {
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ BYTE Reserve;
+ ObjAreaType F; // Farbe und Muster der 1-Plane Bitmap
+ PointType Pos1;
+ PointType Pos2;
+ UINT16 DrehWink; // 315...<45 (Future)
+ UINT16 Slant; // >270...<90 (Future)
+ UCHAR Filename[80]; // Pfad
+ PointType PixSize; // Grïż½ïż½e in Pixel (0 bei Vektor)
+ GrafStat Format; // siehe GpmDef.Pas
+ BYTE nPlanes; // Anzahl der Bitplanes (0 bei Vektor)
+ BOOL RawOut; // als Raw ausgeben ?
+ BOOL InvOut; // invertiert ausgeben ?
+ BOOL LightOut; // aufhellen? (SD20)
+ BYTE GrfFlg; // (SD20) 0=nSGF 1=Pcx 2=Hpgl 4=Raw $FF=Undef(fïż½r Fix in DrawBmp)
+
+ INetURLObject aFltPath; // Fïż½r GraphicFilter
+ friend SvStream& operator>>(SvStream& rIStream, BmapType& rBmap);
+ virtual void Draw(OutputDevice& rOut);
+ void SetPaths( const INetURLObject rFltPath );
+};
+
+
+#define GrupSize 48
+class GrupType: public ObjkType {
+public:
+ BYTE Flags; // (Schummel fïż½r Allignment unter NT)
+ UCHAR Name[13]; // Name der Gruppe
+ UINT16 SbLo,SbHi; // (Ptr) Gruppenliste << ShortArr, weil sonst DWord Allign erforderlich
+ UINT16 UpLo,UpHi; // (Ptr) Vaterliste << ShortArr, weil sonst DWord Allign erforderlich
+ UINT16 ChartSize; // Speicherbedarf der Diagrammstruktur Struktur
+ UINT32 ChartPtr; // Diagrammstruktur
+ UINT32 GetSubPtr(); // hier nur zum Checken, ob Sublist evtl. leer ist.
+ friend SvStream& operator>>(SvStream& rIStream, GrupType& rGrup);
+// virtual void Draw(OutputDevice& rOut);
+};
+
+
+void SetLine(ObjLineType& rLine, OutputDevice& rOut);
+void SetArea(ObjAreaType& rArea, OutputDevice& rOut);
+Color Sgv2SvFarbe(BYTE nFrb1, BYTE nFrb2, BYTE nInts);
+void RotatePoint(PointType& P, INT16 cx, INT16 cy, double sn, double cs);
+void RotatePoint(Point& P, INT16 cx, INT16 cy, double sn, double cs);
+INT16 iMulDiv(INT16 a, INT16 Mul, INT16 Div);
+UINT16 MulDiv(UINT16 a, UINT16 Mul, UINT16 Div);
+
+
+class SgfFontOne {
+public:
+ SgfFontOne* Next; // Zeiger fïż½r Listenverkettung
+ UINT32 IFID;
+ BOOL Bold;
+ BOOL Ital;
+ BOOL Sans;
+ BOOL Serf;
+ BOOL Fixd;
+ FontFamily SVFamil;
+ CharSet SVChSet;
+ String SVFName; // z.B. "Times New Roman" = 15 Chars
+ USHORT SVWidth; // Durchschnittliche Zeichenbreite in %
+ SgfFontOne();
+ void ReadOne( ByteString& ID, ByteString& Dsc);
+};
+
+class SgfFontLst {
+public:
+ String FNam; // vollstïż½ndiger Filename des Inifiles
+ SgfFontOne* pList; // Listenanfang
+ SgfFontOne* Last; // Listenende
+ UINT32 LastID; // fïż½r schnelleren Zugriff bei Wiederholungen
+ SgfFontOne* LastLn; // fïż½r schnelleren Zugriff bei Wiederholungen
+ BOOL Tried;
+ SgfFontLst();
+ ~SgfFontLst();
+ void AssignFN(const String& rFName);
+ void ReadList();
+ void RausList();
+ SgfFontOne* GetFontDesc(UINT32 ID);
+};
+
+#endif //_SGVMAIN_HXX
+
+
diff --git a/svtools/source/inc/sgvspln.hxx b/svtools/source/inc/sgvspln.hxx
new file mode 100644
index 000000000000..7e9976eaf25b
--- /dev/null
+++ b/svtools/source/inc/sgvspln.hxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * 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: sgvspln.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SGVSPLN_HXX
+#define _SGVSPLN_HXX
+
+/*************************************************************************
+|*
+|* CalcSpline()
+|*
+|* Beschreibung Berechnet die Koeffizienten eines parametrischen
+|* natrlichen oder periodischen kubischen
+|* Polynomsplines. Die Eckpunkte des šbergebenen
+|* Polygons werden als Sttzstellen angenommen.
+|* n liefert die Anzahl der Teilpolynome.
+|* Ist die Berechnung fehlerfrei verlaufen, so
+|* liefert die Funktion TRUE. Nur in diesem Fall
+|* ist Speicher fr die Koeffizientenarrays
+|* allokiert, der dann sp„ter vom Aufrufer mittels
+|* delete freizugeben ist.
+|* Ersterstellung JOE 17-08.93
+|* Letzte Aenderung JOE 17-08.93
+|*
+*************************************************************************/
+
+BOOL CalcSpline(Polygon& rPoly, BOOL Periodic, USHORT& n,
+ double*& ax, double*& ay, double*& bx, double*& by,
+ double*& cx, double*& cy, double*& dx, double*& dy, double*& T);
+
+/*************************************************************************
+|*
+|* Poly2Spline()
+|*
+|* Beschreibung Konvertiert einen parametrichen kubischen
+|* Polynomspline Spline (natrlich oder periodisch)
+|* in ein angen„hertes Polygon.
+|* Die Funktion liefert FALSE, wenn ein Fehler bei
+|* der Koeffizientenberechnung aufgetreten ist oder
+|* das Polygon zu groá wird (>PolyMax=16380). Im 1.
+|* Fall hat das Polygon 0, im 2. Fall PolyMax Punkte.
+|* Um Koordinatenberl„ufe zu vermeiden werden diese
+|* auf +/-32000 begrenzt.
+|* Ersterstellung JOE 23.06.93
+|* Letzte Aenderung JOE 23.06.93
+|*
+*************************************************************************/
+BOOL Spline2Poly(Polygon& rSpln, BOOL Periodic, Polygon& rPoly);
+
+#endif //_SGVSPLN_HXX
diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx
new file mode 100644
index 000000000000..10463fc05906
--- /dev/null
+++ b/svtools/source/inc/svimpbox.hxx
@@ -0,0 +1,477 @@
+/*************************************************************************
+ *
+ * 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: svimpbox.hxx,v $
+ * $Revision: 1.22 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SVIMPLBOX_HXX
+#define _SVIMPLBOX_HXX
+
+#ifndef _SELENG_HXX
+#include <vcl/seleng.hxx>
+#endif
+#ifndef _SCRBAR_HXX
+#include <vcl/scrbar.hxx>
+#endif
+#include <vcl/vclevent.hxx>
+// #102891# ----------------
+#include <unotools/intlwrapper.hxx>
+// #97680# -----------------
+#include <vector>
+#include "svtaccessiblefactory.hxx"
+
+class SvTreeListBox;
+class Point;
+class DropEvent;
+class SvLBoxTreeList;
+class SvImpLBox;
+class SvLBoxEntry;
+class SvLBoxItem;
+class SvLBoxTab;
+class TabBar;
+
+class ImpLBSelEng : public FunctionSet
+{
+ SvImpLBox* pImp;
+ SelectionEngine* pSelEng;
+ SvTreeListBox* pView;
+
+public:
+ ImpLBSelEng( SvImpLBox* pImp, SelectionEngine* pSelEng,
+ SvTreeListBox* pView );
+ virtual ~ImpLBSelEng();
+ void BeginDrag();
+ void CreateAnchor();
+ void DestroyAnchor();
+ BOOL SetCursorAtPoint( const Point& rPoint,
+ BOOL bDontSelectAtCursor=FALSE );
+ BOOL IsSelectionAtPoint( const Point& rPoint );
+ void DeselectAtPoint( const Point& rPoint );
+ void DeselectAll();
+};
+
+// Flags fuer nFlag
+#define F_VER_SBARSIZE_WITH_HBAR 0x0001
+#define F_HOR_SBARSIZE_WITH_VBAR 0x0002
+#define F_IGNORE_NEXT_MOUSEMOVE 0x0004 // OS/2 only
+#define F_IN_SCROLLING 0x0008
+#define F_DESEL_ALL 0x0010
+#define F_START_EDITTIMER 0x0020 // MAC only
+#define F_IGNORE_SELECT 0x0040
+#define F_IN_RESIZE 0x0080
+#define F_REMOVED_ENTRY_INVISIBLE 0x0100
+#define F_REMOVED_RECALC_MOST_RIGHT 0x0200
+#define F_IGNORE_CHANGED_TABS 0x0400
+#define F_PAINTED 0x0800
+#define F_IN_PAINT 0x1000
+#define F_ENDSCROLL_SET_VIS_SIZE 0x2000
+#define F_FILLING 0x4000
+
+
+class SvImpLBox
+{
+friend class ImpLBSelEng;
+friend class SvTreeListBox;
+private:
+ SvTreeListBox* pView;
+ SvLBoxTreeList* pTree;
+ SvLBoxEntry* pCursor;
+ SvLBoxEntry* pStartEntry;
+ SvLBoxEntry* pAnchor;
+ SvLBoxEntry* pMostRightEntry;
+ SvLBoxButton* pActiveButton;
+ SvLBoxEntry* pActiveEntry;
+ SvLBoxTab* pActiveTab;
+ TabBar* pTabBar;
+
+ ScrollBar aVerSBar;
+ ScrollBar aHorSBar;
+ ScrollBarBox aScrBarBox;
+
+ ::svt::AccessibleFactoryAccess
+ m_aFactoryAccess;
+
+ static Image* s_pDefCollapsed;
+ static Image* s_pDefExpanded;
+ static Image* s_pDefCollapsedHC;
+ static Image* s_pDefExpandedHC;
+ static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed
+
+ // Node Bitmaps
+ enum ImageType
+ {
+ itNodeExpanded = 0, // node is expanded ( usually a bitmap showing a minus )
+ itNodeCollapsed, // node is collapsed ( usually a bitmap showing a plus )
+ itNodeDontKnow, // don't know the node state
+ itEntryDefExpanded, // default for expanded entries
+ itEntryDefCollapsed, // default for collapsed entries
+
+ IT_IMAGE_COUNT
+ };
+
+ // all our images
+ Image m_aNodeAndEntryImages[ IT_IMAGE_COUNT ];
+ // plus the high contrast versions
+ Image m_aNodeAndEntryImages_HC[ IT_IMAGE_COUNT ];
+
+ // wg. kompat. hier
+ Size aOutputSize;
+ SelectionEngine aSelEng;
+ ImpLBSelEng aFctSet;
+ Timer aAsyncBeginDragTimer;
+ Point aAsyncBeginDragPos;
+
+ long nYoffsNodeBmp;
+ long nNodeBmpTabDistance; // typisch kleiner 0
+ long nNodeBmpWidth;
+ long nNextVerVisSize;
+ long nMostRight;
+ ULONG nVisibleCount; // Anzahl Zeilen im Control
+ ULONG nCurUserEvent; //-1 == kein Userevent amn Laufen
+ short nHorSBarHeight, nVerSBarWidth;
+ USHORT nFlags;
+ USHORT nCurTabPos;
+
+ WinBits nWinBits;
+ ExtendedWinBits nExtendedWinBits;
+ BOOL bSimpleTravel : 1; // ist TRUE bei SINGLE_SELECTION
+ BOOL bUpdateMode : 1;
+ BOOL bInVScrollHdl : 1;
+ BOOL bAsyncBeginDrag : 1;
+ BOOL bSubLstOpRet : 1; // open/close sublist with return/enter, defaulted with FALSE
+ BOOL bSubLstOpLR : 1; // open/close sublist with cursor left/right, defaulted with FALSE
+ BOOL bContextMenuHandling : 1;
+ BOOL bIsCellFocusEnabled : 1;
+
+ sal_Bool bAreChildrenTransient;
+
+ Point aEditClickPos;
+ Timer aEditTimer;
+
+ // #102891# -------------------
+ IntlWrapper * pIntlWrapper;
+
+ // #97680# --------------------
+ std::vector< short > aContextBmpWidthVector;
+
+ DECL_LINK( EditTimerCall, Timer * );
+
+ DECL_LINK( BeginDragHdl, void* );
+ DECL_LINK( MyUserEvent,void*);
+ void StopUserEvent();
+
+ void InvalidateEntriesFrom( long nY ) const;
+ void InvalidateEntry( long nY ) const;
+ void ShowVerSBar();
+ // setzt Thumb auf FirstEntryToDraw
+ void SyncVerThumb();
+ BOOL IsLineVisible( long nY ) const;
+ long GetEntryLine( SvLBoxEntry* pEntry ) const;
+ void FillView();
+ void CursorDown();
+ void CursorUp();
+ void KeyLeftRight( long nDiff );
+ void PageDown( USHORT nDelta );
+ void PageUp( USHORT nDelta );
+
+ void SetCursor( SvLBoxEntry* pEntry, BOOL bForceNoSelect = FALSE );
+
+ void DrawNet();
+
+ // ScrollBar-Handler
+ DECL_LINK( ScrollUpDownHdl, ScrollBar * );
+ DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
+ DECL_LINK( EndScrollHdl, ScrollBar * );
+
+ void SetNodeBmpYOffset( const Image& );
+ void SetNodeBmpTabDistance();
+
+ // Selection-Engine
+ SvLBoxEntry* MakePointVisible( const Point& rPoint,
+ BOOL bNotifyScroll=TRUE );
+
+ void SetAnchorSelection( SvLBoxEntry* pOld,
+ SvLBoxEntry* pNewCursor );
+ void BeginDrag();
+ BOOL ButtonDownCheckCtrl( const MouseEvent& rMEvt,
+ SvLBoxEntry* pEntry, long nY );
+ BOOL MouseMoveCheckCtrl( const MouseEvent& rMEvt,
+ SvLBoxEntry* pEntry );
+ BOOL ButtonUpCheckCtrl( const MouseEvent& rMEvt );
+ BOOL ButtonDownCheckExpand( const MouseEvent&,
+ SvLBoxEntry*,long nY );
+
+ void PositionScrollBars( Size& rOSize, USHORT nMask );
+ USHORT AdjustScrollBars( Size& rSize );
+
+ void BeginScroll();
+ void EndScroll();
+ BOOL InScroll() const { return (BOOL)(nFlags & F_IN_SCROLLING)!=0;}
+ Rectangle GetVisibleArea() const;
+ BOOL EntryReallyHit(SvLBoxEntry* pEntry,const Point& rPos,long nLine);
+ void InitScrollBarBox();
+ SvLBoxTab* NextTab( SvLBoxTab* );
+
+ BOOL SetMostRight( SvLBoxEntry* pEntry );
+ void FindMostRight( SvLBoxEntry* EntryToIgnore );
+ void FindMostRight( SvLBoxEntry* pParent, SvLBoxEntry* EntryToIgnore );
+ void FindMostRight_Impl( SvLBoxEntry* pParent,SvLBoxEntry* EntryToIgnore );
+ void NotifyTabsChanged();
+
+ inline BOOL IsExpandable() const // if element at cursor can be expanded in general
+ { return pCursor->HasChilds() || pCursor->HasChildsOnDemand(); }
+ inline BOOL IsNowExpandable() const // if element at cursor can be expanded at this moment
+ { return IsExpandable() && !pView->IsExpanded( pCursor ); }
+
+ static void implInitDefaultNodeImages();
+
+ // #102891# -------------------
+ void UpdateIntlWrapper();
+
+ // #97680# --------------------
+ short UpdateContextBmpWidthVector( SvLBoxEntry* pEntry, short nWidth );
+ void UpdateContextBmpWidthMax( SvLBoxEntry* pEntry );
+ void UpdateContextBmpWidthVectorFromMovedEntry( SvLBoxEntry* pEntry );
+
+ void CalcCellFocusRect( SvLBoxEntry* pEntry, Rectangle& rRect );
+
+ inline sal_Bool AreChildrenTransient() const { return bAreChildrenTransient; }
+ inline void SetChildrenNotTransient() { bAreChildrenTransient = sal_False; }
+
+public:
+ SvImpLBox( SvTreeListBox* pView, SvLBoxTreeList*, WinBits nWinStyle );
+ ~SvImpLBox();
+
+ void Clear();
+ void SetWindowBits( WinBits nWinStyle );
+ void SetExtendedWindowBits( ExtendedWinBits _nBits );
+ ExtendedWinBits GetExtendedWindowBits() const { return nExtendedWinBits; }
+ void SetModel( SvLBoxTreeList* pModel ) { pTree = pModel;}
+
+ void EntryInserted( SvLBoxEntry*);
+ void RemovingEntry( SvLBoxEntry* pEntry );
+ void EntryRemoved();
+ void MovingEntry( SvLBoxEntry* pEntry );
+ void EntryMoved( SvLBoxEntry* pEntry );
+ void TreeInserted( SvLBoxEntry* pEntry );
+
+ void IndentChanged( short nIndentPixel );
+ void EntryExpanded( SvLBoxEntry* pEntry );
+ void EntryCollapsed( SvLBoxEntry* pEntry );
+ void CollapsingEntry( SvLBoxEntry* pEntry );
+ void EntrySelected( SvLBoxEntry*, BOOL bSelect );
+
+ void Paint( const Rectangle& rRect );
+ void RepaintSelectionItems();
+ void MouseButtonDown( const MouseEvent& );
+ void MouseButtonUp( const MouseEvent& );
+ void MouseMove( const MouseEvent&);
+ BOOL KeyInput( const KeyEvent& );
+ void Resize();
+ void GetFocus();
+ void LoseFocus();
+ void UpdateAll(
+ BOOL bInvalidateCompleteView= TRUE,
+ BOOL bUpdateVerSBar = TRUE );
+ void SetEntryHeight( short nHeight );
+ void PaintEntry( SvLBoxEntry* pEntry );
+ void InvalidateEntry( SvLBoxEntry* );
+ void RecalcFocusRect();
+
+ inline void SelectEntry( SvLBoxEntry* pEntry, BOOL bSelect );
+ void SetDragDropMode( DragDropMode eDDMode );
+ void SetSelectionMode( SelectionMode eSelMode );
+ void SetAddMode( BOOL ) { aSelEng.AddAlways(FALSE); }
+ BOOL IsAddMode() const { return aSelEng.IsAlwaysAdding(); }
+
+ SvLBoxEntry* GetCurrentEntry() const { return pCursor; }
+ BOOL IsEntryInView( SvLBoxEntry* ) const;
+ SvLBoxEntry* GetEntry( const Point& rPos ) const;
+ // gibt letzten Eintrag zurueck, falls Pos unter letztem Eintrag
+ SvLBoxEntry* GetClickedEntry( const Point& ) const;
+ SvLBoxEntry* GetCurEntry() const { return pCursor; }
+ void SetCurEntry( SvLBoxEntry* );
+ Point GetEntryPosition( SvLBoxEntry* ) const;
+ void MakeVisible( SvLBoxEntry* pEntry, BOOL bMoveToTop=FALSE );
+
+ void PaintDDCursor( SvLBoxEntry* );
+
+ // Images
+ inline Image& implGetImageLocation( const ImageType _eType, BmpColorMode _eMode );
+ inline Image& implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const;
+
+ inline void SetExpandedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
+ inline void SetCollapsedNodeBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
+ inline void SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
+
+ inline const Image& GetExpandedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+ inline const Image& GetCollapsedNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+ inline const Image& GetDontKnowNodeBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL ) const;
+
+ inline void SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
+ inline void SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode = BMP_COLOR_NORMAL );
+ inline const Image& GetDefaultEntryExpBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL );
+ inline const Image& GetDefaultEntryColBmp( BmpColorMode _eMode = BMP_COLOR_NORMAL );
+
+ static const Image& GetDefaultExpandedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL );
+ static const Image& GetDefaultCollapsedNodeImage( BmpColorMode _eMode = BMP_COLOR_NORMAL );
+
+ const Size& GetOutputSize() const { return aOutputSize;}
+ void KeyUp( BOOL bPageUp, BOOL bNotifyScroll = TRUE );
+ void KeyDown( BOOL bPageDown, BOOL bNotifyScroll = TRUE );
+ void Command( const CommandEvent& rCEvt );
+
+ void Invalidate();
+ void DestroyAnchor() { pAnchor=0; aSelEng.Reset(); }
+ void SelAllDestrAnch( BOOL bSelect,
+ BOOL bDestroyAnchor = TRUE,
+ BOOL bSingleSelToo = FALSE );
+ void ShowCursor( BOOL bShow );
+
+ BOOL RequestHelp( const HelpEvent& rHEvt );
+ void EndSelection();
+ BOOL IsNodeButton( const Point& rPosPixel, SvLBoxEntry* pEntry ) const;
+ void RepaintScrollBars();
+ void EnableAsyncDrag( BOOL b) { bAsyncBeginDrag = b; }
+ void SetUpdateMode( BOOL );
+ void SetUpdateModeFast( BOOL );
+ BOOL GetUpdateMode() const { return bUpdateMode; }
+ Rectangle GetClipRegionRect() const;
+ BOOL HasHorScrollBar() const { return aHorSBar.IsVisible(); }
+ void ShowFocusRect( const SvLBoxEntry* pEntry );
+ void SetTabBar( TabBar* pTabBar );
+ void CancelPendingEdit();
+
+ void CallEventListeners( ULONG nEvent, void* pData = NULL );
+
+ /** Enables, that one cell of a tablistbox entry can be focused */
+ inline BOOL IsCellFocusEnabled() const { return bIsCellFocusEnabled; }
+ inline void EnableCellFocus() { bIsCellFocusEnabled = TRUE; }
+ bool SetCurrentTabPos( USHORT _nNewPos );
+ inline USHORT GetCurrentTabPos() const { return nCurTabPos; }
+
+ bool IsSelectable( const SvLBoxEntry* pEntry );
+};
+
+inline Image& SvImpLBox::implGetImageLocation( const ImageType _eType, BmpColorMode _eMode )
+{
+ DBG_ASSERT( ( BMP_COLOR_HIGHCONTRAST == _eMode ) || ( BMP_COLOR_NORMAL == _eMode ),
+ "SvImpLBox::implGetImageLocation: invalid mode!" );
+ DBG_ASSERT( ( _eType >= 0 ) && ( _eType < IT_IMAGE_COUNT ),
+ "SvImpLBox::implGetImageLocation: invalid image index (will crash)!" );
+
+ Image* _pSet = ( BMP_COLOR_HIGHCONTRAST == _eMode ) ? m_aNodeAndEntryImages_HC : m_aNodeAndEntryImages;
+ return *( _pSet + (sal_Int32)_eType );
+}
+
+inline Image& SvImpLBox::implGetImageLocationWithFallback( const ImageType _eType, BmpColorMode _eMode ) const
+{
+ Image& rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, _eMode );
+ if ( !rImage )
+ // fallback to normal images in case the one for the special mode has not been set
+ rImage = const_cast< SvImpLBox* >( this )->implGetImageLocation( _eType, BMP_COLOR_NORMAL );
+ return rImage;
+}
+
+inline void SvImpLBox::SetDontKnowNodeBmp( const Image& rImg, BmpColorMode _eMode )
+{
+ implGetImageLocation( itNodeDontKnow, _eMode ) = rImg;
+}
+
+inline void SvImpLBox::SetExpandedNodeBmp( const Image& rImg, BmpColorMode _eMode )
+{
+ implGetImageLocation( itNodeExpanded, _eMode ) = rImg;
+ SetNodeBmpYOffset( rImg );
+}
+
+inline void SvImpLBox::SetCollapsedNodeBmp( const Image& rImg, BmpColorMode _eMode )
+{
+ implGetImageLocation( itNodeCollapsed, _eMode ) = rImg;
+ SetNodeBmpYOffset( rImg );
+}
+
+inline const Image& SvImpLBox::GetDontKnowNodeBmp( BmpColorMode _eMode ) const
+{
+ return implGetImageLocationWithFallback( itNodeDontKnow, _eMode );
+}
+
+inline const Image& SvImpLBox::GetExpandedNodeBmp( BmpColorMode _eMode ) const
+{
+ return implGetImageLocationWithFallback( itNodeExpanded, _eMode );
+}
+
+inline const Image& SvImpLBox::GetCollapsedNodeBmp( BmpColorMode _eMode ) const
+{
+ return implGetImageLocationWithFallback( itNodeCollapsed, _eMode );
+}
+
+inline void SvImpLBox::SetDefaultEntryExpBmp( const Image& _rImg, BmpColorMode _eMode )
+{
+ implGetImageLocation( itEntryDefExpanded, _eMode ) = _rImg;
+}
+
+inline void SvImpLBox::SetDefaultEntryColBmp( const Image& _rImg, BmpColorMode _eMode )
+{
+ implGetImageLocation( itEntryDefCollapsed, _eMode ) = _rImg;
+}
+
+inline const Image& SvImpLBox::GetDefaultEntryExpBmp( BmpColorMode _eMode )
+{
+ return implGetImageLocationWithFallback( itEntryDefExpanded, _eMode );
+}
+
+inline const Image& SvImpLBox::GetDefaultEntryColBmp( BmpColorMode _eMode )
+{
+ return implGetImageLocationWithFallback( itEntryDefCollapsed, _eMode );
+}
+
+inline Point SvImpLBox::GetEntryPosition( SvLBoxEntry* pEntry ) const
+{
+ return Point( 0, GetEntryLine( pEntry ) );
+}
+
+inline void SvImpLBox::PaintEntry( SvLBoxEntry* pEntry )
+{
+ long nY = GetEntryLine( pEntry );
+ pView->PaintEntry( pEntry, nY );
+}
+
+inline BOOL SvImpLBox::IsLineVisible( long nY ) const
+{
+ BOOL bRet = TRUE;
+ if ( nY < 0 || nY >= aOutputSize.Height() )
+ bRet = FALSE;
+ return bRet;
+}
+
+inline void SvImpLBox::TreeInserted( SvLBoxEntry* pInsTree )
+{
+ EntryInserted( pInsTree );
+}
+
+#endif // #ifndef _SVIMPLBOX_HXX
+
diff --git a/svtools/source/inc/svimpicn.hxx b/svtools/source/inc/svimpicn.hxx
new file mode 100644
index 000000000000..724a92543700
--- /dev/null
+++ b/svtools/source/inc/svimpicn.hxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * 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: svimpicn.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SVIMPICN_HXX
+#define _SVIMPICN_HXX
+
+#ifndef _VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+
+#ifndef _SCRBAR_HXX
+#include <vcl/scrbar.hxx>
+#endif
+#include <limits.h>
+
+class SvLBoxEntry;
+class SvLBoxTreeList;
+class SvImpIconView;
+class ImpIcnCursor;
+class SvPtrarr;
+
+#define PAINTFLAG_HOR_CENTERED 0x0001
+#define PAINTFLAG_VER_CENTERED 0x0002
+
+#define SELRECT_BORDER_OFFS -7
+// Flags
+#define F_VER_SBARSIZE_WITH_HBAR 0x00000001
+#define F_HOR_SBARSIZE_WITH_VBAR 0x00000002
+#define F_IGNORE_NEXT_MOUSEMOVE 0x00000004 // OS/2 only
+#define F_ENTRY_REMOVED 0x00000008
+// ist gesetzt, wenn nach Clear oder Ctor mind. einmal gepaintet wurde
+#define F_PAINTED 0x00000010
+#define F_ADD_MODE 0x00000020
+#define F_MOVING_SIBLING 0x00000040
+#define F_SELRECT_VISIBLE 0x00000080
+#define F_CMD_ARRIVED 0x00000100
+#define F_DRAG_SOURCE 0x00000200
+#define F_GRIDMODE 0x00000400
+// beim Einfuegen eines Eintrags ergibt sich dessen Position
+// durch simples Addieren auf die Position des zuletzt eingefuegten Eintrags
+#define F_GRID_INSERT 0x00000800
+#define F_DOWN_CTRL 0x00001000
+#define F_DOWN_DESELECT 0x00002000
+// Hack fuer D&D: Hintergrund des Entries nicht painten
+#define F_NO_EMPHASIS 0x00004000
+// Selektion per Gummiband
+#define F_RUBBERING 0x00008000
+#define F_START_EDITTIMER_IN_MOUSEUP 0x00010000
+
+class SvImpIconView
+{
+ friend class ImpIcnCursor;
+ ScrollBar aVerSBar;
+ ScrollBar aHorSBar;
+ Rectangle aCurSelectionRect;
+ SvPtrarr aSelectedRectList;
+ MouseEvent aMouseMoveEvent;
+ Timer aEditTimer; // fuer Inplace-Editieren
+ Timer aMouseMoveTimer; // generiert MouseMoves bei Gummibandselektion
+ // Boundrect des zuletzt eingefuegten Entries
+ Rectangle aPrevBoundRect;
+ Size aOutputSize; // Pixel
+ Size aVirtOutputSize; // expandiert automatisch
+ Point aDDLastEntryPos;
+ Point aDDLastRectPos;
+
+ SvLBoxTreeList* pModel;
+ SvIconView* pView;
+ ImpIcnCursor* pImpCursor;
+ long nMaxVirtWidth; // max.breite aVirtOutputSize
+ SvPtrarr* pZOrderList;
+ long nGridDX,
+ nGridDY;
+ long nHorSBarHeight,
+ nVerSBarWidth;
+ WinBits nWinBits;
+ int nViewMode;
+ long nHorDist;
+ long nVerDist;
+ long nMaxBmpWidth;
+ long nMaxBmpHeight;
+ long nMaxTextWidth;
+ long nMaxBoundHeight; // Hoehe des hoechsten BoundRects
+ ULONG nFlags;
+ ULONG nCurUserEvent;
+ SvLBoxEntry* pCurParent;
+ SvLBoxEntry* pCursor;
+ SvLBoxEntry* pNextCursor; // wird in MovingEntry gesetzt und ist
+ // nur in EntryMoved gueltig!
+ SvLBoxEntry* pDDRefEntry;
+ VirtualDevice* pDDDev;
+ VirtualDevice* pDDBufDev;
+ VirtualDevice* pDDTempDev;
+
+ SvIconViewTextMode eTextMode;
+ BOOL bMustRecalcBoundingRects;
+
+ void CheckAllSizes();
+ void CheckSizes( SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData = 0 );
+ void ShowCursor( BOOL bShow );
+
+ void SetNextEntryPos(const Point& rPos);
+ Point FindNextEntryPos( const Size& rBoundSize );
+ void ImpArrange();
+ void AdjustVirtSize( const Rectangle& );
+ void ResetVirtSize();
+ void CheckScrollBars();
+
+ DECL_LINK( ScrollUpDownHdl, ScrollBar * );
+ DECL_LINK( ScrollLeftRightHdl, ScrollBar * );
+ DECL_LINK( MouseMoveTimeoutHdl, Timer* );
+ DECL_LINK( EditTimeoutHdl, Timer* );
+ DECL_LINK( UserEventHdl, void* );
+ void AdjustScrollBars();
+ void PositionScrollBars( long nRealWidth, long nRealHeight );
+ void CalcDocPos( Point& aMousePos );
+ BOOL GetResizeRect( Rectangle& );
+ void PaintResizeRect( const Rectangle& );
+ SvLBoxEntry* GetNewCursor();
+ void ToggleSelection( SvLBoxEntry* );
+ void DeselectAllBut( SvLBoxEntry* );
+ void Center( SvLBoxEntry* pEntry, SvIcnVwDataEntry* ) const;
+ void StopEditTimer() { aEditTimer.Stop(); }
+ void StartEditTimer() { aEditTimer.Start(); }
+ void ImpHideDDIcon();
+ void ImpDrawXORRect( const Rectangle& rRect );
+ void AddSelectedRect( const Rectangle&, short nOffset = SELRECT_BORDER_OFFS );
+ void ClearSelectedRectList();
+ Rectangle CalcMaxTextRect( const SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const;
+
+ void ClipAtVirtOutRect( Rectangle& rRect ) const;
+ void AdjustAtGrid( const SvPtrarr& rRow, SvLBoxEntry* pStart=0 );
+ Point AdjustAtGrid(
+ const Rectangle& rCenterRect, // "Schwerpunkt" des Objekts (typ. Bmp-Rect)
+ const Rectangle& rBoundRect ) const;
+ SvIconViewTextMode GetEntryTextModeSmart( const SvLBoxEntry* pEntry,
+ const SvIcnVwDataEntry* pViewData ) const;
+
+ BOOL CheckVerScrollBar();
+ BOOL CheckHorScrollBar();
+ void CancelUserEvent();
+
+public:
+
+ SvImpIconView( SvIconView* pView, SvLBoxTreeList*, WinBits nWinStyle );
+ ~SvImpIconView();
+
+ void Clear( BOOL bInCtor = FALSE );
+ void SetWindowBits( WinBits nWinStyle );
+ void SetModel( SvLBoxTreeList* pTree, SvLBoxEntry* pParent )
+ { pModel = pTree; SetCurParent(pParent); }
+ void EntryInserted( SvLBoxEntry*);
+ void RemovingEntry( SvLBoxEntry* pEntry );
+ void EntryRemoved();
+ void MovingEntry( SvLBoxEntry* pEntry );
+ void EntryMoved( SvLBoxEntry* pEntry );
+ void TreeInserted( SvLBoxEntry* pEntry );
+ void ChangedFont();
+ void ModelHasEntryInvalidated( SvListEntry* );
+ void EntryExpanded( SvLBoxEntry* pEntry );
+ void EntryCollapsed( SvLBoxEntry* pEntry );
+ void CollapsingEntry( SvLBoxEntry* pEntry );
+ void EntrySelected( SvLBoxEntry*, BOOL bSelect );
+
+ void Paint( const Rectangle& rRect );
+ void RepaintSelectionItems();
+ void MouseButtonDown( const MouseEvent& );
+ void MouseButtonUp( const MouseEvent& );
+ void MouseMove( const MouseEvent&);
+ BOOL KeyInput( const KeyEvent& );
+ void Resize();
+ void GetFocus();
+ void LoseFocus();
+ void UpdateAll();
+ void PaintEntry( SvLBoxEntry* pEntry,
+ SvIcnVwDataEntry* pViewData = 0 );
+ void PaintEntry( SvLBoxEntry*, const Point&,
+ SvIcnVwDataEntry* pViewData = 0, OutputDevice* pOut = 0);
+ void SetEntryPosition( SvLBoxEntry* pEntry, const Point& rPos,
+ BOOL bAdjustRow = FALSE,
+ BOOL bCheckScrollBars = FALSE );
+ void InvalidateEntry( SvLBoxEntry* );
+ void ViewDataInitialized( SvLBoxEntry* pEntry );
+ SvLBoxItem* GetItem( SvLBoxEntry*, const Point& rAbsPos );
+
+ void SetNoSelection();
+ void SetDragDropMode( DragDropMode eDDMode );
+ void SetSelectionMode( SelectionMode eSelMode );
+
+ void SttDrag( const Point& rPos );
+ void EndDrag();
+
+ SvLBoxEntry* GetCurEntry() const { return pCursor; }
+ void SetCursor( SvLBoxEntry* );
+
+ BOOL IsEntryInView( SvLBoxEntry* );
+ SvLBoxEntry* GetEntry( const Point& rDocPos );
+ SvLBoxEntry* GetNextEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry );
+ SvLBoxEntry* GetPrevEntry( const Point& rDocPos, SvLBoxEntry* pCurEntry );
+
+ Point GetEntryPosition( SvLBoxEntry* );
+ void MakeVisible( SvLBoxEntry* pEntry );
+
+ void Arrange();
+
+ void SetSpaceBetweenEntries( long nHor, long Ver );
+ long GetHorSpaceBetweenEntries() const { return nHorDist; }
+ long GetVerSpaceBetweenEntries() const { return nVerDist; }
+
+ Rectangle CalcFocusRect( SvLBoxEntry* );
+
+ Rectangle CalcBmpRect( SvLBoxEntry*, const Point* pPos = 0,
+ SvIcnVwDataEntry* pViewData=0 );
+ Rectangle CalcTextRect( SvLBoxEntry*, SvLBoxString* pItem = 0,
+ const Point* pPos = 0,
+ BOOL bForInplaceEdit = FALSE,
+ SvIcnVwDataEntry* pViewData = 0 );
+
+ long CalcBoundingWidth( SvLBoxEntry*, const SvIcnVwDataEntry* pViewData = 0) const;
+ long CalcBoundingHeight( SvLBoxEntry*, const SvIcnVwDataEntry* pViewData= 0 ) const;
+ Size CalcBoundingSize( SvLBoxEntry*,
+ SvIcnVwDataEntry* pViewData = 0 ) const;
+ void FindBoundingRect( SvLBoxEntry* pEntry,
+ SvIcnVwDataEntry* pViewData = 0 );
+ // berechnet alle BoundRects neu
+ void RecalcAllBoundingRects();
+ // berechnet alle ungueltigen BoundRects neu
+ void RecalcAllBoundingRectsSmart();
+ const Rectangle& GetBoundingRect( SvLBoxEntry*,
+ SvIcnVwDataEntry* pViewData=0);
+ void InvalidateBoundingRect( SvLBoxEntry* );
+ void InvalidateBoundingRect( Rectangle& rRect ) { rRect.Right() = LONG_MAX; }
+ BOOL IsBoundingRectValid( const Rectangle& rRect ) const { return (BOOL)( rRect.Right() != LONG_MAX ); }
+
+ void PaintEmphasis( const Rectangle&, BOOL bSelected,
+ BOOL bCursored, OutputDevice* pOut = 0 );
+ void PaintItem( const Rectangle& rRect, SvLBoxItem* pItem,
+ SvLBoxEntry* pEntry, USHORT nPaintFlags, OutputDevice* pOut = 0 );
+ // berechnet alle BoundingRects neu, wenn bMustRecalcBoundingRects == TRUE
+ void CheckBoundingRects() { if (bMustRecalcBoundingRects) RecalcAllBoundingRects(); }
+ // berechnet alle invalidierten BoundingRects neu
+ void UpdateBoundingRects();
+ void ShowTargetEmphasis( SvLBoxEntry* pEntry, BOOL bShow );
+ SvLBoxEntry* GetDropTarget( const Point& rPosPixel );
+ BOOL NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos );
+ BOOL NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
+ SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos );
+
+ void WriteDragServerInfo( const Point&, SvLBoxDDInfo* );
+ void ReadDragServerInfo( const Point&, SvLBoxDDInfo* );
+ void ToTop( SvLBoxEntry* );
+
+ void SetCurParent( SvLBoxEntry* pNewParent );
+ SvLBoxEntry* GetCurParent() const { return pCurParent; }
+ USHORT GetSelectionCount() const;
+ void SetGrid( long nDX, long nDY );
+ void Scroll( long nDeltaX, long nDeltaY, BOOL bScrollBar = FALSE );
+ const Size& GetItemSize( SvIconView* pView, SvLBoxEntry*, SvLBoxItem*,
+ const SvIcnVwDataEntry* pViewData = 0 ) const;
+ void PrepareCommandEvent( const Point& rPt );
+
+ void HideDDIcon();
+ void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
+ void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
+
+ SvLBoxEntry* mpViewData;
+
+ BOOL IsOver( SvPtrarr* pSelectedRectList, const Rectangle& rEntryBoundRect ) const;
+ void SelectRect( const Rectangle&, BOOL bAdd = TRUE,
+ SvPtrarr* pOtherRects = 0,
+ short nOffs = SELRECT_BORDER_OFFS );
+ void DrawSelectionRect( const Rectangle& );
+ void HideSelectionRect();
+ void CalcScrollOffsets( const Point& rRefPosPixel,
+ long& rX, long& rY, BOOL bDragDrop = FALSE,
+ USHORT nBorderWidth = 10 );
+ void EndTracking();
+ BOOL IsTextHit( SvLBoxEntry* pEntry, const Point& rDocPos );
+ void MakeVisible( const Rectangle& rDocPos,BOOL bInScrollBarEvent=FALSE);
+ void AdjustAtGrid( SvLBoxEntry* pStart = 0 );
+ void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 );
+ SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0,
+ const SvIcnVwDataEntry* pViewData = 0 ) const;
+ void ShowFocusRect( const SvLBoxEntry* pEntry );
+};
+
+inline void SvImpIconView::MakeVisible( SvLBoxEntry* pEntry )
+{
+ const Rectangle& rRect = GetBoundingRect( pEntry );
+ MakeVisible( rRect );
+}
+
+#endif // #ifndef _SVIMPICN_HXX
+
+
diff --git a/svtools/source/inc/xbmread.hxx b/svtools/source/inc/xbmread.hxx
new file mode 100644
index 000000000000..c9623fbb2cda
--- /dev/null
+++ b/svtools/source/inc/xbmread.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * 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: xbmread.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _XBMREAD_HXX
+#define _XBMREAD_HXX
+
+#ifndef _GRAPH_HXX
+#include <vcl/graph.hxx>
+#endif
+#ifndef _BMPACC_HXX
+#include <vcl/bmpacc.hxx>
+#endif
+
+#ifdef _XBMPRIVATE
+
+// ---------
+// - Enums -
+// ---------
+
+enum XBMFormat
+{
+ XBM10,
+ XBM11
+};
+
+enum ReadState
+{
+ XBMREAD_OK,
+ XBMREAD_ERROR,
+ XBMREAD_NEED_MORE
+};
+
+// -------------
+// - XBMReader -
+// -------------
+
+class XBMReader : public GraphicReader
+{
+ SvStream& rIStm;
+ Bitmap aBmp1;
+ BitmapWriteAccess* pAcc1;
+ short* pHexTable;
+ BitmapColor aWhite;
+ BitmapColor aBlack;
+ long nLastPos;
+ long nWidth;
+ long nHeight;
+ BOOL bStatus;
+
+ void InitTable();
+ ByteString FindTokenLine( SvStream* pInStm, const char* pTok1,
+ const char* pTok2 = NULL, const char* pTok3 = NULL );
+ long ParseDefine( const sal_Char* pDefine );
+ BOOL ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat );
+
+
+public:
+
+ XBMReader( SvStream& rStm );
+ virtual ~XBMReader();
+
+ ReadState ReadXBM( Graphic& rGraphic );
+};
+
+#endif // _XBMPRIVATE
+
+// -------------
+// - ImportXBM -
+// -------------
+
+BOOL ImportXBM( SvStream& rStream, Graphic& rGraphic );
+
+#endif // _XBMREAD_HXX
diff --git a/svtools/source/inc/xpmread.hxx b/svtools/source/inc/xpmread.hxx
new file mode 100644
index 000000000000..f1a76c9bc62f
--- /dev/null
+++ b/svtools/source/inc/xpmread.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * 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: xpmread.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.
+ *
+ ************************************************************************/
+
+#ifndef _XPMREAD_HXX
+#define _XPMREAD_HXX
+
+#ifndef _BITMAP_HXX
+#include <vcl/bitmap.hxx>
+#endif
+
+#ifdef _XPMPRIVATE
+
+#define XPMTEMPBUFSIZE 0x00008000
+#define XPMSTRINGBUF 0x00008000
+
+#define XPMIDENTIFIER 0x00000001 // mnIdentifier includes on of the six phases
+#define XPMDEFINITION 0x00000002 // the XPM format consists of
+#define XPMVALUES 0x00000003
+#define XPMCOLORS 0x00000004
+#define XPMPIXELS 0x00000005
+#define XPMEXTENSIONS 0x00000006
+#define XPMENDEXT 0x00000007
+
+
+#define XPMREMARK 0x00000001 // defines used by mnStatus
+#define XPMDOUBLE 0x00000002
+#define XPMSTRING 0x00000004
+#define XPMFINISHED 0x00000008
+
+#define XPMCASESENSITIVE 0x00000001
+#define XPMCASENONSENSITIVE 0x00000002
+
+// ---------
+// - Enums -
+// ---------
+
+enum ReadState
+{
+ XPMREAD_OK,
+ XPMREAD_ERROR,
+ XPMREAD_NEED_MORE
+};
+
+// -------------
+// - XPMReader -
+// -------------
+
+class BitmapWriteAccess;
+class Graphic;
+
+class XPMReader : public GraphicReader
+{
+private:
+
+ SvStream& mrIStm;
+ Bitmap maBmp;
+ BitmapWriteAccess* mpAcc;
+ Bitmap maMaskBmp;
+ BitmapWriteAccess* mpMaskAcc;
+ long mnLastPos;
+
+ ULONG mnWidth;
+ ULONG mnHeight;
+ ULONG mnColors;
+ ULONG mnCpp; // characters per pix
+ BOOL mbTransparent;
+ BOOL mbStatus;
+ ULONG mnStatus;
+ ULONG mnIdentifier;
+ BYTE mcThisByte;
+ BYTE mcLastByte;
+ ULONG mnTempAvail;
+ BYTE* mpTempBuf;
+ BYTE* mpTempPtr;
+ BYTE* mpFastColorTable;
+ BYTE* mpColMap;
+ ULONG mnStringSize;
+ BYTE* mpStringBuf;
+ ULONG mnParaSize;
+ BYTE* mpPara;
+
+ BOOL ImplGetString( void );
+ BOOL ImplGetColor( ULONG );
+ BOOL ImplGetScanLine( ULONG );
+ BOOL ImplGetColSub( BYTE* );
+ BOOL ImplGetColKey( BYTE );
+ void ImplGetRGBHex( BYTE*, ULONG );
+ BOOL ImplGetPara( ULONG numb );
+ BOOL ImplCompare( BYTE*, BYTE*, ULONG, ULONG nmode = XPMCASENONSENSITIVE );
+ ULONG ImplGetULONG( ULONG nPara );
+
+public:
+ XPMReader( SvStream& rStm );
+ virtual ~XPMReader();
+
+ ReadState ReadXPM( Graphic& rGraphic );
+};
+
+#endif // _XPMPRIVATE
+
+// -------------
+// - ImportXPM -
+// -------------
+
+BOOL ImportXPM( SvStream& rStream, Graphic& rGraphic );
+
+#endif // _XPMREAD_HXX
diff --git a/svtools/source/items/aeitem.cxx b/svtools/source/items/aeitem.cxx
deleted file mode 100644
index 63fbd1db6227..000000000000
--- a/svtools/source/items/aeitem.cxx
+++ /dev/null
@@ -1,317 +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: aeitem.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <tools/string.hxx>
-
-#define _SVSTDARR_USHORTS
-#include <svtools/svstdarr.hxx>
-#include <svtools/svarray.hxx>
-#include <svtools/aeitem.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxAllEnumItem)
-
-TYPEINIT1_AUTOFACTORY(SfxAllEnumItem, SfxEnumItem)
-
-// -----------------------------------------------------------------------
-
-struct SfxAllEnumValue_Impl
-{
- USHORT nValue;
- XubString aText;
-};
-
-SV_DECL_PTRARR_DEL(SfxAllEnumValueArr, SfxAllEnumValue_Impl*, 0, 8)
-SV_IMPL_PTRARR(SfxAllEnumValueArr, SfxAllEnumValue_Impl*)
-
-// -----------------------------------------------------------------------
-
-SfxAllEnumItem::SfxAllEnumItem() :
- SfxEnumItem(),
- pValues( 0 ),
- pDisabledValues( 0 )
-{
-}
-
-SfxAllEnumItem::SfxAllEnumItem( USHORT which, USHORT nVal, const XubString &rText ):
- SfxEnumItem(which, nVal),
- pValues( 0 ),
- pDisabledValues( 0 )
-{
- DBG_CTOR(SfxAllEnumItem, 0);
- InsertValue( nVal, rText );
-}
-
-// -----------------------------------------------------------------------
-
-SfxAllEnumItem::SfxAllEnumItem(USHORT which, USHORT nVal):
- SfxEnumItem(which, nVal),
- pValues( 0 ),
- pDisabledValues( 0 )
-{
- DBG_CTOR(SfxAllEnumItem, 0);
- InsertValue( nVal );
-}
-
-// -----------------------------------------------------------------------
-
-SfxAllEnumItem::SfxAllEnumItem( USHORT which, SvStream &rStream ):
- SfxEnumItem(which, rStream),
- pValues( 0 ),
- pDisabledValues( 0 )
-{
- DBG_CTOR(SfxAllEnumItem, 0);
- InsertValue( GetValue() );
-}
-
-// -----------------------------------------------------------------------
-
-
-SfxAllEnumItem::SfxAllEnumItem(USHORT which):
- SfxEnumItem(which, 0),
- pValues( 0 ),
- pDisabledValues( 0 )
-{
- DBG_CTOR(SfxAllEnumItem, 0);
-}
-
-
-// -----------------------------------------------------------------------
-
-SfxAllEnumItem::SfxAllEnumItem(const SfxAllEnumItem &rCopy):
- SfxEnumItem(rCopy),
- pValues(0),
- pDisabledValues( 0 )
-{
- DBG_CTOR(SfxAllEnumItem, 0);
- if ( !rCopy.pValues )
- return;
-
- pValues = new SfxAllEnumValueArr;
-
- for ( USHORT nPos = 0; nPos < rCopy.pValues->Count(); ++nPos )
- {
- SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl;
- pVal->nValue = rCopy.pValues->GetObject(nPos)->nValue;
- pVal->aText = rCopy.pValues->GetObject(nPos)->aText;
- const SfxAllEnumValue_Impl *pTemp = pVal;
- pValues->Insert( pTemp, nPos );
- }
-
- if( rCopy.pDisabledValues )
- {
- pDisabledValues = new SvUShorts;
- for ( USHORT nPos = 0; nPos < rCopy.pDisabledValues->Count(); ++nPos )
- {
- pDisabledValues->Insert( rCopy.pDisabledValues->GetObject(nPos),
- nPos );
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-SfxAllEnumItem::~SfxAllEnumItem()
-{
- DBG_DTOR(SfxAllEnumItem, 0);
- delete pValues;
- delete pDisabledValues;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxAllEnumItem::GetValueCount() const
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- return pValues ? pValues->Count() : 0;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SfxAllEnumItem::GetValueTextByPos( USHORT nPos ) const
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" );
- return pValues->GetObject(nPos)->aText;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxAllEnumItem::GetValueByPos( USHORT nPos ) const
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- DBG_ASSERT( pValues && nPos < pValues->Count(), "enum overflow" );
- return pValues->GetObject(nPos)->nValue;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxAllEnumItem::Clone( SfxItemPool * ) const
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- return new SfxAllEnumItem(*this);
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxAllEnumItem::Create( SvStream & rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- return new SfxAllEnumItem( Which(), rStream );
-}
-
-
-// -----------------------------------------------------------------------
-
-USHORT SfxAllEnumItem::_GetPosByValue( USHORT nVal ) const
-
-/* [Beschreibung]
-
- Im Ggs. zu <SfxEnumItemInterface::GetPosByValue(USHORT)const> liefert
- diese interne Methode bei nicht vorhandenen Values die Position,
- an der der Wert liegen w"urde.
-*/
-
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
-
- if ( !pValues )
- return 0;
-
- //!O: binaere Suche oder SortArray verwenden
- USHORT nPos;
- for ( nPos = 0; nPos < pValues->Count(); ++nPos )
- if ( pValues->GetObject(nPos)->nValue >= nVal )
- return nPos;
- return nPos;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxAllEnumItem::GetPosByValue( USHORT nValue ) const
-
-/* [Beschreibung]
-
- Liefert im Gegensatz zu <SfxEnumItemInterface::GetPosByValue(USHORT)const>
- immer nValue zur"uck, solange nicht mindestens ein Wert mit einer der
- Methoden <SfxAllEnumItem::InsertValue()> eingef"ugt wurde.
-*/
-
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
-
- if ( !pValues || !pValues->Count() )
- return nValue;
-
- return SfxEnumItem::GetPosByValue( nValue );
-}
-
-// -----------------------------------------------------------------------
-
-void SfxAllEnumItem::InsertValue( USHORT nValue, const XubString &rValue )
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl;
- pVal->nValue = nValue;
- pVal->aText = rValue;
- const SfxAllEnumValue_Impl *pTemp = pVal;
- if ( !pValues )
- pValues = new SfxAllEnumValueArr;
- else if ( GetPosByValue( nValue ) != USHRT_MAX )
- // remove when exists
- RemoveValue( nValue );
- // then insert
- pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?!
-}
-
-// -----------------------------------------------------------------------
-
-void SfxAllEnumItem::InsertValue( USHORT nValue )
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- SfxAllEnumValue_Impl *pVal = new SfxAllEnumValue_Impl;
- pVal->nValue = nValue;
- pVal->aText = XubString::CreateFromInt32( nValue );
- const SfxAllEnumValue_Impl *pTemp = pVal;
- if ( !pValues )
- pValues = new SfxAllEnumValueArr;
-
- pValues->Insert( pTemp, _GetPosByValue(nValue) ); //! doppelte?!
-}
-
-void SfxAllEnumItem::DisableValue( USHORT nValue )
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- if ( !pDisabledValues )
- pDisabledValues = new SvUShorts;
-
- pDisabledValues->Insert( nValue, pDisabledValues->Count() );
-}
-
-BOOL SfxAllEnumItem::IsEnabled( USHORT nValue ) const
-{
- if ( pDisabledValues )
- {
- for ( USHORT i=0; i<pDisabledValues->Count(); i++ )
- if ( (*pDisabledValues)[i] == nValue )
- return FALSE;
- }
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxAllEnumItem::RemoveValue( USHORT nValue )
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- USHORT nPos = GetPosByValue(nValue);
- DBG_ASSERT( nPos != USHRT_MAX, "removing value not in enum" );
- pValues->Remove( nPos );
-}
-
-// -----------------------------------------------------------------------
-
-
-void SfxAllEnumItem::RemoveAllValues()
-{
- DBG_CHKTHIS(SfxAllEnumItem, 0);
- if ( pValues )
- pValues->DeleteAndDestroy( 0, pValues->Count() );
-}
-
-
-
diff --git a/svtools/source/items/flagitem.cxx b/svtools/source/items/flagitem.cxx
deleted file mode 100644
index e59f981c5afa..000000000000
--- a/svtools/source/items/flagitem.cxx
+++ /dev/null
@@ -1,166 +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: flagitem.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <svtools/flagitem.hxx>
-#include <svtools/poolitem.hxx>
-#include <tools/stream.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxFlagItem)
-
-USHORT nSfxFlagVal[16] =
-{
- 0x0001, 0x0002, 0x0004, 0x0008,
- 0x0010, 0x0020, 0x0040, 0x0080,
- 0x0100, 0x0200, 0x0400, 0x0800,
- 0x1000, 0x2000, 0x4000, 0x8000
-};
-
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1(SfxFlagItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxFlagItem::SfxFlagItem( USHORT nW, USHORT nV ) :
- SfxPoolItem( nW ),
- nVal(nV)
-{
- DBG_CTOR(SfxFlagItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxFlagItem::SfxFlagItem( USHORT nW, SvStream &rStream) :
- SfxPoolItem( nW )
-{
- DBG_CTOR(SfxFlagItem, 0);
- rStream >> nVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxFlagItem::SfxFlagItem( const SfxFlagItem& rItem ) :
- SfxPoolItem( rItem ),
- nVal( rItem.nVal )
-{
- DBG_CTOR(SfxFlagItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxFlagItem::Store(SvStream &rStream, USHORT) const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- rStream << nVal;
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxFlagItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- rText.Erase();
- for ( BYTE nFlag = 0; nFlag < GetFlagCount(); ++nFlag )
- rText += XubString::CreateFromInt32( GetFlag(nFlag) );
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// -----------------------------------------------------------------------
-
-XubString SfxFlagItem::GetFlagText( BYTE ) const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" );
- return XubString();
-}
-
-// -----------------------------------------------------------------------
-
-BYTE SfxFlagItem::GetFlagCount() const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- DBG_WARNING( "calling GetValueText(USHORT) on SfxFlagItem -- overload!" );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxFlagItem::Create(SvStream &, USHORT) const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- DBG_WARNING( "calling Create() on SfxFlagItem -- overload!" );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxFlagItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return (((SfxFlagItem&)rItem).nVal == nVal);
-}
-
-// -----------------------------------------------------------------------
-
-void SfxFlagItem::SetFlag( BYTE nFlag, int bVal )
-{
- if ( bVal )
- nVal |= nSfxFlagVal[nFlag];
- else
- nVal &= ~nSfxFlagVal[nFlag];
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxFlagItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxFlagItem, 0);
- return new SfxFlagItem( *this );
-}
-
-
-
-
-
diff --git a/svtools/source/items/globalnameitem.cxx b/svtools/source/items/globalnameitem.cxx
deleted file mode 100644
index 6a8359fb39b8..000000000000
--- a/svtools/source/items/globalnameitem.cxx
+++ /dev/null
@@ -1,117 +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: globalnameitem.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_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/script/XTypeConverter.hpp>
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-#include <svtools/globalnameitem.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxGlobalNameItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxGlobalNameItem::SfxGlobalNameItem()
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxGlobalNameItem::SfxGlobalNameItem( USHORT nW, const SvGlobalName& rName )
-: SfxPoolItem( nW ),
- m_aName( rName )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxGlobalNameItem::~SfxGlobalNameItem()
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SfxGlobalNameItem::operator==( const SfxPoolItem& rItem ) const
-{
- return ((SfxGlobalNameItem&)rItem).m_aName == m_aName;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxGlobalNameItem::Clone(SfxItemPool *) const
-{
- return new SfxGlobalNameItem( *this );
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxGlobalNameItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
-{
- com::sun::star::uno::Reference < com::sun::star::script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
- com::sun::star::uno::UNO_QUERY );
- com::sun::star::uno::Sequence< sal_Int8 > aSeq;
- com::sun::star::uno::Any aNew;
-
- try { aNew = xConverter->convertTo( rVal, ::getCppuType((const com::sun::star::uno::Sequence < sal_Int8 >*)0) ); }
- catch (com::sun::star::uno::Exception&) {}
- aNew >>= aSeq;
- if ( aSeq.getLength() == 16 )
- {
- m_aName.MakeFromMemory( (void*) aSeq.getConstArray() );
- return TRUE;
- }
-
- DBG_ERROR( "SfxGlobalNameItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxGlobalNameItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
-{
- com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
- void* pData = ( void* ) &m_aName.GetCLSID();
- memcpy( aSeq.getArray(), pData, 16 );
- rVal <<= aSeq;
- return TRUE;
-}
-
diff --git a/svtools/source/items/imageitm.cxx b/svtools/source/items/imageitm.cxx
deleted file mode 100644
index cc4a2ebd4f3b..000000000000
--- a/svtools/source/items/imageitm.cxx
+++ /dev/null
@@ -1,148 +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: imageitm.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/imageitm.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-TYPEINIT1( SfxImageItem, SfxInt16Item );
-
-struct SfxImageItem_Impl
-{
- String aURL;
- long nAngle;
- BOOL bMirrored;
- int operator == ( const SfxImageItem_Impl& rOther ) const
- { return nAngle == rOther.nAngle && bMirrored == rOther.bMirrored; }
-};
-
-//---------------------------------------------------------
-
-SfxImageItem::SfxImageItem( USHORT which, UINT16 nImage )
- : SfxInt16Item( which, nImage )
-{
- pImp = new SfxImageItem_Impl;
- pImp->nAngle = 0;
- pImp->bMirrored = FALSE;
-}
-
-SfxImageItem::SfxImageItem( USHORT which, const String& rURL )
- : SfxInt16Item( which, 0 )
-{
- pImp = new SfxImageItem_Impl;
- pImp->nAngle = 0;
- pImp->bMirrored = FALSE;
- pImp->aURL = rURL;
-}
-
-SfxImageItem::SfxImageItem( const SfxImageItem& rItem )
- : SfxInt16Item( rItem )
-{
- pImp = new SfxImageItem_Impl( *(rItem.pImp) );
-}
-
-//---------------------------------------------------------
-SfxImageItem::~SfxImageItem()
-{
- delete pImp;
-}
-
-//---------------------------------------------------------
-
-SfxPoolItem* SfxImageItem::Clone( SfxItemPool* ) const
-{
- return new SfxImageItem( *this );
-}
-
-//---------------------------------------------------------
-
-int SfxImageItem::operator==( const SfxPoolItem& rItem ) const
-{
- return( ((SfxImageItem&) rItem).GetValue() == GetValue() && (*pImp == *(((SfxImageItem&)rItem).pImp) ) );
-}
-
-BOOL SfxImageItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
-{
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq( 4 );
- aSeq[0] = ::com::sun::star::uno::makeAny( GetValue() );
- aSeq[1] = ::com::sun::star::uno::makeAny( pImp->nAngle );
- aSeq[2] = ::com::sun::star::uno::makeAny( pImp->bMirrored );
- aSeq[3] = ::com::sun::star::uno::makeAny( rtl::OUString( pImp->aURL ));
-
- rVal = ::com::sun::star::uno::makeAny( aSeq );
- return TRUE;
-}
-
-BOOL SfxImageItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
-{
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aSeq;
- if (( rVal >>= aSeq ) && ( aSeq.getLength() == 4 ))
- {
- sal_Int16 nVal = sal_Int16();
- rtl::OUString aURL;
- if ( aSeq[0] >>= nVal )
- SetValue( nVal );
- aSeq[1] >>= pImp->nAngle;
- aSeq[2] >>= pImp->bMirrored;
- if ( aSeq[3] >>= aURL )
- pImp->aURL = aURL;
- return TRUE;
- }
-
- return FALSE;
-}
-
-void SfxImageItem::SetRotation( long nValue )
-{
- pImp->nAngle = nValue;
-}
-
-long SfxImageItem::GetRotation() const
-{
- return pImp->nAngle;
-}
-
-void SfxImageItem::SetMirrored( BOOL bSet )
-{
- pImp->bMirrored = bSet;
-}
-
-BOOL SfxImageItem::IsMirrored() const
-{
- return pImp->bMirrored;
-}
-
-String SfxImageItem::GetURL() const
-{
- return pImp->aURL;
-}
-
diff --git a/svtools/source/items/intitem.cxx b/svtools/source/items/intitem.cxx
deleted file mode 100644
index b20f245f964b..000000000000
--- a/svtools/source/items/intitem.cxx
+++ /dev/null
@@ -1,261 +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: intitem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/intitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <tools/bigint.hxx>
-#include <tools/stream.hxx>
-#include <svtools/metitem.hxx>
-
-//============================================================================
-//
-// class SfxByteItem
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(SfxByteItem, CntByteItem);
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxByteItem::Create(SvStream & rStream, USHORT) const
-{
- short nValue = 0;
- rStream >> nValue;
- return new SfxByteItem(Which(), BYTE(nValue));
-}
-
-//============================================================================
-//
-// class SfxInt16Item
-//
-//============================================================================
-
-DBG_NAME(SfxInt16Item);
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(SfxInt16Item, SfxPoolItem);
-
-//============================================================================
-SfxInt16Item::SfxInt16Item(USHORT which, SvStream & rStream):
- SfxPoolItem(which)
-{
- DBG_CTOR(SfxInt16Item, 0);
- short nTheValue = 0;
- rStream >> nTheValue;
- m_nValue = nTheValue;
-}
-
-//============================================================================
-// virtual
-int SfxInt16Item::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type");
- return m_nValue == SAL_STATIC_CAST(const SfxInt16Item *, &rItem)->
- m_nValue;
-}
-
-//============================================================================
-// virtual
-int SfxInt16Item::Compare(const SfxPoolItem & rWith) const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- DBG_ASSERT(SfxPoolItem::operator ==(rWith), "unequal type");
- return SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue
- < m_nValue ?
- -1 :
- SAL_STATIC_CAST(const SfxInt16Item *, &rWith)->m_nValue
- == m_nValue ?
- 0 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation SfxInt16Item::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- XubString & rText,
- const IntlWrapper *) const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- rText = UniString::CreateFromInt32(m_nValue);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-
-//============================================================================
-// virtual
-BOOL SfxInt16Item::QueryValue(com::sun::star::uno::Any& rVal, BYTE) const
-{
- sal_Int16 nValue = m_nValue;
- rVal <<= nValue;
- return TRUE;
-}
-
-//============================================================================
-// virtual
-BOOL SfxInt16Item::PutValue(const com::sun::star::uno::Any& rVal, BYTE )
-{
- sal_Int16 nValue = sal_Int16();
- if (rVal >>= nValue)
- {
- m_nValue = nValue;
- return TRUE;
- }
-
- DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxInt16Item::Create(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- return new SfxInt16Item(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & SfxInt16Item::Store(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- rStream << short(m_nValue);
- return rStream;
-}
-
-//============================================================================
-SfxPoolItem * SfxInt16Item::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- return new SfxInt16Item(*this);
-}
-
-//============================================================================
-INT16 SfxInt16Item::GetMin() const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- return -32768;
-}
-
-//============================================================================
-INT16 SfxInt16Item::GetMax() const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- return 32767;
-}
-
-//============================================================================
-SfxFieldUnit SfxInt16Item::GetUnit() const
-{
- DBG_CHKTHIS(SfxInt16Item, 0);
- return SFX_FUNIT_NONE;
-}
-
-//============================================================================
-//
-// class SfxUInt16Item
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(SfxUInt16Item, CntUInt16Item);
-
-
-//============================================================================
-//
-// class SfxInt32Item
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(SfxInt32Item, CntInt32Item);
-
-
-//============================================================================
-//
-// class SfxUInt32Item
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(SfxUInt32Item, CntUInt32Item);
-
-
-//============================================================================
-//
-// class SfxMetricItem
-//
-//============================================================================
-
-DBG_NAME(SfxMetricItem);
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(SfxMetricItem, SfxInt32Item);
-
-//============================================================================
-SfxMetricItem::SfxMetricItem(USHORT which, UINT32 nValue):
- SfxInt32Item(which, nValue)
-{
- DBG_CTOR(SfxMetricItem, 0);
-}
-
-//============================================================================
-SfxMetricItem::SfxMetricItem(USHORT which, SvStream & rStream):
- SfxInt32Item(which, rStream)
-{
- DBG_CTOR(SfxMetricItem, 0);
-}
-
-//============================================================================
-SfxMetricItem::SfxMetricItem(const SfxMetricItem & rItem):
- SfxInt32Item(rItem)
-{
- DBG_CTOR(SfxMetricItem, 0);
-}
-
-//============================================================================
-// virtual
-int SfxMetricItem::ScaleMetrics(long nMult, long nDiv)
-{
- BigInt aTheValue(GetValue());
- aTheValue *= nMult;
- aTheValue += nDiv / 2;
- aTheValue /= nDiv;
- SetValue(aTheValue);
- return 1;
-}
-
-//============================================================================
-// virtual
-int SfxMetricItem::HasMetrics() const
-{
- return 1;
-}
-
diff --git a/svtools/source/items/macitem.cxx b/svtools/source/items/macitem.cxx
deleted file mode 100644
index 480fb844ccc7..000000000000
--- a/svtools/source/items/macitem.cxx
+++ /dev/null
@@ -1,298 +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: macitem.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <tools/stream.hxx>
-
-#ifndef GCC
-#endif
-
-#include <svtools/macitem.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SvxMacroItem);
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_FACTORY(SvxMacroItem, SfxPoolItem, new SvxMacroItem(0));
-
-// -----------------------------------------------------------------------
-
-
-SjJSbxObjectBase::~SjJSbxObjectBase()
-{
-}
-
-SjJSbxObjectBase* SjJSbxObjectBase::Clone( void )
-{
- return NULL;
-}
-
-SvxMacro::SvxMacro( const String &rMacName, const String &rLanguage)
- : aMacName( rMacName ), aLibName( rLanguage),
- pFunctionObject(NULL), eType( EXTENDED_STYPE)
-{
- if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_STARBASIC))
- eType=STARBASIC;
- else if (rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT))
- eType=JAVASCRIPT;
-}
-
-
-SvxMacro::~SvxMacro()
-{
- delete pFunctionObject;
-}
-
-String SvxMacro::GetLanguage()const
-{
- if(eType==STARBASIC)
- {
- return UniString::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_STARBASIC));
- }
- else if(eType==JAVASCRIPT)
- {
- return UniString::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_JAVASCRIPT));
- }
- else if(eType==EXTENDED_STYPE)
- {
- return UniString::CreateFromAscii(
- RTL_CONSTASCII_STRINGPARAM(SVX_MACRO_LANGUAGE_SF));
-
- }
- return aLibName;
-}
-
-
-
-SvxMacro& SvxMacro::operator=( const SvxMacro& rBase )
-{
- if( this != &rBase )
- {
- aMacName = rBase.aMacName;
- aLibName = rBase.aLibName;
- delete pFunctionObject;
- pFunctionObject = rBase.pFunctionObject ? rBase.pFunctionObject->Clone() : NULL;
- eType = rBase.eType;
- }
- return *this;
-}
-
-
-SvxMacroTableDtor& SvxMacroTableDtor::operator=( const SvxMacroTableDtor& rTbl )
-{
- DelDtor();
- SvxMacro* pTmp = ((SvxMacroTableDtor&)rTbl).First();
- while( pTmp )
- {
- SvxMacro *pNew = new SvxMacro( *pTmp );
- Insert( rTbl.GetCurKey(), pNew );
- pTmp = ((SvxMacroTableDtor&)rTbl).Next();
- }
- return *this;
-}
-
-
-SvStream& SvxMacroTableDtor::Read( SvStream& rStrm, USHORT nVersion )
-{
- if( SVX_MACROTBL_VERSION40 <= nVersion )
- rStrm >> nVersion;
- short nMacro;
- rStrm >> nMacro;
-
- for( short i = 0; i < nMacro; ++i )
- {
- USHORT nCurKey, eType = STARBASIC;
- String aLibName, aMacName;
- rStrm >> nCurKey;
- SfxPoolItem::readByteString(rStrm, aLibName);
- SfxPoolItem::readByteString(rStrm, aMacName);
-
- if( SVX_MACROTBL_VERSION40 <= nVersion )
- rStrm >> eType;
-
- SvxMacro* pNew = new SvxMacro( aMacName, aLibName, (ScriptType)eType );
-
- SvxMacro *pOld = Get( nCurKey );
- if( pOld )
- {
- delete pOld;
- Replace( nCurKey, pNew );
- }
- else
- Insert( nCurKey, pNew );
- }
- return rStrm;
-}
-
-
-SvStream& SvxMacroTableDtor::Write( SvStream& rStream ) const
-{
- USHORT nVersion = SOFFICE_FILEFORMAT_31 == rStream.GetVersion()
- ? SVX_MACROTBL_VERSION31
- : SVX_MACROTBL_AKTVERSION;
-
- if( SVX_MACROTBL_VERSION40 <= nVersion )
- rStream << nVersion;
-
- rStream << (USHORT)Count();
-
- SvxMacro* pMac = ((SvxMacroTableDtor*)this)->First();
- while( pMac && rStream.GetError() == SVSTREAM_OK )
- {
- rStream << (short)GetCurKey();
- SfxPoolItem::writeByteString(rStream, pMac->GetLibName());
- SfxPoolItem::writeByteString(rStream, pMac->GetMacName());
-
- if( SVX_MACROTBL_VERSION40 <= nVersion )
- rStream << (USHORT)pMac->GetScriptType();
- pMac = ((SvxMacroTableDtor*)this)->Next();
- }
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxMacroTableDtor::DelDtor()
-{
- SvxMacro* pTmp = First();
- while( pTmp )
- {
- delete pTmp;
- pTmp = Next();
- }
- Clear();
-}
-
-// -----------------------------------------------------------------------
-
-int SvxMacroItem::operator==( const SfxPoolItem& rAttr ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
-
- const SvxMacroTableDtor& rOwn = aMacroTable;
- const SvxMacroTableDtor& rOther = ( (SvxMacroItem&) rAttr ).aMacroTable;
-
- // Anzahl unterschiedlich => auf jeden Fall ungleich
- if ( rOwn.Count() != rOther.Count() )
- return FALSE;
-
- // einzeln verleichen; wegen Performance ist die Reihenfolge wichtig
- for ( USHORT nNo = 0; nNo < rOwn.Count(); ++nNo )
- {
- const SvxMacro *pOwnMac = rOwn.GetObject(nNo);
- const SvxMacro *pOtherMac = rOther.GetObject(nNo);
- if ( rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac) ||
- pOwnMac->GetLibName() != pOtherMac->GetLibName() ||
- pOwnMac->GetMacName() != pOtherMac->GetMacName() )
- return FALSE;
- }
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxMacroItem::Clone( SfxItemPool* ) const
-{
- return new SvxMacroItem( *this );
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SvxMacroItem::GetPresentation
-(
- SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreUnit*/,
- SfxMapUnit /*ePresUnit*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
-/*!!!
- SvxMacroTableDtor& rTbl = (SvxMacroTableDtor&)GetMacroTable();
- SvxMacro* pMac = rTbl.First();
-
- while ( pMac )
- {
- rText += pMac->GetLibName();
- rText += cpDelim;
- rText += pMac->GetMacName();
- pMac = rTbl.Next();
- if ( pMac )
- rText += cpDelim;
- }
-*/
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SvxMacroItem::Store( SvStream& rStrm , USHORT ) const
-{
- return aMacroTable.Write( rStrm );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SvxMacroItem::Create( SvStream& rStrm, USHORT nVersion ) const
-{
- SvxMacroItem* pAttr = new SvxMacroItem( Which() );
- pAttr->aMacroTable.Read( rStrm, nVersion );
- return pAttr;
-}
-
-// -----------------------------------------------------------------------
-
-void SvxMacroItem::SetMacro( USHORT nEvent, const SvxMacro& rMacro )
-{
- SvxMacro *pMacro;
- if ( 0 != (pMacro=aMacroTable.Get(nEvent)) )
- {
- delete pMacro;
- aMacroTable.Replace(nEvent, new SvxMacro( rMacro ) );
- }
- else
- aMacroTable.Insert(nEvent, new SvxMacro( rMacro ) );
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SvxMacroItem::GetVersion( USHORT nFileFormatVersion ) const
-{
- return SOFFICE_FILEFORMAT_31 == nFileFormatVersion
- ? 0 : aMacroTable.GetVersion();
-}
-
diff --git a/svtools/source/items/makefile.mk b/svtools/source/items/makefile.mk
deleted file mode 100644
index 651e54bb7e23..000000000000
--- a/svtools/source/items/makefile.mk
+++ /dev/null
@@ -1,65 +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: makefile.mk,v $
-#
-# $Revision: 1.13 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJNAME=svtools
-TARGET=items
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svt.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES=\
- $(SLO)$/aeitem.obj \
- $(SLO)$/eitem.obj \
- $(SLO)$/flagitem.obj \
- $(SLO)$/globalnameitem.obj \
- $(SLO)$/imageitm.obj \
- $(SLO)$/intitem.obj \
- $(SLO)$/itemdel.obj \
- $(SLO)$/macitem.obj \
- $(SLO)$/poolcach.obj \
- $(SLO)$/ptitem.obj \
- $(SLO)$/rectitem.obj \
- $(SLO)$/rngitem.obj \
- $(SLO)$/stritem.obj \
- $(SLO)$/style.obj \
- $(SLO)$/szitem.obj \
- $(SLO)$/wallitem.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/items/poolcach.cxx b/svtools/source/items/poolcach.cxx
deleted file mode 100644
index 2c758a7e25fa..000000000000
--- a/svtools/source/items/poolcach.cxx
+++ /dev/null
@@ -1,159 +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: poolcach.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_svtools.hxx"
-
-#include <limits.h>
-
-#ifndef GCC
-#endif
-
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
-#include "poolcach.hxx"
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxItemPoolCache)
-
-
-//------------------------------------------------------------------------
-
-struct SfxItemModifyImpl
-{
- const SfxSetItem *pOrigItem;
- SfxSetItem *pPoolItem;
-};
-
-SV_DECL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl, 8, 8 )
-SV_IMPL_VARARR( SfxItemModifyArr_Impl, SfxItemModifyImpl);
-
-//------------------------------------------------------------------------
-
-SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
- const SfxPoolItem *pPutItem ):
- pPool(pItemPool),
- pCache(new SfxItemModifyArr_Impl),
- pSetToPut( 0 ),
- pItemToPut( &pItemPool->Put(*pPutItem) )
-{
- DBG_CTOR(SfxItemPoolCache, 0);
- DBG_ASSERT(pItemPool, "kein Pool angegeben");
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
- const SfxItemSet *pPutSet ):
- pPool(pItemPool),
- pCache(new SfxItemModifyArr_Impl),
- pSetToPut( pPutSet ),
- pItemToPut( 0 )
-{
- DBG_CTOR(SfxItemPoolCache, 0);
- DBG_ASSERT(pItemPool, "kein Pool angegeben");
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPoolCache::~SfxItemPoolCache()
-{
- DBG_DTOR(SfxItemPoolCache, 0);
- for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos ) {
- pPool->Remove( *(*pCache)[nPos].pPoolItem );
- pPool->Remove( *(*pCache)[nPos].pOrigItem );
- }
- delete pCache; pCache = 0;
-
- if ( pItemToPut )
- pPool->Remove( *pItemToPut );
-}
-
-//------------------------------------------------------------------------
-
-const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem, BOOL bNew )
-{
- DBG_CHKTHIS(SfxItemPoolCache, 0);
- DBG_ASSERT( pPool == rOrigItem.GetItemSet().GetPool(), "invalid Pool" );
- DBG_ASSERT( IsDefaultItem( &rOrigItem ) || IsPooledItem( &rOrigItem ),
- "original not in pool" );
-
- // Suchen, ob diese Transformations schon einmal vorkam
- for ( USHORT nPos = 0; nPos < pCache->Count(); ++nPos )
- {
- SfxItemModifyImpl &rMapEntry = (*pCache)[nPos];
- if ( rMapEntry.pOrigItem == &rOrigItem )
- {
- // aendert sich ueberhaupt etwas?
- if ( rMapEntry.pPoolItem != &rOrigItem )
- {
- rMapEntry.pPoolItem->AddRef(2); // einen davon fuer den Cache
- if ( bNew )
- pPool->Put( rOrigItem ); //! AddRef??
- }
- return *rMapEntry.pPoolItem;
- }
- }
-
- // die neue Attributierung in einem neuen Set eintragen
- SfxSetItem *pNewItem = (SfxSetItem *)rOrigItem.Clone();
- if ( pItemToPut )
- {
- pNewItem->GetItemSet().PutDirect( *pItemToPut );
- DBG_ASSERT( &pNewItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut,
- "wrong item in temporary set" );
- }
- else
- pNewItem->GetItemSet().Put( *pSetToPut );
- const SfxSetItem* pNewPoolItem = (const SfxSetItem*) &pPool->Put( *pNewItem );
- DBG_ASSERT( pNewPoolItem != pNewItem, "Pool: rein == raus?" );
- delete pNewItem;
-
- // Refernzzaehler anpassen, je einen davon fuer den Cache
- pNewPoolItem->AddRef( pNewPoolItem != &rOrigItem ? 2 : 1 );
- if ( bNew )
- pPool->Put( rOrigItem ); //! AddRef??
-
- // die Transformation im Cache eintragen
- SfxItemModifyImpl aModify;
- aModify.pOrigItem = &rOrigItem;
- aModify.pPoolItem = (SfxSetItem*) pNewPoolItem;
- pCache->Insert( aModify, pCache->Count() );
-
- DBG_ASSERT( !pItemToPut ||
- &pNewPoolItem->GetItemSet().Get( pItemToPut->Which() ) == pItemToPut,
- "wrong item in resulting set" );
-
- return *pNewPoolItem;
-}
-
-
-
diff --git a/svtools/source/items/ptitem.cxx b/svtools/source/items/ptitem.cxx
deleted file mode 100644
index ac1e94fd1727..000000000000
--- a/svtools/source/items/ptitem.cxx
+++ /dev/null
@@ -1,208 +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: ptitem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/ptitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/awt/Point.hpp>
-#include <tools/stream.hxx>
-
-#include <svtools/poolitem.hxx>
-#include "memberid.hrc"
-
-using namespace ::com::sun::star;
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxPointItem)
-
-#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
-#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L))
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxPointItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxPointItem::SfxPointItem()
-{
- DBG_CTOR(SfxPointItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxPointItem::SfxPointItem( USHORT nW, const Point& rVal ) :
- SfxPoolItem( nW ),
- aVal( rVal )
-{
- DBG_CTOR(SfxPointItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxPointItem::SfxPointItem( USHORT nW, SvStream &rStream ) :
- SfxPoolItem( nW )
-{
- DBG_CTOR(SfxPointItem, 0);
- rStream >> aVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPointItem::SfxPointItem( const SfxPointItem& rItem ) :
- SfxPoolItem( rItem ),
- aVal( rItem.aVal )
-{
- DBG_CTOR(SfxPointItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxPointItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxPointItem, 0);
- rText = UniString::CreateFromInt32(aVal.X());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += UniString::CreateFromInt32(aVal.Y());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxPointItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS(SfxPointItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ((SfxPointItem&)rItem).aVal == aVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxPointItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxPointItem, 0);
- return new SfxPointItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxPointItem::Create(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxPointItem, 0);
- Point aStr;
- rStream >> aStr;
- return new SfxPointItem(Which(), aStr);
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxPointItem::Store(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxPointItem, 0);
- rStream << aVal;
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SfxPointItem::QueryValue( uno::Any& rVal,
- BYTE nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- awt::Point aTmp(aVal.X(), aVal.Y());
- if( bConvert )
- {
- aTmp.X = TWIP_TO_MM100(aTmp.X);
- aTmp.Y = TWIP_TO_MM100(aTmp.Y);
- }
- nMemberId &= ~CONVERT_TWIPS;
- switch ( nMemberId )
- {
- case 0: rVal <<= aTmp; break;
- case MID_X: rVal <<= aTmp.X; break;
- case MID_Y: rVal <<= aTmp.Y; break;
- default: DBG_ERROR("Wrong MemberId!"); return FALSE;
- }
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SfxPointItem::PutValue( const uno::Any& rVal,
- BYTE nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
- BOOL bRet = FALSE;
- awt::Point aValue;
- sal_Int32 nVal = 0;
- if ( !nMemberId )
- {
- bRet = ( rVal >>= aValue );
- if( bConvert )
- {
- aValue.X = MM100_TO_TWIP(aValue.X);
- aValue.Y = MM100_TO_TWIP(aValue.Y);
- }
- }
- else
- {
- bRet = ( rVal >>= nVal );
- if( bConvert )
- nVal = MM100_TO_TWIP( nVal );
- }
-
- if ( bRet )
- {
- switch ( nMemberId )
- {
- case 0: aVal.setX( aValue.X ); aVal.setY( aValue.Y ); break;
- case MID_X: aVal.setX( nVal ); break;
- case MID_Y: aVal.setY( nVal ); break;
- default: DBG_ERROR("Wrong MemberId!"); return FALSE;
- }
- }
-
- return bRet;
-}
-
-
-
diff --git a/svtools/source/items/rectitem.cxx b/svtools/source/items/rectitem.cxx
deleted file mode 100644
index f9faeeeaa824..000000000000
--- a/svtools/source/items/rectitem.cxx
+++ /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: rectitem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/rectitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <tools/stream.hxx>
-
-#include <svtools/poolitem.hxx>
-#include "memberid.hrc"
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxRectangleItem)
-
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxRectangleItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxRectangleItem::SfxRectangleItem()
-{
- DBG_CTOR(SfxRectangleItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxRectangleItem::SfxRectangleItem( USHORT nW, const Rectangle& rVal ) :
- SfxPoolItem( nW ),
- aVal( rVal )
-{
- DBG_CTOR(SfxRectangleItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxRectangleItem::SfxRectangleItem( USHORT nW, SvStream &rStream ) :
- SfxPoolItem( nW )
-{
- DBG_CTOR(SfxRectangleItem, 0);
- rStream >> aVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxRectangleItem::SfxRectangleItem( const SfxRectangleItem& rItem ) :
- SfxPoolItem( rItem ),
- aVal( rItem.aVal )
-{
- DBG_CTOR(SfxRectangleItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxRectangleItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxRectangleItem, 0);
- rText = UniString::CreateFromInt32(aVal.Top());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += UniString::CreateFromInt32(aVal.Left());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += UniString::CreateFromInt32(aVal.Bottom());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += UniString::CreateFromInt32(aVal.Right());
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS(SfxRectangleItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ((SfxRectangleItem&)rItem).aVal == aVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxRectangleItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxRectangleItem, 0);
- return new SfxRectangleItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxRectangleItem::Create(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxRectangleItem, 0);
- Rectangle aStr;
- rStream >> aStr;
- return new SfxRectangleItem(Which(), aStr);
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxRectangleItem::Store(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxRectangleItem, 0);
- rStream << aVal;
- return rStream;
-}
-
-
-// -----------------------------------------------------------------------
-BOOL SfxRectangleItem::QueryValue( com::sun::star::uno::Any& rVal,
- BYTE nMemberId) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- switch ( nMemberId )
- {
- case 0:
- {
- rVal <<= com::sun::star::awt::Rectangle( aVal.getX(),
- aVal.getY(),
- aVal.getWidth(),
- aVal.getHeight() );
- break;
- }
- case MID_RECT_LEFT: rVal <<= aVal.getX(); break;
- case MID_RECT_RIGHT: rVal <<= aVal.getY(); break;
- case MID_WIDTH: rVal <<= aVal.getWidth(); break;
- case MID_HEIGHT: rVal <<= aVal.getHeight(); break;
- default: DBG_ERROR("Wrong MemberID!"); return FALSE;
- }
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-BOOL SfxRectangleItem::PutValue( const com::sun::star::uno::Any& rVal,
- BYTE nMemberId )
-{
- BOOL bRet = FALSE;
- nMemberId &= ~CONVERT_TWIPS;
- com::sun::star::awt::Rectangle aValue;
- sal_Int32 nVal = 0;
- if ( !nMemberId )
- bRet = (rVal >>= aValue);
- else
- bRet = (rVal >>= nVal);
-
- if ( bRet )
- {
- switch ( nMemberId )
- {
- case 0:
- aVal.setX( aValue.X );
- aVal.setY( aValue.Y );
- aVal.setWidth( aValue.Width );
- aVal.setHeight( aValue.Height );
- break;
- case MID_RECT_LEFT: aVal.setX( nVal ); break;
- case MID_RECT_RIGHT: aVal.setY( nVal ); break;
- case MID_WIDTH: aVal.setWidth( nVal ); break;
- case MID_HEIGHT: aVal.setHeight( nVal ); break;
- default: DBG_ERROR("Wrong MemberID!"); return FALSE;
- }
- }
-
- return bRet;
-}
-
-
-
diff --git a/svtools/source/items/rngitem.cxx b/svtools/source/items/rngitem.cxx
deleted file mode 100644
index 0c62de7229f4..000000000000
--- a/svtools/source/items/rngitem.cxx
+++ /dev/null
@@ -1,57 +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: rngitem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <tools/stream.hxx>
-
-#ifndef NUMTYPE
-
-#define NUMTYPE USHORT
-#define SfxXRangeItem SfxRangeItem
-#define SfxXRangesItem SfxUShortRangesItem
-#include <svtools/rngitem.hxx>
-#include "rngitem_inc.cxx"
-
-#define NUMTYPE sal_uInt32
-#define SfxXRangeItem SfxULongRangeItem
-#define SfxXRangesItem SfxULongRangesItem
-#include <svtools/rngitem.hxx>
-#include "rngitem_inc.cxx"
-
-#else
-
-// We leave this condition just in case NUMTYPE has been defined externally to this
-// file and we are supposed to define the SfxXRangeItem based on that.
-
-#include "rngitem_inc.cxx"
-
-#endif
-
diff --git a/svtools/source/items/rngitem_inc.cxx b/svtools/source/items/rngitem_inc.cxx
deleted file mode 100755
index d8cc7ed185ae..000000000000
--- a/svtools/source/items/rngitem_inc.cxx
+++ /dev/null
@@ -1,243 +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: rngitem_inc.cxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// This snippet of code is included by rngitem.cxx but not compiled directly.
-// Ugly hack, probably due to lack of templates in the 20th century.
-
-static inline NUMTYPE Count_Impl(const NUMTYPE * pRanges)
-{
- NUMTYPE nCount = 0;
- for (; *pRanges; pRanges += 2) nCount += 2;
- return nCount;
-}
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxXRangeItem, SfxPoolItem);
-TYPEINIT1_AUTOFACTORY(SfxXRangesItem, SfxPoolItem);
-
-NUMTYPE Count_Impl( const NUMTYPE *pRanges );
-
-// -----------------------------------------------------------------------
-
-SfxXRangeItem::SfxXRangeItem()
-{
- nFrom = 0;
- nTo = 0;
-}
-
-// -----------------------------------------------------------------------
-
-SfxXRangeItem::SfxXRangeItem( USHORT which, NUMTYPE from, NUMTYPE to ):
- SfxPoolItem( which ),
- nFrom( from ),
- nTo( to )
-{
-}
-
-
-// -----------------------------------------------------------------------
-
-SfxXRangeItem::SfxXRangeItem( USHORT nW, SvStream &rStream ) :
- SfxPoolItem( nW )
-{
- rStream >> nFrom;
- rStream >> nTo;
-}
-
-// -----------------------------------------------------------------------
-
-SfxXRangeItem::SfxXRangeItem( const SfxXRangeItem& rItem ) :
- SfxPoolItem( rItem )
-{
- nFrom = rItem.nFrom;
- nTo = rItem.nTo;
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxXRangeItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- rText = UniString::CreateFromInt64(nFrom);
- rText += ':';
- rText += UniString::CreateFromInt64(nTo);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxXRangeItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- SfxXRangeItem* pT = (SfxXRangeItem*)&rItem;
- if( nFrom==pT->nFrom && nTo==pT->nTo )
- return 1;
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxXRangeItem::Clone(SfxItemPool *) const
-{
- return new SfxXRangeItem( Which(), nFrom, nTo );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxXRangeItem::Create(SvStream &rStream, USHORT) const
-{
- NUMTYPE nVon, nBis;
- rStream >> nVon;
- rStream >> nBis;
- return new SfxXRangeItem( Which(), nVon, nBis );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxXRangeItem::Store(SvStream &rStream, USHORT) const
-{
- rStream << nFrom;
- rStream << nTo;
- return rStream;
-}
-
-//=========================================================================
-
-SfxXRangesItem::SfxXRangesItem()
-: _pRanges(0)
-{
-}
-
-//-------------------------------------------------------------------------
-
-SfxXRangesItem::SfxXRangesItem( USHORT nWID, const NUMTYPE *pRanges )
-: SfxPoolItem( nWID )
-{
- NUMTYPE nCount = Count_Impl(pRanges) + 1;
- _pRanges = new NUMTYPE[nCount];
- memcpy( _pRanges, pRanges, sizeof(NUMTYPE) * nCount );
-}
-
-//-------------------------------------------------------------------------
-
-SfxXRangesItem::SfxXRangesItem( USHORT nWID, SvStream &rStream )
-: SfxPoolItem( nWID )
-{
- NUMTYPE nCount;
- rStream >> nCount;
- _pRanges = new NUMTYPE[nCount + 1];
- for ( NUMTYPE n = 0; n < nCount; ++n )
- rStream >> _pRanges[n];
- _pRanges[nCount] = 0;
-}
-
-//-------------------------------------------------------------------------
-
-SfxXRangesItem::SfxXRangesItem( const SfxXRangesItem& rItem )
-: SfxPoolItem( rItem )
-{
- NUMTYPE nCount = Count_Impl(rItem._pRanges) + 1;
- _pRanges = new NUMTYPE[nCount];
- memcpy( _pRanges, rItem._pRanges, sizeof(NUMTYPE) * nCount );
-}
-
-//-------------------------------------------------------------------------
-
-SfxXRangesItem::~SfxXRangesItem()
-{
- delete _pRanges;
-}
-
-//-------------------------------------------------------------------------
-
-int SfxXRangesItem::operator==( const SfxPoolItem &rItem ) const
-{
- const SfxXRangesItem &rOther = (const SfxXRangesItem&) rItem;
- if ( !_pRanges && !rOther._pRanges )
- return TRUE;
- if ( _pRanges || rOther._pRanges )
- return FALSE;
-
- NUMTYPE n;
- for ( n = 0; _pRanges[n] && rOther._pRanges[n]; ++n )
- if ( *_pRanges != rOther._pRanges[n] )
- return 0;
-
- return !_pRanges[n] && !rOther._pRanges[n];
-}
-
-//-------------------------------------------------------------------------
-
-SfxItemPresentation SfxXRangesItem::GetPresentation( SfxItemPresentation /*ePres*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresMetric*/,
- XubString &/*rText*/,
- const IntlWrapper * ) const
-{
- HACK(n. i.)
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-//-------------------------------------------------------------------------
-
-SfxPoolItem* SfxXRangesItem::Clone( SfxItemPool * ) const
-{
- return new SfxXRangesItem( *this );
-}
-
-//-------------------------------------------------------------------------
-
-SfxPoolItem* SfxXRangesItem::Create( SvStream &rStream, USHORT ) const
-{
- return new SfxXRangesItem( Which(), rStream );
-}
-
-//-------------------------------------------------------------------------
-
-SvStream& SfxXRangesItem::Store( SvStream &rStream, USHORT ) const
-{
- NUMTYPE nCount = Count_Impl( _pRanges );
- rStream >> nCount;
- for ( NUMTYPE n = 0; _pRanges[n]; ++n )
- rStream >> _pRanges[n];
- return rStream;
-}
-
-
-#undef NUMTYPE
-#undef SfxXRangeItem
-#undef SfxXRangesItem
diff --git a/svtools/source/items/stritem.cxx b/svtools/source/items/stritem.cxx
deleted file mode 100644
index 37968dc3ee1d..000000000000
--- a/svtools/source/items/stritem.cxx
+++ /dev/null
@@ -1,75 +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: stritem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <svtools/stritem.hxx>
-
-//============================================================================
-//
-// class SfxStringItem
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(SfxStringItem, CntUnencodedStringItem)
-
-//============================================================================
-// virtual
-SfxStringItem::SfxStringItem(USHORT which, SvStream & rStream):
- CntUnencodedStringItem(which)
-{
- UniString aValue;
- readByteString(rStream, aValue);
- SetValue(aValue);
-}
-
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxStringItem::Create(SvStream & rStream, USHORT) const
-{
- return new SfxStringItem(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & SfxStringItem::Store(SvStream & rStream, USHORT) const
-{
- writeByteString(rStream, GetValue());
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxStringItem::Clone(SfxItemPool *) const
-{
- return new SfxStringItem(*this);
-}
-
diff --git a/svtools/source/items/style.cxx b/svtools/source/items/style.cxx
deleted file mode 100644
index ad11f1527ce7..000000000000
--- a/svtools/source/items/style.cxx
+++ /dev/null
@@ -1,1381 +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: style.cxx,v $
- * $Revision: 1.19.60.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#ifndef GCC
-#endif
-
-#define _SVSTDARR_STRINGS
-#define _SVSTDARR_STRINGSSORTDTOR
-#define _SVSTDARR_BYTESTRINGS
-#define _SVSTDARR_BYTESTRINGSSORTDTOR
-
-#include <rtl/uuid.h>
-#include <tools/tenccvt.hxx>
-#include <comphelper/processfactory.hxx>
-#include <unotools/intlwrapper.hxx>
-#include <svtools/smplhint.hxx>
-#include <svtools/poolitem.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
-#include <poolio.hxx>
-#include <svtools/filerec.hxx>
-#include <svtools/itemiter.hxx>
-#include <svtools/style.hxx>
-#include <svtools/svstdarr.hxx>
-#include <vcl/svapp.hxx>
-
-#include <algorithm>
-
-#define STYLESTREAM "SfxStyleSheets"
-#define STYLESTREAM_VERSION USHORT(50)
-
-#ifdef DBG_UTIL
-class DbgStyleSheetReferences
-{
-public:
- DbgStyleSheetReferences() : mnStyles(0), mnPools(0) {}
- ~DbgStyleSheetReferences()
- {
- OSL_TRACE("DbgStyleSheetReferences\nSfxStyleSheetBase left %ld\nSfxStyleSheetBasePool left %ld\n", mnStyles, mnPools );
- }
-
- sal_uInt32 mnStyles;
- sal_uInt32 mnPools;
-}
-aDbgStyleSheetReferences;
-
-#endif
-
-TYPEINIT0(SfxStyleSheetBase)
-
-TYPEINIT3(SfxStyleSheet, SfxStyleSheetBase, SfxListener, SfxBroadcaster)
-
-
-//=========================================================================
-
-TYPEINIT1(SfxStyleSheetHint, SfxHint);
-TYPEINIT1(SfxStyleSheetHintExtended, SfxStyleSheetHint);
-TYPEINIT1(SfxStyleSheetPoolHint, SfxHint);
-
-SfxStyleSheetHintExtended::SfxStyleSheetHintExtended
-(
- USHORT nAction, // SFX_STYLESHEET_... (s.o.)
- const String& rOldName
-)
-: SfxStyleSheetHint( nAction ),
- aName( rOldName )
-{}
-SfxStyleSheetHintExtended::SfxStyleSheetHintExtended
-(
- USHORT nAction, // SFX_STYLESHEET_... (s.o.)
- const String& rOldName,
- SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer
-)
-: SfxStyleSheetHint( nAction, rStyleSheet ),
- aName( rOldName )
-{}
-
-//-------------------------------------------------------------------------
-
-SfxStyleSheetHint::SfxStyleSheetHint
-(
- USHORT nAction, // SFX_STYLESHEET_... (s.o.)
- SfxStyleSheetBase& rStyleSheet // geh"ort weiterhin dem Aufrufer
-)
-: pStyleSh( &rStyleSheet ),
- nHint( nAction )
-{}
-
-SfxStyleSheetHint::SfxStyleSheetHint
-(
- USHORT nAction // SFX_STYLESHEET_... (s.o.)
-)
-: pStyleSh( NULL ),
- nHint( nAction )
-{}
-
-//=========================================================================
-
-class SfxStyleSheetBasePool_Impl
-{
- public:
- SfxStyles aStyles;
- SfxStyleSheetIterator *pIter;
- SfxStyleSheetBasePool_Impl() : pIter(0){}
- ~SfxStyleSheetBasePool_Impl(){delete pIter;}
-};
-
-
-//////////////////////////// SfxStyleSheetBase ///////////////////////////////
-
-// Konstruktoren
-
-SfxStyleSheetBase::SfxStyleSheetBase( const XubString& rName, SfxStyleSheetBasePool& r, SfxStyleFamily eFam, USHORT mask )
- : rPool( r )
- , nFamily( eFam )
- , aName( rName )
- , aParent()
- , aFollow( rName )
- , pSet( NULL )
- , nMask(mask)
- , nHelpId( 0 )
- , bMySet( FALSE )
-{
-#ifdef DBG_UTIL
- aDbgStyleSheetReferences.mnStyles++;
-#endif
-}
-
-SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
- : comphelper::OWeakTypeObject()
- , rPool( r.rPool )
- , nFamily( r.nFamily )
- , aName( r.aName )
- , aParent( r.aParent )
- , aFollow( r.aFollow )
- , aHelpFile( r.aHelpFile )
- , nMask( r.nMask )
- , nHelpId( r.nHelpId )
- , bMySet( r.bMySet )
-{
-#ifdef DBG_UTIL
- aDbgStyleSheetReferences.mnStyles++;
-#endif
- if( r.pSet )
- pSet = bMySet ? new SfxItemSet( *r.pSet ) : r.pSet;
- else
- pSet = NULL;
-}
-
-static SfxStyleSheetBasePool& implGetStaticPool()
-{
- static SfxStyleSheetBasePool* pSheetPool = 0;
- static SfxItemPool* pBasePool = 0;
- if( !pSheetPool )
- {
- UniString aName;
- pBasePool = new SfxItemPool( aName, 0, 0, 0 );
- pSheetPool = new SfxStyleSheetBasePool(*pBasePool);
- }
- return *pSheetPool;
-}
-
-SfxStyleSheetBase::SfxStyleSheetBase()
-: comphelper::OWeakTypeObject()
-, rPool( implGetStaticPool() )
-{
-}
-
-SfxStyleSheetBase::~SfxStyleSheetBase()
-{
-#ifdef DBG_UTIL
- --aDbgStyleSheetReferences.mnStyles;
-#endif
-
- if( bMySet )
- {
- delete pSet;
- pSet = 0;
- }
-}
-
-USHORT SfxStyleSheetBase::GetVersion() const
-{
- return 0x0000;
-}
-
-// Namen aendern
-
-const XubString& SfxStyleSheetBase::GetName() const
-{
- return aName;
-}
-
-BOOL SfxStyleSheetBase::SetName( const XubString& rName )
-{
- if(rName.Len() == 0)
- return FALSE;
- if( aName != rName )
- {
- String aOldName = aName;
- SfxStyleSheetBase *pOther = rPool.Find( rName, nFamily ) ;
- if ( pOther && pOther != this )
- return FALSE;
-
- SfxStyleFamily eTmpFam=rPool.GetSearchFamily();
- USHORT nTmpMask=rPool.GetSearchMask();
-
- rPool.SetSearchMask(nFamily);
-
- if ( aName.Len() )
- rPool.ChangeParent( aName, rName, FALSE );
- if ( aFollow.Equals( aName ) )
- aFollow = rName;
- aName = rName;
- rPool.SetSearchMask(eTmpFam, nTmpMask);
- rPool.Broadcast( SfxStyleSheetHintExtended(
- SFX_STYLESHEET_MODIFIED, aOldName, *this ) );
- }
- return TRUE;
-}
-
-rtl::OUString SfxStyleSheetBase::GetDisplayName() const
-{
- if( maDisplayName.getLength() == 0 )
- {
- return aName;
- }
- else
- {
- return maDisplayName;
- }
-}
-
-void SfxStyleSheetBase::SetDisplayName( const rtl::OUString& rDisplayName )
-{
- maDisplayName = rDisplayName;
-}
-
-// Parent aendern
-
-const XubString& SfxStyleSheetBase::GetParent() const
-{
- return aParent;
-}
-
-BOOL SfxStyleSheetBase::SetParent( const XubString& rName )
-{
- if ( rName == aName )
- return FALSE;
-
- if( aParent != rName )
- {
- SfxStyleSheetBase* pIter = rPool.Find(rName, nFamily);
- if( rName.Len() && !pIter )
- {
- DBG_ERROR( "StyleSheet-Parent nicht gefunden" );
- return FALSE;
- }
- // rekursive Verknuepfungen verhindern
- if( aName.Len() )
- while(pIter)
- {
- if(pIter->GetName() == aName && aName != rName)
- return FALSE;
- pIter = rPool.Find(pIter->GetParent(), nFamily);
- }
- aParent = rName;
- }
- rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
- return TRUE;
-}
-
-// Follow aendern
-
-const XubString& SfxStyleSheetBase::GetFollow() const
-{
- return aFollow;
-}
-
-BOOL SfxStyleSheetBase::SetFollow( const XubString& rName )
-{
- if( aFollow != rName )
- {
- if( !rPool.Find( rName, nFamily ) )
- {
- DBG_ERROR( "StyleSheet-Follow nicht gefunden" );
- return FALSE;
- }
- aFollow = rName;
- }
- rPool.Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_MODIFIED, *this ) );
- return TRUE;
-}
-
-// Itemset setzen. Die Dflt-Implementation legt ein neues Set an.
-
-SfxItemSet& SfxStyleSheetBase::GetItemSet()
-{
- if( !pSet )
- {
- pSet = new SfxItemSet( rPool.GetPool() );
- bMySet = TRUE;
- }
- return *pSet;
-}
-
-// Hilfe-Datei und -ID setzen und abfragen
-
-ULONG SfxStyleSheetBase::GetHelpId( String& rFile )
-{
- rFile = aHelpFile;
- return nHelpId;
-}
-
-void SfxStyleSheetBase::SetHelpId( const String& rFile, ULONG nId )
-{
- aHelpFile = rFile;
- nHelpId = nId;
-}
-
-// Folgevorlage m"oglich? Default: Ja
-
-BOOL SfxStyleSheetBase::HasFollowSupport() const
-{
- return TRUE;
-}
-
-// Basisvorlage m"oglich? Default: Ja
-
-BOOL SfxStyleSheetBase::HasParentSupport() const
-{
- return TRUE;
-}
-
-// Basisvorlage uf NULL setzen m"oglich? Default: Nein
-
-BOOL SfxStyleSheetBase::HasClearParentSupport() const
-{
- return FALSE;
-}
-
-// Defaultmaessig sind alle StyleSheets Used
-
-BOOL SfxStyleSheetBase::IsUsed() const
-{
- return TRUE;
-}
-
-// eingestellte Attribute ausgeben
-
-
-XubString SfxStyleSheetBase::GetDescription()
-{
- return GetDescription( SFX_MAPUNIT_CM );
-}
-
-// eingestellte Attribute ausgeben
-
-XubString SfxStyleSheetBase::GetDescription( SfxMapUnit eMetric )
-{
- SfxItemIter aIter( GetItemSet() );
- XubString aDesc;
- const SfxPoolItem* pItem = aIter.FirstItem();
-
- IntlWrapper aIntlWrapper(comphelper::getProcessServiceFactory(),
- Application::GetSettings().GetLanguage());
- while ( pItem )
- {
- XubString aItemPresentation;
-
- if ( !IsInvalidItem( pItem ) &&
- rPool.GetPool().GetPresentation(
- *pItem, SFX_ITEM_PRESENTATION_COMPLETE,
- eMetric, aItemPresentation, &aIntlWrapper ) )
- {
- if ( aDesc.Len() && aItemPresentation.Len() )
- aDesc.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" + "));
- if ( aItemPresentation.Len() )
- aDesc += aItemPresentation;
- }
- pItem = aIter.NextItem();
- }
- return aDesc;
-}
-
-/////////////////////////// SfxStyleSheetIterator ///////////////////////////////
-
-SfxStyleFamily SfxStyleSheetIterator::GetSearchFamily() const
-{
- return nSearchFamily;
-}
-
-inline BOOL SfxStyleSheetIterator::IsTrivialSearch()
-{
- return nMask == 0xFFFF && GetSearchFamily() == SFX_STYLE_FAMILY_ALL;
-}
-
-BOOL SfxStyleSheetIterator::DoesStyleMatch(SfxStyleSheetBase *pStyle)
-{
- return ((GetSearchFamily() == SFX_STYLE_FAMILY_ALL) ||
- ( pStyle->GetFamily() == GetSearchFamily() ))
- && (( pStyle->GetMask() & ( GetSearchMask() & ~SFXSTYLEBIT_USED )) ||
- ( bSearchUsed ? pStyle->IsUsed() : FALSE ) ||
- GetSearchMask() == SFXSTYLEBIT_ALL );
-}
-
-
-SfxStyleSheetIterator::SfxStyleSheetIterator(SfxStyleSheetBasePool *pBase,
- SfxStyleFamily eFam, USHORT n)
-{
- pBasePool=pBase;
- nSearchFamily=eFam;
- bSearchUsed=FALSE;
- if((n != SFXSTYLEBIT_ALL ) && ((n & SFXSTYLEBIT_USED) == SFXSTYLEBIT_USED))
- {
- bSearchUsed = TRUE;
- n &= ~SFXSTYLEBIT_USED;
- }
- nMask=n;
-}
-
-SfxStyleSheetIterator::~SfxStyleSheetIterator()
-{
-}
-
-
-USHORT SfxStyleSheetIterator::Count()
-{
- USHORT n = 0;
- if( IsTrivialSearch())
- n = (USHORT) pBasePool->aStyles.size();
- else
- for(USHORT i=0; i<pBasePool->aStyles.size(); i++)
- {
- SfxStyleSheetBase* pStyle = pBasePool->aStyles[i].get();
- if(DoesStyleMatch(pStyle))
- n++;
- }
- return n;
-}
-
-SfxStyleSheetBase* SfxStyleSheetIterator::operator[](USHORT nIdx)
-{
- if( IsTrivialSearch())
- return pBasePool->aStyles[nIdx].get();
-
- USHORT z = 0;
- for(USHORT n=0; n<pBasePool->aStyles.size(); n++)
- {
- SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
- if( DoesStyleMatch(pStyle))
- {
- if(z == nIdx)
- {
- nAktPosition=n;
- return pAktStyle=pStyle;
- }
- ++z;
- }
- }
- DBG_ERROR("falscher Index");
- return 0;
-}
-
-SfxStyleSheetBase* SfxStyleSheetIterator::First()
-{
- INT32 nIdx = -1;
-
- if ( IsTrivialSearch() && pBasePool->aStyles.size() )
- nIdx = 0;
- else
- for( USHORT n = 0; n < pBasePool->aStyles.size(); n++ )
- {
- SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
-
- if ( DoesStyleMatch( pStyle ) )
- {
- nIdx = n;
- break;
- }
- }
-
- if ( nIdx != -1 )
- {
- nAktPosition = (USHORT)nIdx;
- return pAktStyle = pBasePool->aStyles[nIdx].get();
- }
- return 0;
-}
-
-
-SfxStyleSheetBase* SfxStyleSheetIterator::Next()
-{
- INT32 nIdx = -1;
-
- if ( IsTrivialSearch() &&
- (USHORT)pBasePool->aStyles.size() > nAktPosition + 1 )
- nIdx = nAktPosition + 1;
- else
- for( USHORT n = nAktPosition + 1; n < pBasePool->aStyles.size(); n++ )
- {
- SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
-
- if ( DoesStyleMatch( pStyle ) )
- {
- nIdx = n;
- break;
- }
- }
-
- if ( nIdx != -1 )
- {
- nAktPosition = (USHORT)nIdx;
- return pAktStyle = pBasePool->aStyles[nIdx].get();
- }
- return 0;
-}
-
-
-SfxStyleSheetBase* SfxStyleSheetIterator::Find(const XubString& rStr)
-{
- for ( USHORT n = 0; n < pBasePool->aStyles.size(); n++ )
- {
- SfxStyleSheetBase* pStyle = pBasePool->aStyles[n].get();
-
- // #98454# performance: in case of bSearchUsed==TRUE it may be
- // significant to first compare the name and only if it matches to call
- // the style sheet IsUsed() method in DoesStyleMatch().
- if ( pStyle->GetName().Equals( rStr ) && DoesStyleMatch( pStyle ) )
- {
- nAktPosition = n;
- return pAktStyle = pStyle;
- }
- }
- return 0;
-}
-
-
-USHORT SfxStyleSheetIterator::GetSearchMask() const
-{
- USHORT mask = nMask;
-
- if ( bSearchUsed )
- mask |= SFXSTYLEBIT_USED;
- return mask;
-}
-
-/////////////////////////// SfxStyleSheetBasePool ///////////////////////////////
-
-void SfxStyleSheetBasePool::Replace(
- SfxStyleSheetBase& rSource, SfxStyleSheetBase& rTarget )
-{
- rTarget.SetFollow( rSource.GetFollow() );
- rTarget.SetParent( rSource.GetParent() );
- SfxItemSet& rSourceSet = rSource.GetItemSet();
- SfxItemSet& rTargetSet = rTarget.GetItemSet();
- rTargetSet.Intersect( rSourceSet );
- rTargetSet.Put( rSourceSet );
-}
-
-SfxStyleSheetIterator& SfxStyleSheetBasePool::GetIterator_Impl()
-{
- SfxStyleSheetIterator*& rpIter = pImp->pIter;
- if( !rpIter || (rpIter->GetSearchMask() != nMask) || (rpIter->GetSearchFamily() != nSearchFamily) )
- {
- delete rpIter;
- rpIter = CreateIterator( nSearchFamily, nMask );
- }
- return *rpIter;
-}
-
-
-SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& r )
- : aAppName(r.GetName())
- , rPool(r)
- , nSearchFamily(SFX_STYLE_FAMILY_PARA)
- , nMask(0xFFFF)
-{
-#ifdef DBG_UTIL
- aDbgStyleSheetReferences.mnPools++;
-#endif
-
- pImp = new SfxStyleSheetBasePool_Impl;
-}
-
-SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r )
- : SfxBroadcaster( r )
- , comphelper::OWeakTypeObject()
- , aAppName(r.aAppName)
- , rPool(r.rPool)
- , nSearchFamily(r.nSearchFamily)
- , nMask( r.nMask )
-{
-#ifdef DBG_UTIL
- aDbgStyleSheetReferences.mnPools++;
-#endif
-
- pImp = new SfxStyleSheetBasePool_Impl;
- *this += r;
-}
-
-SfxStyleSheetBasePool::~SfxStyleSheetBasePool()
-{
-#ifdef DBG_UTIL
- aDbgStyleSheetReferences.mnPools--;
-#endif
-
- Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
- Clear();
- delete pImp;
-}
-
-BOOL SfxStyleSheetBasePool::SetParent(SfxStyleFamily eFam, const XubString& rStyle, const XubString& rParent)
-{
- SfxStyleSheetIterator aIter(this,eFam,SFXSTYLEBIT_ALL);
- SfxStyleSheetBase *pStyle =
- aIter.Find(rStyle);
- DBG_ASSERT(pStyle, "Vorlage nicht gefunden. Writer mit Solar <2541??");
- if(pStyle)
- return pStyle->SetParent(rParent);
- else
- return FALSE;
-}
-
-
-void SfxStyleSheetBasePool::SetSearchMask(SfxStyleFamily eFam, USHORT n)
-{
- nSearchFamily = eFam; nMask = n;
-}
-
-USHORT SfxStyleSheetBasePool::GetSearchMask() const
-{
- return nMask;
-}
-
-
-// Der Name des Streams
-
-String SfxStyleSheetBasePool::GetStreamName()
-{
- return String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(STYLESTREAM));
-}
-
-/////////////////////////////////// Factory ////////////////////////////////
-
-
-
-SfxStyleSheetIterator* SfxStyleSheetBasePool::CreateIterator
-(
- SfxStyleFamily eFam,
- USHORT mask
-)
-{
- return new SfxStyleSheetIterator(this,eFam,mask);
-}
-
-
-SfxStyleSheetBase* SfxStyleSheetBasePool::Create
-(
- const XubString& rName,
- SfxStyleFamily eFam,
- USHORT mask
-)
-{
- return new SfxStyleSheetBase( rName, *this, eFam, mask );
-}
-
-SfxStyleSheetBase* SfxStyleSheetBasePool::Create( const SfxStyleSheetBase& r )
-{
- return new SfxStyleSheetBase( r );
-}
-
-SfxStyleSheetBase& SfxStyleSheetBasePool::Make( const XubString& rName, SfxStyleFamily eFam, USHORT mask, USHORT nPos)
-{
- DBG_ASSERT( eFam != SFX_STYLE_FAMILY_ALL, "svtools::SfxStyleSheetBasePool::Make(), FamilyAll is not a allowed Familie" );
-
- SfxStyleSheetIterator aIter(this, eFam, mask);
- rtl::Reference< SfxStyleSheetBase > xStyle( aIter.Find( rName ) );
- DBG_ASSERT( !xStyle.is(), "svtools::SfxStyleSheetBasePool::Make(), StyleSheet already exists" );
- SfxStyleSheetIterator& rIter = GetIterator_Impl();
-
- if( !xStyle.is() )
- {
- xStyle = Create( rName, eFam, mask );
- if(0xffff == nPos || nPos == aStyles.size() || nPos == rIter.Count())
- {
- aStyles.push_back( xStyle );
- }
- else
- {
- rIter[nPos];
- aStyles.insert( aStyles.begin() + rIter.GetPos(), xStyle );
- }
- Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *xStyle.get() ) );
- }
- return *xStyle.get();
-}
-
-/////////////////////////////// Kopieren ///////////////////////////////////
-
-// Hilfsroutine: Falls eine Vorlage dieses Namens existiert, wird
-// sie neu erzeugt. Alle Vorlagen, die diese Vorlage zum Parent haben,
-// werden umgehaengt.
-
-SfxStyleSheetBase& SfxStyleSheetBasePool::Add( SfxStyleSheetBase& rSheet )
-{
- SfxStyleSheetIterator aIter(this, rSheet.GetFamily(), nMask);
- SfxStyleSheetBase* pOld = aIter.Find( rSheet.GetName() );
- Remove( pOld );
- rtl::Reference< SfxStyleSheetBase > xNew( Create( rSheet ) );
- aStyles.push_back( xNew );
- Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CHANGED, *xNew.get() ) );
- return *xNew.get();
-}
-
-SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator=( const SfxStyleSheetBasePool& r )
-{
- if( &r != this )
- {
- Clear();
- *this += r;
- }
- return *this;
-}
-
-SfxStyleSheetBasePool& SfxStyleSheetBasePool::operator+=( const SfxStyleSheetBasePool& r )
-{
- if( &r != this )
- {
- SfxStyles::const_iterator aIter( r.aStyles.begin() );
- while( aIter != r.aStyles.end() )
- {
- Add(*(*aIter++).get());
- }
- }
- return *this;
-}
-
-//////////////////////////////// Suchen ////////////////////////////////////
-
-USHORT SfxStyleSheetBasePool::Count()
-{
- return GetIterator_Impl().Count();
-}
-
-SfxStyleSheetBase *SfxStyleSheetBasePool::operator[](USHORT nIdx)
-{
- return GetIterator_Impl()[nIdx];
-}
-
-SfxStyleSheetBase* SfxStyleSheetBasePool::Find(const XubString& rName,
- SfxStyleFamily eFam,
- USHORT mask)
-{
- SfxStyleSheetIterator aIter(this,eFam,mask);
- return aIter.Find(rName);
-}
-
-const SfxStyles& SfxStyleSheetBasePool::GetStyles()
-{
- return aStyles;
-}
-
-SfxStyleSheetBase* SfxStyleSheetBasePool::First()
-{
- return GetIterator_Impl().First();
-}
-
-SfxStyleSheetBase* SfxStyleSheetBasePool::Next()
-{
- return GetIterator_Impl().Next();
-}
-
-//////////////////////////////// Loeschen /////////////////////////////////
-
-void SfxStyleSheetBasePool::Remove( SfxStyleSheetBase* p )
-{
- if( p )
- {
- SfxStyles::iterator aIter( std::find( aStyles.begin(), aStyles.end(), rtl::Reference< SfxStyleSheetBase >( p ) ) );
- if( aIter != aStyles.end() )
- {
- // Alle Styles umsetzen, deren Parent dieser hier ist
- ChangeParent( p->GetName(), p->GetParent() );
- aStyles.erase(aIter);
- Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *p ) );
- }
- }
-}
-
-void SfxStyleSheetBasePool::Insert( SfxStyleSheetBase* p )
-{
- DBG_ASSERT( p, "svtools::SfxStyleSheetBasePool::Insert(), no stylesheet?" );
-
- SfxStyleSheetIterator aIter(this, p->GetFamily(), p->GetMask());
- SfxStyleSheetBase* pOld = aIter.Find( p->GetName() );
- DBG_ASSERT( !pOld, "svtools::SfxStyleSheetBasePool::Insert(), StyleSheet already inserted" );
- if( p->GetParent().Len() )
- {
- pOld = aIter.Find( p->GetParent() );
- DBG_ASSERT( pOld, "svtools::SfxStyleSheetBasePool::Insert(), Parent not found!" );
- }
- aStyles.push_back( rtl::Reference< SfxStyleSheetBase >( p ) );
- Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_CREATED, *p ) );
-}
-
-void SfxStyleSheetBasePool::Clear()
-{
- SfxStyles aClearStyles;
- aClearStyles.swap( aStyles );
-
- SfxStyles::iterator aIter( aClearStyles.begin() );
- while( aIter != aClearStyles.end() )
- {
- Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_ERASED, *(*aIter++).get() ) );
- }
-}
-
-/////////////////////////// Parents umsetzen ////////////////////////////////
-
-void SfxStyleSheetBasePool::ChangeParent(const XubString& rOld,
- const XubString& rNew,
- BOOL bVirtual)
-{
- const USHORT nTmpMask = GetSearchMask();
- SetSearchMask(GetSearchFamily(), 0xffff);
- for( SfxStyleSheetBase* p = First(); p; p = Next() )
- {
- if( p->GetParent().Equals( rOld ) )
- {
- if(bVirtual)
- p->SetParent( rNew );
- else
- p->aParent = rNew;
- }
- }
- SetSearchMask(GetSearchFamily(), nTmpMask);
-}
-
-/////////////////////////// Laden/Speichern /////////////////////////////////
-
-void SfxStyleSheetBase::Load( SvStream&, USHORT )
-{
-}
-
-void SfxStyleSheetBase::Store( SvStream& )
-{
-}
-
-
-BOOL SfxStyleSheetBasePool::Load( SvStream& rStream )
-{
- // alte Version?
- if ( !rPool.IsVer2_Impl() )
- return Load1_Impl( rStream );
-
- // gesamten StyleSheetPool in neuer Version aus einem MiniRecord lesen
- SfxMiniRecordReader aPoolRec( &rStream, SFX_STYLES_REC );
-
- // Header-Record lesen
- short nCharSet = 0;
- if ( !rStream.GetError() )
- {
- SfxSingleRecordReader aHeaderRec( &rStream, SFX_STYLES_REC_HEADER );
- if ( !aHeaderRec.IsValid() )
- return FALSE;
-
- aAppName = rPool.GetName();
- rStream >> nCharSet;
- }
-
- // Styles-Record lesen
- if ( !rStream.GetError() )
- {
- SfxMultiRecordReader aStylesRec( &rStream, SFX_STYLES_REC_STYLES );
- if ( !aStylesRec.IsValid() )
- return FALSE;
-
- rtl_TextEncoding eEnc = GetSOLoadTextEncoding(
- (rtl_TextEncoding)nCharSet,
- sal::static_int_cast< USHORT >(rStream.GetVersion()) );
- rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
- rStream.SetStreamCharSet( eEnc );
-
- USHORT nStyles;
- for ( nStyles = 0; aStylesRec.GetContent(); nStyles++ )
- {
- // kann nicht mehr weiterlesen?
- if ( rStream.GetError() )
- break;
-
- // Globale Teile
- XubString aName, aParent, aFollow;
- String aHelpFile;
- USHORT nFamily, nStyleMask,nCount;
- sal_uInt32 nHelpId;
- rStream.ReadByteString(aName, eEnc );
- rStream.ReadByteString(aParent, eEnc );
- rStream.ReadByteString(aFollow, eEnc );
- rStream >> nFamily >> nStyleMask;
- SfxPoolItem::readByteString(rStream, aHelpFile);
- rStream >> nHelpId;
-
- SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask);
- rSheet.SetHelpId( aHelpFile, nHelpId );
- // Hier erst einmal Parent und Follow zwischenspeichern
- rSheet.aParent = aParent;
- rSheet.aFollow = aFollow;
- UINT32 nPos = rStream.Tell();
- rStream >> nCount;
- if(nCount)
- {
- rStream.Seek( nPos );
- // Das Laden des ItemSets bedient sich der Methode GetItemSet(),
- // damit eigene ItemSets untergeschoben werden koennen
- SfxItemSet& rSet = rSheet.GetItemSet();
- rSet.ClearItem();
- //! SfxItemSet aTmpSet( *pTmpPool );
- /*!aTmpSet*/ rSet.Load( rStream );
- //! rSet.Put( aTmpSet );
- }
- // Lokale Teile
- UINT32 nSize;
- USHORT nVer;
- rStream >> nVer >> nSize;
- nPos = rStream.Tell() + nSize;
- rSheet.Load( rStream, nVer );
- rStream.Seek( nPos );
- }
-
- // #72939# only loop through the styles that were really inserted
- ULONG n = aStyles.size();
-
- //! delete pTmpPool;
- // Jetzt Parent und Follow setzen. Alle Sheets sind geladen.
- // Mit Setxxx() noch einmal den String eintragen, da diese
- // virtuellen Methoden evtl. ueberlagert sind.
- for ( ULONG i = 0; i < n; i++ )
- {
- SfxStyleSheetBase* p = aStyles[ i ].get();
- XubString aText = p->aParent;
- p->aParent.Erase();
- p->SetParent( aText );
- aText = p->aFollow;
- p->aFollow.Erase();
- p->SetFollow( aText );
- }
-
- rStream.SetStreamCharSet( eOldEnc );
- }
-
- // alles klar?
- return BOOL( rStream.GetError() == SVSTREAM_OK );
-}
-
-BOOL SfxStyleSheetBasePool::Load1_Impl( SvStream& rStream )
-{
- aAppName = rPool.GetName();
- USHORT nVersion;
- short nCharSet;
- rStream >> nVersion;
-
- if(nVersion!=STYLESTREAM_VERSION)
- nCharSet=nVersion;
- else
- rStream >> nCharSet;
-
- rtl_TextEncoding eEnc = GetSOLoadTextEncoding(
- (rtl_TextEncoding)nCharSet,
- sal::static_int_cast< USHORT >(rStream.GetVersion()) );
- rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
- rStream.SetStreamCharSet( eEnc );
-
- USHORT nStyles;
- rStream >> nStyles;
- USHORT i;
- for ( i = 0; i < nStyles; i++ )
- {
- // kann nicht mehr weiterlesen?
- if ( rStream.GetError() )
- {
- nStyles = i;
- break;
- }
-
- // Globale Teile
- XubString aName, aParent, aFollow;
- String aHelpFile;
- USHORT nFamily, nStyleMask,nCount;
- sal_uInt32 nHelpId;
- rStream.ReadByteString(aName, eEnc );
- rStream.ReadByteString(aParent, eEnc );
- rStream.ReadByteString(aFollow, eEnc );
- rStream >> nFamily >> nStyleMask;
- SfxPoolItem::readByteString(rStream, aHelpFile);
- if(nVersion!=STYLESTREAM_VERSION)
- {
- USHORT nTmpHelpId;
- rStream >> nTmpHelpId;
- nHelpId=nTmpHelpId;
- }
- else
- rStream >> nHelpId;
-
- SfxStyleSheetBase& rSheet = Make( aName, (SfxStyleFamily)nFamily , nStyleMask);
- rSheet.SetHelpId( aHelpFile, nHelpId );
- // Hier erst einmal Parent und Follow zwischenspeichern
- rSheet.aParent = aParent;
- rSheet.aFollow = aFollow;
- UINT32 nPos = rStream.Tell();
- rStream >> nCount;
- if(nCount) {
- rStream.Seek( nPos );
- // Das Laden des ItemSets bedient sich der Methode GetItemSet(),
- // damit eigene ItemSets untergeschoben werden koennen
- SfxItemSet& rSet = rSheet.GetItemSet();
- rSet.ClearItem();
-//! SfxItemSet aTmpSet( *pTmpPool );
- /*!aTmpSet*/ rSet.Load( rStream );
- //! rSet.Put( aTmpSet );
- }
- // Lokale Teile
- UINT32 nSize;
- USHORT nVer;
- rStream >> nVer >> nSize;
- nPos = rStream.Tell() + nSize;
- rSheet.Load( rStream, nVer );
- rStream.Seek( nPos );
- }
-
- //! delete pTmpPool;
- // Jetzt Parent und Follow setzen. Alle Sheets sind geladen.
- // Mit Setxxx() noch einmal den String eintragen, da diese
- // virtuellen Methoden evtl. ueberlagert sind.
- for ( i = 0; i < nStyles; i++ )
- {
- SfxStyleSheetBase* p = aStyles[ i ].get();
- XubString aText = p->aParent;
- p->aParent.Erase();
- p->SetParent( aText );
- aText = p->aFollow;
- p->aFollow.Erase();
- p->SetFollow( aText );
- }
-
- rStream.SetStreamCharSet( eOldEnc );
-
- return BOOL( rStream.GetError() == SVSTREAM_OK );
-}
-
-BOOL SfxStyleSheetBasePool::Store( SvStream& rStream, BOOL bUsed )
-{
- // den ganzen StyleSheet-Pool in einen Mini-Record
- SfxMiniRecordWriter aPoolRec( &rStream, SFX_STYLES_REC );
-
- // Erst einmal die Dummies rauszaehlen; die werden nicht gespeichert
- USHORT nCount = 0;
- for( SfxStyleSheetBase* p = First(); p; p = Next() )
- {
- if(!bUsed || p->IsUsed())
- nCount++;
- }
-
- // einen Header-Record vorweg
- rtl_TextEncoding eEnc
- = ::GetSOStoreTextEncoding(
- rStream.GetStreamCharSet(),
- sal::static_int_cast< USHORT >(rStream.GetVersion()) );
- rtl_TextEncoding eOldEnc = rStream.GetStreamCharSet();
- rStream.SetStreamCharSet( eEnc );
-
- {
- SfxSingleRecordWriter aHeaderRec( &rStream,
- SFX_STYLES_REC_HEADER,
- STYLESTREAM_VERSION );
- rStream << (short) eEnc;
- }
-
- // die StyleSheets in einen MultiVarRecord
- {
- // Bug 79478:
- // make a check loop, to be shure, that the converted names are also
- // unique like the originals! In other cases we get a loop.
- SvStringsSortDtor aSortOrigNames( 0, 128 );
- SvStrings aOrigNames( 0, 128 );
- SvByteStringsSortDtor aSortConvNames( 0, 128 );
- SvByteStrings aConvNames( 0, 128 );
-
- {
-
- for( SfxStyleSheetBase* p = First(); p; p = Next() )
- {
- if(!bUsed || p->IsUsed())
- {
- USHORT nFamily = (USHORT)p->GetFamily();
- String* pName = new String( p->GetName() );
- ByteString* pConvName = new ByteString( *pName, eEnc );
-
- pName->Insert( (sal_Unicode)nFamily, 0 );
- pConvName->Insert( " ", 0 );
- pConvName->SetChar(
- 0,
- sal::static_int_cast< char >(0xff & (nFamily >> 8)) );
- pConvName->SetChar(
- 1, sal::static_int_cast< char >(0xff & nFamily) );
-
- USHORT nInsPos, nAdd = aSortConvNames.Count();
- while( !aSortConvNames.Insert( pConvName, nInsPos ) )
- (pConvName->Append( '_' )).Append(
- ByteString::CreateFromInt32( nAdd++ ));
- aOrigNames.Insert( pName, nInsPos );
- }
- }
-
- // now we have the list of the names, sorted by convertede names
- // But now we need the sorted list of orignames.
- {
- USHORT nInsPos, nEnd = aOrigNames.Count();
- const ByteStringPtr* ppB = aSortConvNames.GetData();
- for( USHORT n = 0; n < nEnd; ++n, ++ppB )
- {
- String* p = aOrigNames.GetObject( n );
- aSortOrigNames.Insert( p, nInsPos );
- aConvNames.Insert( *ppB, nInsPos );
- }
-
- }
- }
-
-
- ByteString sEmpty;
- USHORT nFndPos;
- String sNm;
- SfxMultiVarRecordWriter aStylesRec( &rStream, SFX_STYLES_REC_STYLES, 0 );
- for( SfxStyleSheetBase* p = First(); p; p = Next() )
- {
- if(!bUsed || p->IsUsed())
- {
- aStylesRec.NewContent();
-
- // Globale Teile speichern
- String aHelpFile;
- sal_uInt32 nHelpId = p->GetHelpId( aHelpFile );
- USHORT nFamily = sal::static_int_cast< USHORT >(p->GetFamily());
- String sFamily( (sal_Unicode)nFamily );
-
- (sNm = sFamily) += p->GetName();
- if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
- rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
- else
- rStream.WriteByteString( sEmpty );
-
- (sNm = sFamily) += p->GetParent();
- if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
- rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
- else
- rStream.WriteByteString( sEmpty );
-
- (sNm = sFamily) += p->GetFollow();
- if( aSortOrigNames.Seek_Entry( &sNm, &nFndPos ))
- rStream.WriteByteString( aConvNames.GetObject( nFndPos )->Copy( 2 ));
- else
- rStream.WriteByteString( sEmpty );
-
- rStream << nFamily << p->GetMask();
- SfxPoolItem::writeByteString(rStream, aHelpFile);
- rStream << nHelpId;
- if(p->pSet)
- p->pSet->Store( rStream );
- else
- rStream << (USHORT)0;
-
- // Lokale Teile speichern
- // Vor dem lokalen Teil wird die Laenge der lokalen Daten
- // als UINT32 sowie die Versionsnummer gespeichert.
- rStream << (USHORT) p->GetVersion();
- ULONG nPos1 = rStream.Tell();
- rStream << (UINT32) 0;
- p->Store( rStream );
- ULONG nPos2 = rStream.Tell();
- rStream.Seek( nPos1 );
- rStream << (UINT32) ( nPos2 - nPos1 - sizeof( UINT32 ) );
- rStream.Seek( nPos2 );
- if( rStream.GetError() != SVSTREAM_OK )
- break;
- }
- }
- }
-
- rStream.SetStreamCharSet( eOldEnc );
-
- return BOOL( rStream.GetError() == SVSTREAM_OK );
-}
-
-SfxItemPool& SfxStyleSheetBasePool::GetPool()
-{
- return rPool;
-}
-
-const SfxItemPool& SfxStyleSheetBasePool::GetPool() const
-{
- return rPool;
-}
-
-/////////////////////// SfxStyleSheet /////////////////////////////////
-
-SfxStyleSheet::SfxStyleSheet(const XubString &rName,
- const SfxStyleSheetBasePool& r_Pool,
- SfxStyleFamily eFam,
- USHORT mask ):
- SfxStyleSheetBase(rName, const_cast< SfxStyleSheetBasePool& >( r_Pool ), eFam, mask)
-{}
-
-SfxStyleSheet::SfxStyleSheet(const SfxStyleSheet& rStyle) :
- SfxStyleSheetBase(rStyle),
- SfxListener( rStyle ),
- SfxBroadcaster( rStyle )
-{}
-
-SfxStyleSheet::SfxStyleSheet()
-{
-}
-
-SfxStyleSheet::~SfxStyleSheet()
-{
- Broadcast( SfxStyleSheetHint( SFX_STYLESHEET_INDESTRUCTION, *this ) );
-}
-
-
-BOOL SfxStyleSheet::SetParent( const XubString& rName )
-{
- if(aParent == rName)
- return TRUE;
- const XubString aOldParent(aParent);
- if(SfxStyleSheetBase::SetParent(rName)) {
- // aus der Benachrichtigungskette des alten
- // Parents gfs. austragen
- if(aOldParent.Len()) {
- SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aOldParent, nFamily, 0xffff);
- if(pParent)
- EndListening(*pParent);
- }
- // in die Benachrichtigungskette des neuen
- // Parents eintragen
- if(aParent.Len()) {
- SfxStyleSheet *pParent = (SfxStyleSheet *)rPool.Find(aParent, nFamily, 0xffff);
- if(pParent)
- StartListening(*pParent);
- }
- return TRUE;
- }
- return FALSE;
-}
-
-// alle Zuhoerer benachtichtigen
-
-void SfxStyleSheet::Notify(SfxBroadcaster& rBC, const SfxHint& rHint )
-{
- Forward(rBC, rHint);
-}
-
-//////////////////////// SfxStyleSheetPool ///////////////////////////////
-
-SfxStyleSheetPool::SfxStyleSheetPool( SfxItemPool const& rSet)
-: SfxStyleSheetBasePool( const_cast< SfxItemPool& >( rSet ) )
-{
-}
-
-/////////////////////////////////// Factory ////////////////////////////////
-
-SfxStyleSheetBase* SfxStyleSheetPool::Create( const XubString& rName,
- SfxStyleFamily eFam, USHORT mask )
-{
- return new SfxStyleSheet( rName, *this, eFam, mask );
-}
-
-SfxStyleSheetBase* SfxStyleSheetPool::Create( const SfxStyleSheet& r )
-{
- return new SfxStyleSheet( r );
-}
-/*
-BOOL SfxStyleSheetPool::CopyTo(SfxStyleSheetPool &, const String &)
-{
- return FALSE;
-}
-*/
-
-// --------------------------------------------------------------------
-// class SfxUnoStyleSheet
-// --------------------------------------------------------------------
-
-SfxUnoStyleSheet::SfxUnoStyleSheet( const UniString& _rName, const SfxStyleSheetBasePool& _rPool, SfxStyleFamily _eFamily, USHORT _nMaske )
-: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rName, _rPool, _eFamily, _nMaske )
-{
-}
-
-// --------------------------------------------------------------------
-SfxUnoStyleSheet::SfxUnoStyleSheet( const SfxStyleSheet& _rSheet )
-: ::cppu::ImplInheritanceHelper2< SfxStyleSheet, ::com::sun::star::style::XStyle, ::com::sun::star::lang::XUnoTunnel >( _rSheet )
-{
-}
-
-// --------------------------------------------------------------------
-
-SfxUnoStyleSheet* SfxUnoStyleSheet::getUnoStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle )
-{
- SfxUnoStyleSheet* pRet = dynamic_cast< SfxUnoStyleSheet* >( xStyle.get() );
- if( !pRet )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xStyle, ::com::sun::star::uno::UNO_QUERY );
- if( xUT.is() )
- pRet = reinterpret_cast<SfxUnoStyleSheet*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SfxUnoStyleSheet::getIdentifier())));
- }
- return pRet;
-}
-
-// --------------------------------------------------------------------
-// XUnoTunnel
-// --------------------------------------------------------------------
-
-::sal_Int64 SAL_CALL SfxUnoStyleSheet::getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& rId ) throw (::com::sun::star::uno::RuntimeException)
-{
- if( rId.getLength() == 16 && 0 == rtl_compareMemory( getIdentifier().getConstArray(), rId.getConstArray(), 16 ) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return 0;
- }
-}
-
-// --------------------------------------------------------------------
-
-const ::com::sun::star::uno::Sequence< ::sal_Int8 >& SfxUnoStyleSheet::getIdentifier()
-{
- static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
- if( !pSeq )
- {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pSeq )
- {
- static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
- pSeq = &aSeq;
- }
- }
- return *pSeq;
-}
-
-// --------------------------------------------------------------------
diff --git a/svtools/source/items/szitem.cxx b/svtools/source/items/szitem.cxx
deleted file mode 100644
index ec3ff83dd2ec..000000000000
--- a/svtools/source/items/szitem.cxx
+++ /dev/null
@@ -1,214 +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: szitem.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <svtools/szitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/awt/Size.hpp>
-#include <tools/stream.hxx>
-#include <tools/gen.hxx>
-
-#include <svtools/poolitem.hxx>
-#include "memberid.hrc"
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxSizeItem)
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxSizeItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxSizeItem::SfxSizeItem()
-{
- DBG_CTOR(SfxSizeItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxSizeItem::SfxSizeItem( USHORT nW, const Size& rVal ) :
- SfxPoolItem( nW ),
- aVal( rVal )
-{
- DBG_CTOR(SfxSizeItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxSizeItem::SfxSizeItem( USHORT nW, SvStream &rStream ) :
- SfxPoolItem( nW )
-{
- DBG_CTOR(SfxSizeItem, 0);
- rStream >> aVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxSizeItem::SfxSizeItem( const SfxSizeItem& rItem ) :
- SfxPoolItem( rItem ),
- aVal( rItem.aVal )
-{
- DBG_CTOR(SfxSizeItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxSizeItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxSizeItem, 0);
- rText = UniString::CreateFromInt32(aVal.Width());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += UniString::CreateFromInt32(aVal.Height());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxSizeItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS(SfxSizeItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ((SfxSizeItem&)rItem).aVal == aVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxSizeItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxSizeItem, 0);
- return new SfxSizeItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxSizeItem::Create(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxSizeItem, 0);
- Size aStr;
- rStream >> aStr;
- return new SfxSizeItem(Which(), aStr);
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxSizeItem::Store(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxSizeItem, 0);
- rStream << aVal;
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-BOOL SfxSizeItem::QueryValue( com::sun::star::uno::Any& rVal,
- BYTE nMemberId ) const
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
-
- Size aTmp(aVal);
- if( bConvert )
- {
- aTmp.Height() = ( aTmp.Height() * 127 + 36) / 72;
- aTmp.Width() = ( aTmp.Width() * 127 + 36) / 72;
- }
-
- switch ( nMemberId )
- {
- case 0:
- {
- rVal <<= com::sun::star::awt::Size( aTmp.getWidth(), aTmp.getHeight() );
- break;
- }
- case MID_WIDTH:
- rVal <<= aTmp.getWidth(); break;
- case MID_HEIGHT:
- rVal <<= aTmp.getHeight(); break;
- default: DBG_ERROR("Wrong MemberId!"); return FALSE;
- }
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-BOOL SfxSizeItem::PutValue( const com::sun::star::uno::Any& rVal,
- BYTE nMemberId )
-{
- sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- nMemberId &= ~CONVERT_TWIPS;
-
- BOOL bRet = FALSE;
- com::sun::star::awt::Size aValue;
- sal_Int32 nVal = 0;
- if ( !nMemberId )
- bRet = ( rVal >>= aValue );
- else
- {
- bRet = ( rVal >>= nVal );
- if ( nMemberId == MID_WIDTH )
- {
- aValue.Width = nVal;
- aValue.Height = aVal.Height();
- }
- else
- {
- aValue.Height = nVal;
- aValue.Width = aVal.Width();
- }
- }
-
- if ( bRet )
- {
- Size aTmp( aValue.Width, aValue.Height );
- if( bConvert )
- {
- aTmp.Height() = ( aTmp.Height() * 72 + 63) / 127;
- aTmp.Width() = ( aTmp.Width() * 72 + 63) / 127;
- }
-
- aVal = aTmp;
- }
-
- return bRet;
-}
-
-
-
diff --git a/svtools/source/items1/bintitem.cxx b/svtools/source/items1/bintitem.cxx
deleted file mode 100644
index a3b6c1c2b54d..000000000000
--- a/svtools/source/items1/bintitem.cxx
+++ /dev/null
@@ -1,169 +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: bintitem.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_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <tools/stream.hxx>
-#include <tools/bigint.hxx>
-#include <svtools/bintitem.hxx>
-
-// STATIC DATA
-
-DBG_NAME(SfxBigIntItem)
-
-// RTTI
-TYPEINIT1_AUTOFACTORY(SfxBigIntItem, SfxPoolItem);
-
-// SfxBigIntItem
-
-//============================================================================
-SfxBigIntItem::SfxBigIntItem()
- : SfxPoolItem(0),
- aVal(0)
-{
- DBG_CTOR(SfxBigIntItem, 0);
-}
-
-//============================================================================
-SfxBigIntItem::SfxBigIntItem(USHORT which, const BigInt& rValue)
- : SfxPoolItem(which),
- aVal(rValue)
-{
- DBG_CTOR(SfxBigIntItem, 0);
-}
-
-//============================================================================
-SfxBigIntItem::SfxBigIntItem(USHORT which, SvStream &rStream)
- : SfxPoolItem(which)
-{
- DBG_CTOR(SfxBigIntItem, 0);
- ByteString sTmp;
- rStream.ReadByteString(sTmp);
- BigInt aTmp(sTmp);
- aVal = aTmp;
-}
-
-//============================================================================
-SfxBigIntItem::SfxBigIntItem(const SfxBigIntItem& rItem)
- : SfxPoolItem(rItem),
- aVal(rItem.aVal)
-{
- DBG_CTOR(SfxBigIntItem, 0);
-}
-
-//============================================================================
-SfxItemPresentation SfxBigIntItem::GetPresentation(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper * ) const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- rText = aVal.GetString();
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-int SfxBigIntItem::operator==(const SfxPoolItem& rItem) const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type");
- return ((SfxBigIntItem&)rItem).aVal == aVal;
-}
-
-//============================================================================
-int SfxBigIntItem::Compare(const SfxPoolItem& rItem) const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- DBG_ASSERT(SfxPoolItem::operator==(rItem), "unequal type");
-
- if (((const SfxBigIntItem&)rItem ).aVal < aVal )
- return -1;
- else if (((const SfxBigIntItem&)rItem ).aVal == aVal)
- return 0;
- else
- return 1;
-}
-
-//============================================================================
-SfxPoolItem* SfxBigIntItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- return new SfxBigIntItem(*this);
-}
-
-//============================================================================
-SfxPoolItem* SfxBigIntItem::Create(SvStream &rStream, USHORT) const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- return new SfxBigIntItem(Which(), rStream);
-}
-
-//============================================================================
-SvStream& SfxBigIntItem::Store(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- rStream.WriteByteString( aVal.GetByteString() );
- return rStream;
-}
-
-//============================================================================
-SfxFieldUnit SfxBigIntItem::GetUnit() const
-{
- DBG_CHKTHIS(SfxBigIntItem, 0);
- return SFX_FUNIT_NONE;
-}
-
-//============================================================================
-// virtual
-BOOL SfxBigIntItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
-{
- double aValue = 0.0;
- if ( rVal >>= aValue )
- {
- SetValue( aValue );
- return TRUE;
- }
-
- DBG_ERROR( "SfxBigIntItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-BOOL SfxBigIntItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
-{
- double aValue = GetValue();
- rVal <<= aValue;
- return TRUE;
-}
-
diff --git a/svtools/source/items1/cenumitm.cxx b/svtools/source/items1/cenumitm.cxx
deleted file mode 100644
index 1906e62a8cf8..000000000000
--- a/svtools/source/items1/cenumitm.cxx
+++ /dev/null
@@ -1,297 +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: cenumitm.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <tools/stream.hxx>
-#include <svtools/cenumitm.hxx>
-#include <whassert.hxx>
-
-#ifndef _CPPUHELPER_EXTRACT_HXX_
-#include <cppuhelper/extract.hxx>
-#endif
-
-//============================================================================
-//
-// class SfxEnumItemInterface
-//
-//============================================================================
-
-DBG_NAME(SfxEnumItemInterface)
-
-//============================================================================
-TYPEINIT1(SfxEnumItemInterface, SfxPoolItem)
-
-//============================================================================
-// virtual
-int SfxEnumItemInterface::operator ==(const SfxPoolItem & rItem) const
-{
- SFX_ASSERT(SfxPoolItem::operator ==(rItem), Which(), "unequal type");
- return GetEnumValue()
- == static_cast< const SfxEnumItemInterface * >(&rItem)->
- GetEnumValue();
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation
-SfxEnumItemInterface::GetPresentation(SfxItemPresentation, SfxMapUnit,
- SfxMapUnit, XubString & rText,
- const IntlWrapper *) const
-{
- rText = XubString::CreateFromInt32(GetEnumValue());
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL SfxEnumItemInterface::QueryValue(com::sun::star::uno::Any& rVal, BYTE)
- const
-{
- rVal <<= sal_Int32(GetEnumValue());
- return true;
-}
-
-//============================================================================
-// virtual
-BOOL SfxEnumItemInterface::PutValue(const com::sun::star::uno::Any& rVal,
- BYTE)
-{
- sal_Int32 nTheValue = 0;
-
- if ( ::cppu::enum2int( nTheValue, rVal ) )
- {
- SetEnumValue(USHORT(nTheValue));
- return true;
- }
- DBG_ERROR("SfxEnumItemInterface::PutValue(): Wrong type");
- return false;
-}
-
-//============================================================================
-XubString SfxEnumItemInterface::GetValueTextByPos(USHORT) const
-{
- DBG_WARNING("SfxEnumItemInterface::GetValueTextByPos(): Pure virtual");
- return XubString();
-}
-
-//============================================================================
-// virtual
-USHORT SfxEnumItemInterface::GetValueByPos(USHORT nPos) const
-{
- return nPos;
-}
-
-//============================================================================
-// virtual
-USHORT SfxEnumItemInterface::GetPosByValue(USHORT nValue) const
-{
- USHORT nCount = GetValueCount();
- for (USHORT i = 0; i < nCount; ++i)
- if (GetValueByPos(i) == nValue)
- return i;
- return USHRT_MAX;
-}
-
-BOOL SfxEnumItemInterface::IsEnabled(USHORT) const
-{
- return TRUE;
-}
-
-//============================================================================
-// virtual
-int SfxEnumItemInterface::HasBoolValue() const
-{
- return false;
-}
-
-//============================================================================
-// virtual
-BOOL SfxEnumItemInterface::GetBoolValue() const
-{
- return false;
-}
-
-//============================================================================
-// virtual
-void SfxEnumItemInterface::SetBoolValue(BOOL)
-{}
-
-//============================================================================
-//
-// class CntEnumItem
-//
-//============================================================================
-
-DBG_NAME(CntEnumItem)
-
-//============================================================================
-CntEnumItem::CntEnumItem(USHORT which, SvStream & rStream):
- SfxEnumItemInterface(which)
-{
- m_nValue = 0;
- rStream >> m_nValue;
-}
-
-//============================================================================
-TYPEINIT1(CntEnumItem, SfxEnumItemInterface)
-
-//============================================================================
-// virtual
-SvStream & CntEnumItem::Store(SvStream & rStream, USHORT) const
-{
- rStream << m_nValue;
- return rStream;
-}
-
-//============================================================================
-// virtual
-USHORT CntEnumItem::GetEnumValue() const
-{
- return GetValue();
-}
-
-//============================================================================
-// virtual
-void CntEnumItem::SetEnumValue(USHORT nTheValue)
-{
- SetValue(nTheValue);
-}
-
-//============================================================================
-//
-// class CntBoolItem
-//
-//============================================================================
-
-DBG_NAME(CntBoolItem)
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(CntBoolItem, SfxPoolItem)
-
-//============================================================================
-CntBoolItem::CntBoolItem(USHORT which, SvStream & rStream):
- SfxPoolItem(which)
-{
- m_bValue = false;
- rStream >> m_bValue;
-}
-
-//============================================================================
-// virtual
-int CntBoolItem::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_ASSERT(rItem.ISA(CntBoolItem),
- "CntBoolItem::operator ==(): Bad type");
- return m_bValue == static_cast< CntBoolItem const * >(&rItem)->m_bValue;
-}
-
-//============================================================================
-// virtual
-int CntBoolItem::Compare(const SfxPoolItem & rWith) const
-{
- DBG_ASSERT(rWith.ISA(CntBoolItem), "CntBoolItem::Compare(): Bad type");
- return m_bValue == static_cast< CntBoolItem const * >(&rWith)->m_bValue ?
- 0 : m_bValue ? -1 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation CntBoolItem::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- UniString & rText,
- const IntlWrapper *) const
-{
- rText = GetValueTextByVal(m_bValue);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL CntBoolItem::QueryValue(com::sun::star::uno::Any& rVal, BYTE) const
-{
- rVal <<= sal_Bool(m_bValue);
- return true;
-}
-
-//============================================================================
-// virtual
-BOOL CntBoolItem::PutValue(const com::sun::star::uno::Any& rVal, BYTE)
-{
- sal_Bool bTheValue = sal_Bool();
- if (rVal >>= bTheValue)
- {
- m_bValue = bTheValue;
- return true;
- }
- DBG_ERROR("CntBoolItem::PutValue(): Wrong type");
- return false;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntBoolItem::Create(SvStream & rStream, USHORT) const
-{
- return new CntBoolItem(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & CntBoolItem::Store(SvStream & rStream, USHORT) const
-{
- rStream << m_bValue;
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntBoolItem::Clone(SfxItemPool *) const
-{
- return new CntBoolItem(*this);
-}
-
-//============================================================================
-// virtual
-USHORT CntBoolItem::GetValueCount() const
-{
- return 2;
-}
-
-//============================================================================
-// virtual
-UniString CntBoolItem::GetValueTextByVal(BOOL bTheValue) const
-{
- return
- bTheValue ?
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) :
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE"));
-}
-
diff --git a/svtools/source/items1/cintitem.cxx b/svtools/source/items1/cintitem.cxx
deleted file mode 100644
index 97cce9b75591..000000000000
--- a/svtools/source/items1/cintitem.cxx
+++ /dev/null
@@ -1,565 +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: cintitem.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <tools/stream.hxx>
-#include <svtools/cintitem.hxx>
-
-//============================================================================
-//
-// class CntByteItem
-//
-//============================================================================
-
-DBG_NAME(CntByteItem)
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(CntByteItem, SfxPoolItem);
-
-//============================================================================
-CntByteItem::CntByteItem(USHORT which, SvStream & rStream):
- SfxPoolItem(which)
-{
- DBG_CTOR(CntByteItem, 0);
- rStream >> m_nValue;
-}
-
-//============================================================================
-// virtual
-int CntByteItem::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- DBG_ASSERT(rItem.ISA(CntByteItem),
- "CntByteItem::operator ==(): Bad type");
- return m_nValue == SAL_STATIC_CAST(const CntByteItem *, &rItem)->m_nValue;
-}
-
-//============================================================================
-// virtual
-int CntByteItem::Compare(const SfxPoolItem & rWith) const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- DBG_ASSERT(rWith.ISA(CntByteItem), "CntByteItem::Compare(): Bad type");
- return SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue < m_nValue ?
- -1 :
- SAL_STATIC_CAST(const CntByteItem *, &rWith)->m_nValue
- == m_nValue ?
- 0 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation CntByteItem::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- XubString & rText,
- const IntlWrapper *) const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- rText = XubString::CreateFromInt32(m_nValue);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL CntByteItem::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const
-{
- sal_Int8 nValue = m_nValue;
- rVal <<= nValue;
- return TRUE;
-}
-
-//============================================================================
-// virtual
-BOOL CntByteItem::PutValue(const com::sun::star::uno::Any& rVal,BYTE)
-{
- sal_Int8 nValue = sal_Int8();
- if (rVal >>= nValue)
- {
- m_nValue = nValue;
- return TRUE;
- }
-
- DBG_ERROR( "CntByteItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntByteItem::Create(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- short nTheValue = 0;
- rStream >> nTheValue;
- return new CntByteItem(Which(), BYTE(nTheValue));
-}
-
-//============================================================================
-// virtual
-SvStream & CntByteItem::Store(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- rStream << short(m_nValue);
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntByteItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- return new CntByteItem(*this);
-}
-
-//============================================================================
-// virtual
-BYTE CntByteItem::GetMin() const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- return 0;
-}
-
-//============================================================================
-// virtual
-BYTE CntByteItem::GetMax() const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- return 255;
-}
-
-//============================================================================
-// virtual
-SfxFieldUnit CntByteItem::GetUnit() const
-{
- DBG_CHKTHIS(CntByteItem, 0);
- return SFX_FUNIT_NONE;
-}
-
-//============================================================================
-//
-// class CntUInt16Item
-//
-//============================================================================
-
-DBG_NAME(CntUInt16Item);
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(CntUInt16Item, SfxPoolItem);
-
-//============================================================================
-CntUInt16Item::CntUInt16Item(USHORT which, SvStream & rStream) :
- SfxPoolItem(which)
-{
- DBG_CTOR(CntUInt16Item, 0);
- USHORT nTheValue = 0;
- rStream >> nTheValue;
- m_nValue = nTheValue;
-}
-
-//============================================================================
-// virtual
-int CntUInt16Item::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- DBG_ASSERT(rItem.ISA(CntUInt16Item),
- "CntUInt16Item::operator ==(): Bad type");
- return m_nValue == SAL_STATIC_CAST(const CntUInt16Item *, &rItem)->
- m_nValue;
-}
-
-//============================================================================
-// virtual
-int CntUInt16Item::Compare(const SfxPoolItem & rWith) const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- DBG_ASSERT(rWith.ISA(CntUInt16Item),
- "CntUInt16Item::Compare(): Bad type");
- return SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue
- < m_nValue ?
- -1 :
- SAL_STATIC_CAST(const CntUInt16Item *, &rWith)->m_nValue
- == m_nValue ?
- 0 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation CntUInt16Item::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- XubString & rText,
- const IntlWrapper *)
- const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- rText = XubString::CreateFromInt32(m_nValue);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL CntUInt16Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const
-{
- sal_Int32 nValue = m_nValue;
- rVal <<= nValue;
- return TRUE;
-}
-
-//============================================================================
-// virtual
-BOOL CntUInt16Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE)
-{
- sal_Int32 nValue = 0;
- if (rVal >>= nValue)
- {
- DBG_ASSERT( nValue <= USHRT_MAX, "Overflow in UInt16 value!");
- m_nValue = (sal_uInt16)nValue;
- return TRUE;
- }
-
- DBG_ERROR( "CntUInt16Item::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntUInt16Item::Create(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- return new CntUInt16Item(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & CntUInt16Item::Store(SvStream &rStream, USHORT) const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- rStream << USHORT(m_nValue);
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntUInt16Item::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- return new CntUInt16Item(*this);
-}
-
-//============================================================================
-// virtual
-UINT16 CntUInt16Item::GetMin() const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- return 0;
-}
-
-//============================================================================
-// virtual
-UINT16 CntUInt16Item::GetMax() const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- return 65535;
-}
-
-//============================================================================
-// virtual
-SfxFieldUnit CntUInt16Item::GetUnit() const
-{
- DBG_CHKTHIS(CntUInt16Item, 0);
- return SFX_FUNIT_NONE;
-}
-
-//============================================================================
-//
-// class CntInt32Item
-//
-//============================================================================
-
-DBG_NAME(CntInt32Item);
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(CntInt32Item, SfxPoolItem);
-
-//============================================================================
-CntInt32Item::CntInt32Item(USHORT which, SvStream & rStream) :
- SfxPoolItem(which)
-{
- DBG_CTOR(CntInt32Item, 0);
- long nTheValue = 0;
- rStream >> nTheValue;
- m_nValue = nTheValue;
-}
-
-//============================================================================
-// virtual
-int CntInt32Item::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- DBG_ASSERT(rItem.ISA(CntInt32Item),
- "CntInt32Item::operator ==(): Bad type");
- return m_nValue == SAL_STATIC_CAST(const CntInt32Item *, &rItem)->
- m_nValue;
-}
-
-//============================================================================
-// virtual
-int CntInt32Item::Compare(const SfxPoolItem & rWith) const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- DBG_ASSERT(rWith.ISA(CntInt32Item), "CntInt32Item::Compare(): Bad type");
- return SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue
- < m_nValue ?
- -1 :
- SAL_STATIC_CAST(const CntInt32Item *, &rWith)->m_nValue
- == m_nValue ?
- 0 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation CntInt32Item::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- XubString & rText,
- const IntlWrapper *) const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- rText = XubString::CreateFromInt32(m_nValue);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL CntInt32Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const
-{
- sal_Int32 nValue = m_nValue;
- rVal <<= nValue;
- return TRUE;
-}
-
-//============================================================================
-// virtual
-BOOL CntInt32Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE)
-{
- sal_Int32 nValue = 0;
- if (rVal >>= nValue)
- {
- m_nValue = nValue;
- return TRUE;
- }
-
- DBG_ERROR( "CntInt32Item::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntInt32Item::Create(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- return new CntInt32Item(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & CntInt32Item::Store(SvStream &rStream, USHORT) const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- rStream << long(m_nValue);
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntInt32Item::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- return new CntInt32Item(*this);
-}
-
-//============================================================================
-// virtual
-INT32 CntInt32Item::GetMin() const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- return INT32(0x80000000);
-}
-
-//============================================================================
-// virtual
-INT32 CntInt32Item::GetMax() const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- return 0x7FFFFFFF;
-}
-
-//============================================================================
-// virtual
-SfxFieldUnit CntInt32Item::GetUnit() const
-{
- DBG_CHKTHIS(CntInt32Item, 0);
- return SFX_FUNIT_NONE;
-}
-
-//============================================================================
-//
-// class CntUInt32Item
-//
-//============================================================================
-
-DBG_NAME(CntUInt32Item);
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(CntUInt32Item, SfxPoolItem);
-
-//============================================================================
-CntUInt32Item::CntUInt32Item(USHORT which, SvStream & rStream) :
- SfxPoolItem(which)
-{
- DBG_CTOR(CntUInt32Item, 0);
- sal_uInt32 nTheValue = 0;
- rStream >> nTheValue;
- m_nValue = nTheValue;
-}
-
-//============================================================================
-// virtual
-int CntUInt32Item::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- DBG_ASSERT(rItem.ISA(CntUInt32Item),
- "CntUInt32Item::operator ==(): Bad type");
- return m_nValue == SAL_STATIC_CAST(const CntUInt32Item *, &rItem)->
- m_nValue;
-}
-
-//============================================================================
-// virtual
-int CntUInt32Item::Compare(const SfxPoolItem & rWith) const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- DBG_ASSERT(rWith.ISA(CntUInt32Item),
- "CntUInt32Item::operator ==(): Bad type");
- return SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue
- < m_nValue ?
- -1 :
- SAL_STATIC_CAST(const CntUInt32Item *, &rWith)->m_nValue
- == m_nValue ?
- 0 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation CntUInt32Item::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- XubString & rText,
- const IntlWrapper *)
- const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- rText = XubString::CreateFromInt64(m_nValue);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL CntUInt32Item::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const
-{
- sal_Int32 nValue = m_nValue;
- DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!");
- rVal <<= nValue;
- return TRUE;
-}
-
-//============================================================================
-// virtual
-BOOL CntUInt32Item::PutValue(const com::sun::star::uno::Any& rVal,BYTE)
-{
- sal_Int32 nValue = 0;
- if (rVal >>= nValue)
- {
- DBG_ASSERT( nValue>=0, "Overflow in UInt32 value!");
- m_nValue = nValue;
- return TRUE;
- }
-
- DBG_ERROR( "CntUInt32Item::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntUInt32Item::Create(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- return new CntUInt32Item(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & CntUInt32Item::Store(SvStream &rStream, USHORT) const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- rStream << static_cast<sal_uInt32>(m_nValue);
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntUInt32Item::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- return new CntUInt32Item(*this);
-}
-
-//============================================================================
-// virtual
-UINT32 CntUInt32Item::GetMin() const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- return 0;
-}
-
-//============================================================================
-// virtual
-UINT32 CntUInt32Item::GetMax() const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- return 0xFFFFFFFF;
-}
-
-//============================================================================
-// virtual
-SfxFieldUnit CntUInt32Item::GetUnit() const
-{
- DBG_CHKTHIS(CntUInt32Item, 0);
- return SFX_FUNIT_NONE;
-}
-
diff --git a/svtools/source/items1/cntwall.cxx b/svtools/source/items1/cntwall.cxx
deleted file mode 100644
index 67e9387fbe26..000000000000
--- a/svtools/source/items1/cntwall.cxx
+++ /dev/null
@@ -1,170 +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: cntwall.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_svtools.hxx"
-
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-#include <tools/stream.hxx>
-#include <tools/vcompat.hxx>
-
-#include <svtools/cntwall.hxx>
-
-#define CNTWALLPAPERITEM_STREAM_MAGIC ( (UINT32)0xfefefefe )
-#define CNTWALLPAPERITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) )
-
-TYPEINIT1( CntWallpaperItem, SfxPoolItem );
-
-// -----------------------------------------------------------------------
-CntWallpaperItem::CntWallpaperItem( USHORT which )
- : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 )
-{
-}
-
-// -----------------------------------------------------------------------
-CntWallpaperItem::CntWallpaperItem( USHORT which, SvStream& rStream, USHORT nVersion )
- : SfxPoolItem( which ), _nColor( COL_TRANSPARENT ), _nStyle( 0 )
-{
- UINT32 nMagic = 0;
- rStream >> nMagic;
- if ( nMagic == CNTWALLPAPERITEM_STREAM_MAGIC )
- {
- // Okay, data were stored by CntWallpaperItem.
-
- readUnicodeString(rStream, _aURL, nVersion >= 1);
- // !!! Color stream operators do not work - they discard any
- // transparency info !!!
- _nColor.Read( rStream, TRUE );
- rStream >> _nStyle;
- }
- else
- {
- rStream.SeekRel( CNTWALLPAPERITEM_STREAM_SEEKREL );
-
- // Data were stored by SfxWallpaperItem ( SO < 6.0 ). The only
- // thing we can do here is to get the URL and to position the stream.
-
- {
- // "Read" Wallpaper member - The version compat object positions
- // the stream after the wallpaper data in its dtor. We must use
- // this trick here as no VCL must be used here ( No Wallpaper
- // object allowed ).
- VersionCompat aCompat( rStream, STREAM_READ );
- }
-
- // Read SfxWallpaperItem's string member _aURL.
- readUnicodeString(rStream, _aURL, false);
-
- // "Read" SfxWallpaperItem's string member _aFilter.
- ByteString aDummy;
- rStream.ReadByteString(aDummy);
- }
-}
-
-// -----------------------------------------------------------------------
-CntWallpaperItem::CntWallpaperItem( const CntWallpaperItem& rItem ) :
- SfxPoolItem( rItem ),
- _aURL( rItem._aURL ),
- _nColor( rItem._nColor ),
- _nStyle( rItem._nStyle )
-{
-}
-
-// -----------------------------------------------------------------------
-CntWallpaperItem::~CntWallpaperItem()
-{
-}
-
-// -----------------------------------------------------------------------
-int CntWallpaperItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- const CntWallpaperItem& rWallItem = (const CntWallpaperItem&)rItem;
-
- if( ( rWallItem._nStyle == _nStyle ) &&
- ( rWallItem._nColor == _nColor ) &&
- ( rWallItem._aURL == _aURL ) )
- return TRUE;
- else
- return FALSE;
-}
-
-//============================================================================
-// virtual
-USHORT CntWallpaperItem::GetVersion(USHORT) const
-{
- return 1; // because it uses SfxPoolItem::read/writeUnicodeString()
-}
-
-// -----------------------------------------------------------------------
-SfxPoolItem* CntWallpaperItem::Create( SvStream& rStream, USHORT nVersion) const
-{
- return new CntWallpaperItem( Which(), rStream, nVersion );
-}
-
-// -----------------------------------------------------------------------
-SvStream& CntWallpaperItem::Store( SvStream& rStream, USHORT ) const
-{
- rStream << CNTWALLPAPERITEM_STREAM_MAGIC;
- writeUnicodeString(rStream, _aURL);
- // !!! Color stream operators do not work - they discard any
- // transparency info !!!
- // ??? Why the hell Color::Write(...) isn't const ???
- SAL_CONST_CAST( CntWallpaperItem*, this )->_nColor.Write( rStream, TRUE );
- rStream << _nStyle;
-
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-SfxPoolItem* CntWallpaperItem::Clone( SfxItemPool* ) const
-{
- return new CntWallpaperItem( *this );
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL CntWallpaperItem::QueryValue( com::sun::star::uno::Any&,BYTE ) const
-{
- DBG_ERROR("Not implemented!");
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL CntWallpaperItem::PutValue( const com::sun::star::uno::Any&,BYTE )
-{
- DBG_ERROR("Not implemented!");
- return FALSE;
-}
-
-
diff --git a/svtools/source/items1/cstitem.cxx b/svtools/source/items1/cstitem.cxx
deleted file mode 100644
index 9755f4bb9944..000000000000
--- a/svtools/source/items1/cstitem.cxx
+++ /dev/null
@@ -1,252 +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: cstitem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-
-#include <unotools/intlwrapper.hxx>
-
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <tools/datetime.hxx>
-
-#include <svtools/svtdata.hxx>
-#include <svtools/cstitem.hxx>
-
-#include <svtools/svtools.hrc>
-#include <com/sun/star/lang/Locale.hpp>
-
-DBG_NAME( SfxCrawlStatusItem )
-TYPEINIT1( SfxCrawlStatusItem, SfxPoolItem );
-
-// -----------------------------------------------------------------------
-
-SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which ) :
- SfxPoolItem( which )
-{
- DBG_CTOR( SfxCrawlStatusItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxCrawlStatusItem::SfxCrawlStatusItem( USHORT which, CrawlStatus eStat ) :
- SfxPoolItem( which ),
- eStatus( eStat )
-{
- DBG_CTOR( SfxCrawlStatusItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxCrawlStatusItem::SfxCrawlStatusItem( const SfxCrawlStatusItem& rItem ) :
- SfxPoolItem( rItem ),
- eStatus( rItem.eStatus )
-{
- DBG_CTOR( SfxCrawlStatusItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-int SfxCrawlStatusItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS( SfxCrawlStatusItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- return ((SfxCrawlStatusItem&)rItem).eStatus == eStatus;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxCrawlStatusItem::Compare( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS( SfxCrawlStatusItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- if( ((const SfxCrawlStatusItem&)rItem).eStatus < eStatus )
- return -1;
- else if( ((const SfxCrawlStatusItem&)rItem).eStatus == eStatus )
- return 0;
- else
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxCrawlStatusItem::Create( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxCrawlStatusItem, 0);
-
- USHORT _eStatus;
- rStream >> _eStatus;
-
- return new SfxCrawlStatusItem( Which(), (CrawlStatus)_eStatus );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxCrawlStatusItem::Store( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS( SfxCrawlStatusItem, 0 );
-
- USHORT nStatus = (USHORT)eStatus;
- rStream << (USHORT) nStatus;
-
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxCrawlStatusItem::Clone( SfxItemPool* ) const
-{
- DBG_CHKTHIS( SfxCrawlStatusItem, 0 );
- return new SfxCrawlStatusItem( *this );
-}
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxCrawlStatusItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper * pIntlWrapper
-) const
-{
- DBG_CHKTHIS(SfxCrawlStatusItem, 0);
- DBG_ASSERT(pIntlWrapper,
- "SfxCrawlStatusItem::GetPresentation():"
- " Using default IntlWrapper");
-
- ::com::sun::star::lang::Locale aLocale;
-
- switch (eStatus)
- {
- case CSTAT_NEVER_UPD:
- rText = String(SvtResId(STR_CSTAT_NEVER_UPD,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_IN_UPD:
- rText = String(SvtResId(STR_CSTAT_IN_UPD,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_UPD_NEWER:
- rText = String(SvtResId(STR_CSTAT_UPD_NEWER,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_UPD_NOT_NEWER:
- rText = String(SvtResId(STR_CSTAT_UPD_NOT_NEWER,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_UPD_CANCEL:
- rText = String(SvtResId(STR_CSTAT_UPD_CANCEL,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_ERR_GENERAL:
- rText = String(SvtResId(STR_CSTAT_ERR_GENERAL,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_ERR_NOTEXISTS:
- rText = String(SvtResId(STR_CSTAT_ERR_NOTEXISTS,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_ERR_NOTREACHED:
- rText = String(SvtResId(STR_CSTAT_ERR_NOTREACHED,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_UPD_IMMEDIATELY:
- rText = String(SvtResId(STR_CSTAT_UPD_IMMEDIATELY,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- case CSTAT_ERR_OFFLINE:
- rText = String(SvtResId(STR_CSTAT_ERR_OFFLINE,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- break;
-
- default:
- rText.Erase();
- break;
- }
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxCrawlStatusItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE )
-{
- sal_Int16 aValue = sal_Int16();
- if ( rVal >>= aValue )
- {
- SetStatus( static_cast< CrawlStatus >( aValue ) );
- return TRUE;
- }
-
- DBG_ERROR( "SfxCrawlStatusItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxCrawlStatusItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const
-{
- sal_Int16 aValue = sal::static_int_cast< sal_Int16 >(GetStatus());
- rVal <<= aValue;
- return TRUE;
-}
-
diff --git a/svtools/source/items1/cstitem.src b/svtools/source/items1/cstitem.src
deleted file mode 100644
index 8d6e2d0280c0..000000000000
--- a/svtools/source/items1/cstitem.src
+++ /dev/null
@@ -1,112 +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: cstitem.src,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.
- *
- ************************************************************************/
-
-#include <svtools/svtools.hrc>
-String STR_CSTAT_NEVER_UPD
-{
- Text [ en-US ] = "No update has occurred" ;
-};
-String STR_CSTAT_IN_UPD
-{
- Text [ en-US ] = "Updating in progress" ;
-};
-String STR_CSTAT_UPD_NEWER
-{
- Text [ en-US ] = "Changes discovered" ;
-};
-String STR_CSTAT_UPD_NOT_NEWER
-{
- Text [ en-US ] = "No changes discovered" ;
-};
-String STR_CSTAT_UPD_CANCEL
-{
- Text [ en-US ] = "Canceled by user" ;
-};
-String STR_CSTAT_UPD_IMMEDIATELY
-{
- Text [ en-US ] = "Updating immediately" ;
-};
-String STR_CSTAT_ERR_OFFLINE
-{
- Text [ en-US ] = "failed, you have not been online" ;
-};
-String STR_CSTAT_ERR_GENERAL
-{
- Text [ en-US ] = "General error" ;
-};
-String STR_CSTAT_ERR_NOTEXISTS
-{
- Text [ en-US ] = "Server does not exist" ;
-};
-String STR_CSTAT_ERR_NOTREACHED
-{
- Text [ en-US ] = "Server not available" ;
-};
-String STR_COLUM_DT_AUTO
-{
- Text [ en-US ] = "automatic" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/svtools/source/items1/ctypeitm.cxx b/svtools/source/items1/ctypeitm.cxx
deleted file mode 100644
index 552d4a6a9041..000000000000
--- a/svtools/source/items1/ctypeitm.cxx
+++ /dev/null
@@ -1,254 +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: ctypeitm.cxx,v $
- * $Revision: 1.7.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-
-#include <unotools/intlwrapper.hxx>
-#include <tools/stream.hxx>
-#include <svtools/ctypeitm.hxx>
-
-//============================================================================
-// The following defines are copied from chaos/source/items/cstritem.cxx:
-#define CNTSTRINGITEM_STREAM_MAGIC ( (UINT32)0xfefefefe )
-#define CNTSTRINGITEM_STREAM_SEEKREL (-( (long)( sizeof( UINT32 ) ) ) )
-
-//============================================================================
-//
-// class CntContentTypeItem Implementation.
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY( CntContentTypeItem, CntUnencodedStringItem );
-
-#define CONTENT_TYPE_NOT_INIT ( (INetContentType)-1 )
-
-//----------------------------------------------------------------------------
-CntContentTypeItem::CntContentTypeItem()
-: CntUnencodedStringItem(),
- _eType( CONTENT_TYPE_NOT_INIT )
-{
-}
-
-//----------------------------------------------------------------------------
-CntContentTypeItem::CntContentTypeItem( USHORT which, const XubString& rType )
-: CntUnencodedStringItem( which, rType ),
- _eType( CONTENT_TYPE_NOT_INIT )
-{
-}
-
-//----------------------------------------------------------------------------
-CntContentTypeItem::CntContentTypeItem( USHORT which,
- const INetContentType eType )
-: CntUnencodedStringItem( which, INetContentTypes::GetContentType( eType ) ),
- _eType( eType )
-{
-}
-
-//----------------------------------------------------------------------------
-CntContentTypeItem::CntContentTypeItem( const CntContentTypeItem& rOrig )
-: CntUnencodedStringItem( rOrig ),
- _eType( rOrig._eType ),
- _aPresentation( rOrig._aPresentation )
-{
-}
-
-//============================================================================
-// virtual
-USHORT CntContentTypeItem::GetVersion(USHORT) const
-{
- return 1; // because it uses SfxPoolItem::read/writeUnicodeString()
-}
-
-//----------------------------------------------------------------------------
-// virtual
-SfxPoolItem* CntContentTypeItem::Create( SvStream& rStream,
- USHORT nItemVersion ) const
-{
- // CntContentTypeItem used to be derived from CntStringItem, so take that
- // into account:
- UniString aValue;
- readUnicodeString(rStream, aValue, nItemVersion >= 1);
- UINT32 nMagic = 0;
- rStream >> nMagic;
- if (nMagic == CNTSTRINGITEM_STREAM_MAGIC)
- {
- BOOL bEncrypted = FALSE;
- rStream >> bEncrypted;
- DBG_ASSERT(!bEncrypted,
- "CntContentTypeItem::Create() reads encrypted data");
- }
- else
- rStream.SeekRel(CNTSTRINGITEM_STREAM_SEEKREL);
-
- return new CntContentTypeItem(Which(), aValue);
-}
-
-//----------------------------------------------------------------------------
-// virtual
-SvStream & CntContentTypeItem::Store(SvStream & rStream, USHORT) const
-{
- // CntContentTypeItem used to be derived from CntStringItem, so take that
- // into account:
- writeUnicodeString(rStream, GetValue());
- rStream << CNTSTRINGITEM_STREAM_MAGIC << BOOL(FALSE);
- return rStream;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-int CntContentTypeItem::operator==( const SfxPoolItem& rOrig ) const
-{
- const CntContentTypeItem& rOther = (const CntContentTypeItem&)rOrig;
-
- if ( ( _eType != CONTENT_TYPE_NOT_INIT ) &&
- ( rOther._eType != CONTENT_TYPE_NOT_INIT ) )
- return _eType == rOther._eType;
- else
- return CntUnencodedStringItem::operator==( rOther );
-}
-
-//----------------------------------------------------------------------------
-// virtual
-SfxPoolItem* CntContentTypeItem::Clone( SfxItemPool* /* pPool */ ) const
-{
- return new CntContentTypeItem( *this );
-}
-
-//----------------------------------------------------------------------------
-void CntContentTypeItem::SetValue( const XubString& rNewVal )
-{
- // De-initialize enum type and presentation.
- _eType = CONTENT_TYPE_NOT_INIT;
- _aPresentation.Erase();
-
- CntUnencodedStringItem::SetValue( rNewVal );
-}
-
-//----------------------------------------------------------------------------
-void CntContentTypeItem::SetPresentation( const XubString& rNewVal )
-{
- _aPresentation = rNewVal;
-}
-
-//----------------------------------------------------------------------------
-int CntContentTypeItem::Compare( const SfxPoolItem &rWith, const IntlWrapper& rIntlWrapper ) const
-{
- String aOwnText, aWithText;
- GetPresentation( SFX_ITEM_PRESENTATION_NAMELESS,
- SFX_MAPUNIT_APPFONT, SFX_MAPUNIT_APPFONT, aOwnText, &rIntlWrapper );
- rWith.GetPresentation( SFX_ITEM_PRESENTATION_NAMELESS,
- SFX_MAPUNIT_APPFONT, SFX_MAPUNIT_APPFONT, aWithText, &rIntlWrapper );
- return rIntlWrapper.getCollator()->compareString( aOwnText, aWithText );
-}
-
-//----------------------------------------------------------------------------
-SfxItemPresentation CntContentTypeItem::GetPresentation(
- SfxItemPresentation ePres,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresMetric,
- XubString & rText,
- const IntlWrapper * pIntlWrapper) const
-{
- if (_aPresentation.Len() == 0)
- {
- DBG_ASSERT(pIntlWrapper,
- "CntContentTypeItem::GetPresentation(): No IntlWrapper");
- if (pIntlWrapper)
- SAL_CONST_CAST(CntContentTypeItem *, this)->_aPresentation
- = INetContentTypes::GetPresentation(GetEnumValue(),
- pIntlWrapper->
- getLocale());
- }
- if (_aPresentation.Len() > 0)
- {
- rText = _aPresentation;
- return SFX_ITEM_PRESENTATION_COMPLETE;
- }
- else
- return CntUnencodedStringItem::GetPresentation(ePres, eCoreMetric,
- ePresMetric, rText,
- pIntlWrapper);
-}
-
-//----------------------------------------------------------------------------
-INetContentType CntContentTypeItem::GetEnumValue() const
-{
- if ( _eType == CONTENT_TYPE_NOT_INIT )
- {
- // Not yet initialized... Get enum value for string content type.
-
- CntContentTypeItem* pVarThis = SAL_CONST_CAST( CntContentTypeItem*, this );
-
- pVarThis->_eType = INetContentTypes::GetContentType( GetValue() );
- }
-
- return _eType;
-}
-
-//----------------------------------------------------------------------------
-void CntContentTypeItem::SetValue( const INetContentType eType )
-{
- SetValue( INetContentTypes::GetContentType( eType ) );
-
- // Note: SetValue( const String& ....) resets _eType. Set new enum value
- // after(!) calling it.
- _eType = eType;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL CntContentTypeItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const
-{
- rVal <<= rtl::OUString(GetValue());
- return true;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL CntContentTypeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE )
-{
- rtl::OUString aValue;
- if ( rVal >>= aValue )
- {
- // SetValue with an empty string resets the item; so call that
- // function when PutValue is called with an empty string
- if (aValue.getLength() == 0)
- SetValue(aValue);
- else
- SetValue(
- INetContentTypes::RegisterContentType(aValue, UniString()));
- return true;
- }
-
- DBG_ERROR( "CntContentTypeItem::PutValue - Wrong type!" );
- return false;
-}
diff --git a/svtools/source/items1/custritm.cxx b/svtools/source/items1/custritm.cxx
deleted file mode 100644
index 9f573beb56fd..000000000000
--- a/svtools/source/items1/custritm.cxx
+++ /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: custritm.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-
-#include <unotools/intlwrapper.hxx>
-#include <tools/stream.hxx>
-#include <svtools/custritm.hxx>
-
-//============================================================================
-//
-// class CntUnencodedStringItem
-//
-//============================================================================
-
-DBG_NAME(CntUnencodedStringItem)
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(CntUnencodedStringItem, SfxPoolItem)
-
-//============================================================================
-// virtual
-int CntUnencodedStringItem::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(CntUnencodedStringItem, 0);
- DBG_ASSERT(rItem.ISA(CntUnencodedStringItem),
- "CntUnencodedStringItem::operator ==(): Bad type");
- return m_aValue
- == SAL_STATIC_CAST(const CntUnencodedStringItem *, &rItem)->
- m_aValue;
-}
-
-//============================================================================
-// virtual
-int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith) const
-{
- DBG_ERROR("CntUnencodedStringItem::Compare(): No international");
- DBG_CHKTHIS(CntUnencodedStringItem, 0);
- DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
- "CntUnencodedStringItem::Compare(): Bad type");
- switch (m_aValue.CompareTo(static_cast< CntUnencodedStringItem const * >(
- &rWith)->
- m_aValue))
- {
- case COMPARE_LESS:
- return -1;
-
- case COMPARE_EQUAL:
- return 0;
-
- default: // COMPARE_GREATER
- return 1;
- }
-}
-
-//============================================================================
-// virtual
-int CntUnencodedStringItem::Compare(SfxPoolItem const & rWith,
- IntlWrapper const & rIntlWrapper)
- const
-{
- DBG_CHKTHIS(CntUnencodedStringItem, 0);
- DBG_ASSERT(rWith.ISA(CntUnencodedStringItem),
- "CntUnencodedStringItem::Compare(): Bad type");
- return rIntlWrapper.getCollator()->compareString( m_aValue,
- static_cast< CntUnencodedStringItem const * >(&rWith)->m_aValue );
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation
-CntUnencodedStringItem::GetPresentation(SfxItemPresentation, SfxMapUnit,
- SfxMapUnit, XubString & rText,
- const IntlWrapper *) const
-{
- DBG_CHKTHIS(CntUnencodedStringItem, 0);
- rText = m_aValue;
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//============================================================================
-// virtual
-BOOL CntUnencodedStringItem::QueryValue(com::sun::star::uno::Any& rVal, BYTE)
- const
-{
- rVal <<= rtl::OUString(m_aValue);
- return true;
-}
-
-//============================================================================
-// virtual
-BOOL CntUnencodedStringItem::PutValue(const com::sun::star::uno::Any& rVal,
- BYTE)
-{
- rtl::OUString aTheValue;
- if (rVal >>= aTheValue)
- {
- m_aValue = UniString(aTheValue);
- return true;
- }
- DBG_ERROR("CntUnencodedStringItem::PutValue(): Wrong type");
- return false;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntUnencodedStringItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(CntUnencodedStringItem, 0);
- return new CntUnencodedStringItem(*this);
-}
-
diff --git a/svtools/source/items1/dateitem.cxx b/svtools/source/items1/dateitem.cxx
deleted file mode 100644
index 4ba6e1d460f9..000000000000
--- a/svtools/source/items1/dateitem.cxx
+++ /dev/null
@@ -1,284 +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: dateitem.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_svtools.hxx"
-
-// include ---------------------------------------------------------------
-
-#define _DATETIMEITEM_CXX
-#include <svtools/dateitem.hxx>
-
-#include <unotools/intlwrapper.hxx>
-#include <comphelper/processfactory.hxx>
-
-
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <tools/datetime.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/util/DateTime.hpp>
-#include <com/sun/star/lang/Locale.hpp>
-
-
-#include <vcl/svapp.hxx>
-
-#include <svtools/svtdata.hxx>
-#include <svtools/svtools.hrc>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxDateTimeItem)
-
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1(SfxDateTimeItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxDateTimeItem::SfxDateTimeItem( USHORT which ) :
- SfxPoolItem( which )
-{
- DBG_CTOR(SfxDateTimeItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxDateTimeItem::SfxDateTimeItem( USHORT which, const DateTime& rDT ) :
- SfxPoolItem( which ),
- aDateTime( rDT )
-
-{
- DBG_CTOR(SfxDateTimeItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-SfxDateTimeItem::SfxDateTimeItem( const SfxDateTimeItem& rItem ) :
- SfxPoolItem( rItem ),
- aDateTime( rItem.aDateTime )
-{
- DBG_CTOR(SfxDateTimeItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-int SfxDateTimeItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS(SfxDateTimeItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
- return ( ( (SfxDateTimeItem&)rItem ).aDateTime == aDateTime );
-}
-
-// -----------------------------------------------------------------------
-
-int SfxDateTimeItem::Compare( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS(SfxDateTimeItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- // da X.Compare( Y ) am String einem Compare( Y, X ) entspricht,
- // vergleichen wir hier Y mit X
- if ( ( (const SfxDateTimeItem&)rItem ).aDateTime < aDateTime )
- return -1;
- else if ( ( (const SfxDateTimeItem&)rItem ).aDateTime == aDateTime )
- return 0;
- else
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxDateTimeItem::Create( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxDateTimeItem, 0);
- sal_uInt32 nDate = 0;
- sal_Int32 nTime = 0;
- rStream >> nDate;
- rStream >> nTime;
- DateTime aDT(nDate, nTime);
- return new SfxDateTimeItem( Which(), aDT );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxDateTimeItem::Store( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxDateTimeItem, 0);
- rStream << aDateTime.GetDate();
- rStream << aDateTime.GetTime();
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxDateTimeItem::Clone( SfxItemPool* ) const
-{
- DBG_CHKTHIS(SfxDateTimeItem, 0);
- return new SfxDateTimeItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxDateTimeItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper * pIntlWrapper
-) const
-{
- DBG_CHKTHIS(SfxDateTimeItem, 0);
- if (aDateTime.IsValid())
- if (pIntlWrapper)
- {
- rText = pIntlWrapper->getLocaleData()->getDate(aDateTime);
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += pIntlWrapper->getLocaleData()->getTime(aDateTime);
- }
- else
- {
- DBG_WARNING("SfxDateTimeItem::GetPresentation():"
- " Using default en_US IntlWrapper");
- const IntlWrapper aIntlWrapper(
- ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US );
- rText = aIntlWrapper.getLocaleData()->getDate(aDateTime);
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += aIntlWrapper.getLocaleData()->getTime(aDateTime);
- }
- else
- rText.Erase();
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxDateTimeItem::PutValue( const com::sun::star::uno::Any& rVal,
- BYTE nMemberId )
-{
- nMemberId &= ~CONVERT_TWIPS;
- com::sun::star::util::DateTime aValue;
- if ( rVal >>= aValue )
- {
- aDateTime = DateTime( Date( aValue.Day,
- aValue.Month,
- aValue.Year ),
- Time( aValue.Hours,
- aValue.Minutes,
- aValue.Seconds,
- aValue.HundredthSeconds ) );
- return TRUE;
- }
-
- DBG_ERROR( "SfxDateTimeItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxDateTimeItem::QueryValue( com::sun::star::uno::Any& rVal,
- BYTE nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- com::sun::star::util::DateTime aValue( aDateTime.Get100Sec(),
- aDateTime.GetSec(),
- aDateTime.GetMin(),
- aDateTime.GetHour(),
- aDateTime.GetDay(),
- aDateTime.GetMonth(),
- aDateTime.GetYear() );
- rVal <<= aValue;
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-// -----------------------------------------------------------------------
-// -----------------------------------------------------------------------
-
-TYPEINIT1(SfxColumnDateTimeItem, SfxDateTimeItem);
-
-
-SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which ) :
- SfxDateTimeItem( which )
-{}
-
-SfxColumnDateTimeItem::SfxColumnDateTimeItem( USHORT which, const DateTime& rDT ) :
- SfxDateTimeItem( which, rDT )
-{}
-
-SfxColumnDateTimeItem::SfxColumnDateTimeItem( const SfxDateTimeItem& rCpy ) :
- SfxDateTimeItem( rCpy )
-{}
-
-SfxPoolItem* SfxColumnDateTimeItem::Clone( SfxItemPool* ) const
-{
- return new SfxColumnDateTimeItem( *this );
-}
-
-SfxItemPresentation SfxColumnDateTimeItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper * pIntlWrapper
-) const
-{
- DBG_ASSERT(pIntlWrapper,
- "SfxColumnDateTimeItem::GetPresentation():"
- " Using default en_US IntlWrapper");
-
- ::com::sun::star::lang::Locale aLocale;
- if (GetDateTime() == DateTime(Date(1, 2, 3), Time(3, 2, 1)))
- rText = String(SvtResId(STR_COLUM_DT_AUTO,
- pIntlWrapper ?
- pIntlWrapper->getLocale() :
- aLocale));
- else if (pIntlWrapper)
- {
- rText = pIntlWrapper->getLocaleData()->getDate(GetDateTime());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += pIntlWrapper->getLocaleData()->getTime(GetDateTime());
- }
- else
- {
- const IntlWrapper aIntlWrapper(
- ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US );
- rText = aIntlWrapper.getLocaleData()->getDate(GetDateTime());
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += aIntlWrapper.getLocaleData()->getTime(GetDateTime());
- }
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-
-
diff --git a/svtools/source/items1/dtritem.cxx b/svtools/source/items1/dtritem.cxx
deleted file mode 100644
index fa3a36b762f5..000000000000
--- a/svtools/source/items1/dtritem.cxx
+++ /dev/null
@@ -1,244 +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: dtritem.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_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/util/DateTimeRange.hpp>
-
-#include <unotools/intlwrapper.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <tools/datetime.hxx>
-#include <rtl/math.hxx>
-
-#include <vcl/svapp.hxx>
-
-#include <svtools/dtritem.hxx>
-
-
-DBG_NAME( SfxDateTimeRangeItem )
-TYPEINIT1( SfxDateTimeRangeItem, SfxPoolItem );
-
-// -----------------------------------------------------------------------
-
-SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which ) :
- SfxPoolItem( which )
-{
- DBG_CTOR( SfxDateTimeRangeItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxDateTimeRangeItem::SfxDateTimeRangeItem( USHORT which, const DateTime& rStartDT,
- const DateTime& rEndDT ) :
- SfxPoolItem( which ),
- aStartDateTime( rStartDT ),
- aEndDateTime( rEndDT )
-{
- DBG_CTOR( SfxDateTimeRangeItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxDateTimeRangeItem::SfxDateTimeRangeItem( const SfxDateTimeRangeItem& rItem ) :
- SfxPoolItem( rItem ),
- aStartDateTime( rItem.aStartDateTime ),
- aEndDateTime( rItem.aEndDateTime )
-{
- DBG_CTOR( SfxDateTimeRangeItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-int SfxDateTimeRangeItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS( SfxDateTimeRangeItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- return ((SfxDateTimeRangeItem&)rItem ).aStartDateTime == aStartDateTime &&
- ((SfxDateTimeRangeItem&)rItem ).aEndDateTime == aEndDateTime;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxDateTimeRangeItem::Compare( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS( SfxDateTimeRangeItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- double fThisRange = aEndDateTime - aStartDateTime;
- double fRange = ((const SfxDateTimeRangeItem&)rItem).aEndDateTime -
- ((const SfxDateTimeRangeItem&)rItem).aStartDateTime;
-
- if ( ::rtl::math::approxEqual( fRange, fThisRange ) )
- return 0;
- else if ( fRange < fThisRange )
- return -1;
- else
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxDateTimeRangeItem::Create( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxDateTimeRangeItem, 0);
-
- sal_uInt32 nStartDate, nEndDate;
- sal_Int32 nStartTime, nEndTime;
-
- rStream >> nStartDate;
- rStream >> nStartTime;
-
- rStream >> nEndDate;
- rStream >> nEndTime;
-
- DateTime aStartDT, aEndDT;
-
- aStartDT.SetDate( nStartDate );
- aStartDT.SetTime( nStartTime );
-
- aEndDT.SetDate( nEndDate );
- aEndDT.SetTime( nEndTime );
-
- return new SfxDateTimeRangeItem( Which(), aStartDT, aEndDT );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxDateTimeRangeItem::Store( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS( SfxDateTimeRangeItem, 0 );
-
- rStream << aStartDateTime.GetDate();
- rStream << aStartDateTime.GetTime();
-
- rStream << aEndDateTime.GetDate();
- rStream << aEndDateTime.GetTime();
-
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxDateTimeRangeItem::Clone( SfxItemPool* ) const
-{
- DBG_CHKTHIS( SfxDateTimeRangeItem, 0 );
-
- return new SfxDateTimeRangeItem( *this );
-}
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxDateTimeRangeItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper * pIntlWrapper
-) const
-{
- DBG_CHKTHIS(SfxDateTimeRangeItem, 0);
- DateTime aRange(aEndDateTime - (const Time&)aStartDateTime);
- if (pIntlWrapper)
- {
- rText = pIntlWrapper->getLocaleData()->getDate(aRange);
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += pIntlWrapper->getLocaleData()->getTime(aRange);
- }
- else
- {
- DBG_WARNING("SfxDateTimeRangeItem::GetPresentation():"
- " Using default en_US IntlWrapper");
- const IntlWrapper aIntlWrapper(
- ::comphelper::getProcessServiceFactory(), LANGUAGE_ENGLISH_US );
- rText = aIntlWrapper.getLocaleData()->getDate(aRange);
- rText.AppendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
- rText += aIntlWrapper.getLocaleData()->getTime(aRange);
- }
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxDateTimeRangeItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE )
-{
- com::sun::star::util::DateTimeRange aValue;
- if ( rVal >>= aValue )
- {
- aStartDateTime = DateTime( Date( aValue.StartDay,
- aValue.StartMonth,
- aValue.StartYear ),
- Time( aValue.StartHours,
- aValue.StartMinutes,
- aValue.StartSeconds,
- aValue.StartHundredthSeconds ) );
- aEndDateTime = DateTime( Date( aValue.EndDay,
- aValue.EndMonth,
- aValue.EndYear ),
- Time( aValue.EndHours,
- aValue.EndMinutes,
- aValue.EndSeconds,
- aValue.EndHundredthSeconds ) );
- return TRUE;
- }
-
- DBG_ERROR( "SfxDateTimeRangeItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxDateTimeRangeItem::QueryValue( com::sun::star::uno::Any& rVal,
- BYTE nMemberId ) const
-{
- nMemberId &= ~CONVERT_TWIPS;
- com::sun::star::util::DateTimeRange aValue( aStartDateTime.Get100Sec(),
- aStartDateTime.GetSec(),
- aStartDateTime.GetMin(),
- aStartDateTime.GetHour(),
- aStartDateTime.GetDay(),
- aStartDateTime.GetMonth(),
- aStartDateTime.GetYear(),
- aEndDateTime.Get100Sec(),
- aEndDateTime.GetSec(),
- aEndDateTime.GetMin(),
- aEndDateTime.GetHour(),
- aEndDateTime.GetDay(),
- aEndDateTime.GetMonth(),
- aEndDateTime.GetYear() );
- rVal <<= aValue;
- return TRUE;
-}
-
-
diff --git a/svtools/source/items1/frqitem.cxx b/svtools/source/items1/frqitem.cxx
deleted file mode 100644
index 4068ef8f97f1..000000000000
--- a/svtools/source/items1/frqitem.cxx
+++ /dev/null
@@ -1,580 +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: frqitem.cxx,v $
- * $Revision: 1.8.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <unotools/intlwrapper.hxx>
-
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <tools/datetime.hxx>
-
-#include <svtools/frqitem.hxx>
-
-DBG_NAME( SfxFrequencyItem )
-
-TYPEINIT1( SfxFrequencyItem, SfxPoolItem );
-
-#define MAX_GOTO 32000
-
-#define DECL_SAVE_GOTO() \
- ULONG nSafetyMeasures = 0;
-
-#define SAVE_GOTO(tag) \
- if(nSafetyMeasures < MAX_GOTO) \
- { nSafetyMeasures++; goto tag; }
-
-// -----------------------------------------------------------------------
-
-SfxFrequencyItem::SfxFrequencyItem( USHORT which ) :
- SfxPoolItem ( which ),
- eFrqMode ( FRQ_DAILY ),
- eFrqTimeMode ( FRQ_TIME_AT ),
- nDInterval1 ( 1 ),
- nDInterval2 ( 0 ),
- nDInterval3 ( 0 ),
- nTInterval1 ( 1 ),
- aTime1 ( Time( 12, 0, 0 ) ),
- aTime2 ( Time( 12, 0, 0 ) ),
- bMissingDate ( FALSE ),
- aMissingDate ( DateTime(0, 0) )
-{
- DBG_CTOR( SfxFrequencyItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxFrequencyItem::SfxFrequencyItem( USHORT which, FrequencyMode eMode, FrequencyTimeMode eTMode,
- USHORT nDI1, USHORT nDI2, USHORT nDI3, USHORT nTI1,
- const Time& rT1, const Time& rT2 ) :
- SfxPoolItem ( which ),
- eFrqMode ( eMode ),
- eFrqTimeMode ( eTMode ),
- nDInterval1 ( nDI1 ),
- nDInterval2 ( nDI2 ),
- nDInterval3 ( nDI3 ),
- nTInterval1 ( nTI1 ),
- aTime1 ( rT1 ),
- aTime2 ( rT2 ),
- bMissingDate ( FALSE )
-{
- DBG_CTOR( SfxFrequencyItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxFrequencyItem::SfxFrequencyItem( const SfxFrequencyItem& rItem ) :
- SfxPoolItem ( rItem ),
- eFrqMode ( rItem.eFrqMode ),
- eFrqTimeMode ( rItem.eFrqTimeMode ),
- nDInterval1 ( rItem.nDInterval1 ),
- nDInterval2 ( rItem.nDInterval2 ),
- nDInterval3 ( rItem.nDInterval3 ),
- nTInterval1 ( rItem.nTInterval1 ),
- aTime1 ( rItem.aTime1 ),
- aTime2 ( rItem.aTime2 ),
- bMissingDate ( rItem.bMissingDate )
-{
- DBG_CTOR( SfxFrequencyItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-int SfxFrequencyItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS( SfxFrequencyItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- return ((SfxFrequencyItem&)rItem ).eFrqMode == eFrqMode &&
- ((SfxFrequencyItem&)rItem ).eFrqTimeMode == eFrqTimeMode &&
- ((SfxFrequencyItem&)rItem ).nDInterval1 == nDInterval1 &&
- ((SfxFrequencyItem&)rItem ).nDInterval2 == nDInterval2 &&
- ((SfxFrequencyItem&)rItem ).nDInterval3 == nDInterval3 &&
- ((SfxFrequencyItem&)rItem ).nTInterval1 == nTInterval1 &&
- ((SfxFrequencyItem&)rItem ).aTime1 == aTime1 &&
- ((SfxFrequencyItem&)rItem ).aTime2 == aTime2;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxFrequencyItem::Compare( const SfxPoolItem&
-#ifdef DBG_UTIL
-rItem
-#endif
-) const
-{
- DBG_CHKTHIS( SfxFrequencyItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
-/* DateTime aThisRange( aEndDateTime - aStartDateTime );
- DateTime aRange(((const SfxFrequencyItem&)rItem).aEndDateTime -
- ((const SfxFrequencyItem&)rItem).aStartDateTime );
- if( aRange < aThisRange )
- return -1;
- else if( aRange == aThisRange )
- return 0;
- else
-*/
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxFrequencyItem::Create( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxFrequencyItem, 0);
-
- USHORT _eFrqMode;
- USHORT _eFrqTimeMode;
- USHORT _nDInterval1;
- USHORT _nDInterval2;
- USHORT _nDInterval3;
- USHORT _nTInterval1;
- long _nTime1;
- long _nTime2;
-
- rStream >> _eFrqMode;
- rStream >> _eFrqTimeMode;
- rStream >> _nDInterval1;
- rStream >> _nDInterval2;
- rStream >> _nDInterval3;
- rStream >> _nTInterval1;
- rStream >> _nTime1;
- rStream >> _nTime2;
-
- return new SfxFrequencyItem( Which(), (FrequencyMode)_eFrqMode,
- (FrequencyTimeMode) _eFrqTimeMode, _nDInterval1, _nDInterval2, _nDInterval3,
- _nTInterval1, Time(_nTime1), Time(_nTime2) );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxFrequencyItem::Store( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS( SfxFrequencyItem, 0 );
-
- USHORT nEMode = (USHORT)eFrqMode;
- USHORT nETimeMode = (USHORT)eFrqTimeMode;
-
- rStream << (USHORT) nEMode;
- rStream << (USHORT) nETimeMode;
-
- rStream << nDInterval1;
- rStream << nDInterval2;
- rStream << nDInterval3;
-
- rStream << nTInterval1;
- rStream << aTime1.GetTime();
- rStream << aTime2.GetTime();
-
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxFrequencyItem::Clone( SfxItemPool* ) const
-{
- DBG_CHKTHIS( SfxFrequencyItem, 0 );
- return new SfxFrequencyItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxFrequencyItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxFrequencyItem, 0);
- rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("SNIY"));
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// -----------------------------------------------------------------------
-
-Time SfxFrequencyItem::_CalcTime( BOOL bForToday ) const
-{
- Time aNow;
- Time aTime;
-
- DECL_SAVE_GOTO();
-
- switch( eFrqTimeMode )
- {
- //////////////////////////////////////////////////////////
- // FRQ_TIME_AT
- //
- // Update um Uhrzeit
- // nTime1 = 00:00:00 - 24:00:00
- //
- case FRQ_TIME_AT :
- aTime = aTime1;
- break;
-
- //////////////////////////////////////////////////////////
- // FRQ_TIME_REPEAT
- //
- // Wiederhole alle X Stunden
- // nTInterval1 = 1 .. 8
- //
- case FRQ_TIME_REPEAT :
- aTime = Time( 0, 0 );
- if( bForToday )
- {
-
- RECALC_TIME_REPEAT:
- if( aNow > aTime )
- {
- aTime += Time( nTInterval1, 0 );
- SAVE_GOTO( RECALC_TIME_REPEAT );
- }
- break;
- }
- break;
-
- //////////////////////////////////////////////////////////
- // FRQ_TIME_REPEAT_RANGE
- //
- // FRQ_TIME_REPEAT zwischen Uhrzeit 1 und 2
- // nTime1 = 00:00:00 - 24:00:00
- // nTime2 = 00:00:00 - 24:00:00
- //
- case FRQ_TIME_REPEAT_RANGE :
- aTime = aTime1;
- if( bForToday )
- {
- if( aNow > aTime2 )
- return aTime1;
-
- RECALC_TIME_REPEAT_RANGE:
- if( aNow > aTime )
- {
- aTime += Time( nTInterval1, 0 );
- if( aTime > aTime2 )
- return aTime1;
- SAVE_GOTO( RECALC_TIME_REPEAT_RANGE );
- }
- break;
- }
- break;
- }
- return aTime;
-}
-
-DateTime SfxFrequencyItem::CalcNextTick( const DateTime& rBase, BOOL bFirst )
-{
- Date aDateToday;
- Time aTimeToday;
- Date aDateBase;
- Time aTimeBase;
-
- if( bFirst )
- {
- aDateBase = Date( 17, 2, 1969 );
- aTimeBase = Time( 8, 0, 0 );
- }
- else
- {
- aDateBase = rBase.GetDate();
- aTimeBase = rBase.GetTime();
- }
-
- Time aNextTime( _CalcTime(FALSE) );
- Date aNextDate( aDateBase );
- bMissingDate = FALSE;
-
- DECL_SAVE_GOTO();
-
- switch( eFrqMode )
- {
- //////////////////////////////////////////////////////////
- // FRQ_DAILY
- //
- // jeden X'ten Tag
- // nInterval1 = 1 .. 999
- //
- // jeden Wochentag
- // nInterval1 = USHRT_MAX
- //
- case FRQ_DAILY :
- {
- if( bFirst )
- {
- aNextTime = _CalcTime( TRUE );
- if( aNextTime < aTimeToday )
- {
- aNextTime = _CalcTime( FALSE );
- aNextDate = aDateToday + (USHORT)
- ((nDInterval1 == USHRT_MAX)? 1 : nDInterval1);
- }
- else
- aNextDate = aDateToday;
- break;
- }
-
- RECALC_FRQ_DAILY:
- if( aNextDate < aDateToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1);
- SAVE_GOTO( RECALC_FRQ_DAILY );
- }
-
- if( aNextDate == aDateToday )
- {
- aNextTime = _CalcTime( TRUE );
- if( aNextTime < aTimeToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- aNextDate += (USHORT)((nDInterval1 == USHRT_MAX)? 1 : nDInterval1);
- aNextTime = _CalcTime( FALSE );
- }
- }
- else
- aNextTime = _CalcTime( FALSE );
- } break;
-
- //////////////////////////////////////////////////////////
- // FRQ_WEEKLY
- // wiederhole jede X'te Woche
- // nInterval1 = 1 .. 99
- //
- // an SU, MO, TU, WE, TH, FR, SA
- // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY |
- // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY |
- // WD_SATURDAY
- //
- case FRQ_WEEKLY :
- {
- BOOL bInRecalc = FALSE;
-
- RECALC_FRQ_WEEKLY:
- if( !bFirst || bInRecalc )
- aNextDate += (nDInterval1 - 1) * 7;
-
- aNextDate -= (USHORT) ((aNextDate.GetDayOfWeek() != SUNDAY) ?
- aNextDate.GetDayOfWeek() + 1 : 0);
-
- if( nDInterval2 & WD_SUNDAY && (aNextDate >= aDateToday) )
- aNextDate += 0;
- else if( nDInterval2 & WD_MONDAY && (aNextDate + 1 >= aDateToday) )
- aNextDate += 1;
- else if( nDInterval2 & WD_TUESDAY && (aNextDate + 2 >= aDateToday) )
- aNextDate += 2;
- else if( nDInterval2 & WD_WEDNESDAY && (aNextDate + 3 >= aDateToday) )
- aNextDate += 3;
- else if( nDInterval2 & WD_THURSDAY && (aNextDate + 4 >= aDateToday) )
- aNextDate += 4;
- else if( nDInterval2 & WD_FRIDAY && (aNextDate + 5 >= aDateToday) )
- aNextDate += 5;
- else if( nDInterval2 & WD_SATURDAY && (aNextDate + 6 >= aDateToday) )
- aNextDate += 6;
-
- if( aNextDate < aDateToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- bInRecalc = TRUE;
- aNextDate += 7;
- SAVE_GOTO( RECALC_FRQ_WEEKLY );
- }
- if( aNextDate == aDateToday )
- {
- aNextTime = _CalcTime( TRUE );
- if( aNextTime < aTimeToday )
- {
- bInRecalc = TRUE;
- aNextDate += 7;
- SAVE_GOTO( RECALC_FRQ_WEEKLY );
- }
- }
- else
- aNextTime = _CalcTime( FALSE );
- } break;
-
- //////////////////////////////////////////////////////////
- // FRQ_MONTHLY_DAILY
- //
- // jeden X'ten Tag von jedem X'ten Monat
- // nInterval1 = 1 .. 31
- // nInterval2 = 1 .. 6
- //
- case FRQ_MONTHLY_DAILY :
- {
- BOOL bInRecalc = FALSE;
- aNextDate.SetDay( nDInterval1 );
-
- RECALC_FRQ_MONTHLY_DAILY:
- if( nDInterval2 > 1 || bInRecalc )
- {
- long nMonth = aNextDate.GetMonth() - 1;
- nMonth += nDInterval2;
- aNextDate.SetYear(
- sal::static_int_cast< USHORT >(
- aNextDate.GetYear() + nMonth / 12 ) );
- aNextDate.SetMonth(
- sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) );
- }
-
- if( aNextDate < aDateToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- bInRecalc = TRUE;
- SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY );
- }
-
- if( aNextDate == aDateToday )
- {
- aNextTime = _CalcTime( TRUE );
- if( aNextTime < aTimeToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- bInRecalc = TRUE;
- SAVE_GOTO( RECALC_FRQ_MONTHLY_DAILY );
- }
- }
- else
- aNextTime = _CalcTime( FALSE );
- } break;
-
- //////////////////////////////////////////////////////////
- // FRQ_MONTHLY_LOGIC
- //
- // jeden ersten, zweiten, dritten, vierten oder letzten
- // Wochentag jeden X'ten Monats
- // nInterval1 = 0 .. 4
- // nInterval2 = WD_SUNDAY | WD_MONDAY | WD_TUESDAY |
- // WD_WEDNESDAY | WD_THURSDAY | WD_FRIDAY |
- // WD_SATURDAY
- // nInterval3 = 1 .. 6
- //
- case FRQ_MONTHLY_LOGIC :
- {
- BOOL bInRecalc = FALSE;
-
- RECALC_FRQ_MONTHLY_LOGIC:
- if( nDInterval3 > 1 || bInRecalc )
- {
- long nMonth = aNextDate.GetMonth() - 1;
- nMonth += nDInterval3;
- aNextDate.SetYear(
- sal::static_int_cast< USHORT >(
- aNextDate.GetYear() + nMonth / 12 ) );
- aNextDate.SetMonth(
- sal::static_int_cast< USHORT >( ( nMonth % 12 ) + 1 ) );
- }
-
- USHORT nDay;
- if( nDInterval2 & WD_SUNDAY )
- nDay = 6;
- else if( nDInterval2 & WD_MONDAY )
- nDay = 0;
- else if( nDInterval2 & WD_TUESDAY )
- nDay = 1;
- else if( nDInterval2 & WD_WEDNESDAY )
- nDay = 2;
- else if( nDInterval2 & WD_THURSDAY )
- nDay = 3;
- else if( nDInterval2 & WD_FRIDAY )
- nDay = 4;
- else nDay = 5;
-
- if( nDInterval1 == 4 )
- {
- DateTime aDT = aNextDate;
- aDT.SetDay( 1 );
- aDT += (long)(aNextDate.GetDaysInMonth() - 1);
- if( aDT.GetDayOfWeek() != nDay )
- for( aDT--; aDT.GetDayOfWeek() != nDay; aDT-- ) ;
- aNextDate = aDT;
- }
- else
- {
- DateTime aDT = aNextDate;
- aDT.SetDay( 1 );
- aDT += (long)(nDay - USHORT(aDT.GetDayOfWeek()));
- if( aDT.GetMonth() != aNextDate.GetMonth() )
- aDT += 7L;
- aDT += (long)(nDInterval1 * 7);
- aNextDate = aDT;
- }
-
- if( aNextDate < aDateToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- bInRecalc = TRUE;
- SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC );
- }
-
- if( aNextDate == aDateToday )
- {
- aNextTime = _CalcTime( TRUE );
- if( aNextTime < aTimeToday )
- {
- bMissingDate = TRUE;
- aMissingDate.SetDate(aNextDate.GetDate());
- aMissingDate.SetTime(_CalcTime(FALSE).GetTime());
-
- bInRecalc = TRUE;
- SAVE_GOTO( RECALC_FRQ_MONTHLY_LOGIC );
- }
- }
- else
- aNextTime = _CalcTime( FALSE );
- } break;
- }
-
- return DateTime( aNextDate, aNextTime );
-}
-
diff --git a/svtools/source/items1/ilstitem.cxx b/svtools/source/items1/ilstitem.cxx
deleted file mode 100644
index a26c054eeadb..000000000000
--- a/svtools/source/items1/ilstitem.cxx
+++ /dev/null
@@ -1,106 +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: ilstitem.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_svtools.hxx"
-#include <com/sun/star/script/XTypeConverter.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#include <comphelper/processfactory.hxx>
-
-#include <svtools/ilstitem.hxx>
-
-#define _SVSTDARR_ULONGS
-#include <svtools/svstdarr.hxx>
-
-TYPEINIT1_AUTOFACTORY(SfxIntegerListItem, SfxPoolItem);
-
-SfxIntegerListItem::SfxIntegerListItem()
-{
-}
-
-SfxIntegerListItem::SfxIntegerListItem( USHORT which, const SvULongs& rList )
- : SfxPoolItem( which )
-{
- m_aList.realloc( rList.Count() );
- for ( USHORT n=0; n<rList.Count(); n++ )
- m_aList[n] = rList[n];
-}
-
-SfxIntegerListItem::SfxIntegerListItem( const SfxIntegerListItem& rItem )
- : SfxPoolItem( rItem )
-{
- m_aList = rItem.m_aList;
-}
-
-SfxIntegerListItem::~SfxIntegerListItem()
-{
-}
-
-int SfxIntegerListItem::operator==( const SfxPoolItem& rPoolItem ) const
-{
- if ( !rPoolItem.ISA( SfxIntegerListItem ) )
- return FALSE;
-
- const SfxIntegerListItem rItem = (const SfxIntegerListItem&) rPoolItem;
- return rItem.m_aList == m_aList;
-}
-
-SfxPoolItem* SfxIntegerListItem::Clone( SfxItemPool * ) const
-{
- return new SfxIntegerListItem( *this );
-}
-
-BOOL SfxIntegerListItem::PutValue ( const com::sun::star::uno::Any& rVal, BYTE )
-{
- ::com::sun::star::uno::Reference < ::com::sun::star::script::XTypeConverter > xConverter
- ( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.script.Converter")),
- ::com::sun::star::uno::UNO_QUERY );
- ::com::sun::star::uno::Any aNew;
- try { aNew = xConverter->convertTo( rVal, ::getCppuType((const ::com::sun::star::uno::Sequence < sal_Int32 >*)0) ); }
- catch (::com::sun::star::uno::Exception&)
- {
- return FALSE;
- }
-
- return ( aNew >>= m_aList );
-}
-
-BOOL SfxIntegerListItem::QueryValue( com::sun::star::uno::Any& rVal, BYTE ) const
-{
- rVal <<= m_aList;
- return TRUE;
-}
-
-void SfxIntegerListItem::GetList( SvULongs& rList ) const
-{
- for ( sal_Int32 n=0; n<m_aList.getLength(); n++ )
- rList.Insert( m_aList[n], sal::static_int_cast< USHORT >(n) );
-}
diff --git a/svtools/source/items1/itemiter.cxx b/svtools/source/items1/itemiter.cxx
deleted file mode 100644
index 9a7fa4d72c88..000000000000
--- a/svtools/source/items1/itemiter.cxx
+++ /dev/null
@@ -1,122 +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: itemiter.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifndef GCC
-#endif
-
-#include <svtools/itemiter.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxItemIter);
-
-
-// --------------------------------------------------------------------------
-
-
-SfxItemIter::SfxItemIter( const SfxItemSet& rItemSet )
- : _rSet( rItemSet )
-{
- DBG_CTOR(SfxItemIter, 0);
- DBG_ASSERTWARNING( _rSet.Count(), "es gibt gar keine Attribute" );
-
- if ( !_rSet._nCount )
- {
- _nStt = 1;
- _nEnd = 0;
- }
- else
- {
- SfxItemArray ppFnd = _rSet._aItems;
-
- // suche das 1. gesetzte Item
- for ( _nStt = 0; !*(ppFnd + _nStt ); ++_nStt )
- ; // empty loop
- if ( 1 < _rSet.Count() )
- for( _nEnd = _rSet.TotalCount(); !*( ppFnd + --_nEnd); )
- ; // empty loop
- else
- _nEnd = _nStt;
- }
-
- _nAkt = _nStt;
-}
-
-// --------------------------------------------------------------------------
-
-
-SfxItemIter::~SfxItemIter()
-{
- DBG_DTOR(SfxItemIter, 0);
-}
-
-// --------------------------------------------------------------------------
-
-
-const SfxPoolItem* SfxItemIter::NextItem()
-{
- DBG_CHKTHIS(SfxItemIter, 0);
- SfxItemArray ppFnd = _rSet._aItems;
-
- if( _nAkt < _nEnd )
- {
- do {
- _nAkt++;
- } while( _nAkt < _nEnd && !*(ppFnd + _nAkt ) );
- return *(ppFnd+_nAkt);
- }
- return 0;
-}
-
-// --------------------------------------------------------------------------
-
-
-const SfxPoolItem* SfxItemIter::PrevItem()
-{
- DBG_CHKTHIS(SfxItemIter, 0);
- SfxItemArray ppFnd = _rSet._aItems;
-
- if ( _nAkt > _nStt )
- {
- do {
- --_nAkt;
- } while( _nAkt && !*(ppFnd + _nAkt ));
- return *(ppFnd+_nAkt);
- }
- return 0;
-}
-
-
-
diff --git a/svtools/source/items1/itempool.cxx b/svtools/source/items1/itempool.cxx
deleted file mode 100644
index e54bca8d3c19..000000000000
--- a/svtools/source/items1/itempool.cxx
+++ /dev/null
@@ -1,1176 +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: itempool.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_svtools.hxx"
-
-#include <string.h>
-#include <stdio.h>
-#ifndef GCC
-#endif
-
-#include <svtools/itempool.hxx>
-#include "whassert.hxx"
-#include <svtools/brdcst.hxx>
-#include <svtools/smplhint.hxx>
-#include "poolio.hxx"
-#include <algorithm>
-
-// STATIC DATA -----------------------------------------------------------
-
-
-//========================================================================
-
-SV_IMPL_PTRARR( SfxPoolVersionArr_Impl, SfxPoolVersion_Impl* );
-
-//========================================================================
-
-
-void SfxItemPool::AddSfxItemPoolUser(SfxItemPoolUser& rNewUser)
-{
- maSfxItemPoolUsers.push_back(&rNewUser);
-}
-
-void SfxItemPool::RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser)
-{
- const SfxItemPoolUserVector::iterator aFindResult = ::std::find(maSfxItemPoolUsers.begin(), maSfxItemPoolUsers.end(), &rOldUser);
- if(aFindResult != maSfxItemPoolUsers.end())
- {
- maSfxItemPoolUsers.erase(aFindResult);
- }
-}
-
-const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( USHORT nWhich ) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- const SfxPoolItem* pRet;
- if( IsInRange( nWhich ) )
- pRet = *(ppPoolDefaults + GetIndex_Impl( nWhich ));
- else if( pSecondary )
- pRet = pSecondary->GetPoolDefaultItem( nWhich );
- else
- {
- SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get pool default" );
- pRet = 0;
- }
- return pRet;
-}
-
-// -----------------------------------------------------------------------
-
-inline FASTBOOL SfxItemPool::IsItemFlag_Impl( USHORT nPos, USHORT nFlag ) const
-{
- USHORT nItemFlag = pItemInfos[nPos]._nFlags;
- return nFlag == (nItemFlag & nFlag);
-}
-
-// -----------------------------------------------------------------------
-
-FASTBOOL SfxItemPool::IsItemFlag( USHORT nWhich, USHORT nFlag ) const
-{
- for ( const SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary )
- {
- if ( pPool->IsInRange(nWhich) )
- return pPool->IsItemFlag_Impl( pPool->GetIndex_Impl(nWhich), nFlag);
- }
- DBG_ASSERT( !IsWhich(nWhich), "unknown which-id" );
- return FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-SfxBroadcaster& SfxItemPool::BC()
-{
- return pImp->aBC;
-}
-
-// -----------------------------------------------------------------------
-
-
-SfxItemPool::SfxItemPool
-(
- UniString const & rName, /* Name des Pools zur Idetifikation
- im File-Format */
- USHORT nStartWhich, /* erste Which-Id des Pools */
- USHORT nEndWhich, /* letzte Which-Id des Pools */
-#ifdef TF_POOLABLE
- const SfxItemInfo* pInfos, /* SID-Map und Item-Flags */
-#endif
- SfxPoolItem** pDefaults, /* Pointer auf statische Defaults,
- wird direkt vom Pool referenziert,
- jedoch kein Eigent"umer"ubergang */
-#ifndef TF_POOLABLE
- USHORT* pSlotIdArray, /* Zuordnung von Slot-Ids zu Which-Ids */
-#endif
- FASTBOOL bLoadRefCounts /* Ref-Counts mitladen oder auf 1 setzen */
-)
-
-/* [Beschreibung]
-
- Der im Normalfall verwendete Konstruktor der Klasse SfxItemPool. Es
- wird eine SfxItemPool-Instanz initialisiert, die Items im b"undigen
- Which-Bereich von 'nStartWhich' bis 'nEndWhich' verwalten kann.
-
- F"ur jede dieser Which-Ids mu\s ein statischer Default im Array 'pDefaults'
- vorhanden sein, die dort beginnend mit einem <SfxPoolItem> mit der
- Which-Id 'nStartWhich' nach Which-Ids sortiert aufeinanderfolgend
- eingetragen sein m"ussen.
-
- 'pItemInfos' ist ein identisch angeordnetes Array von USHORTs, die
- Slot-Ids darstellen und Flags. Die Slot-Ids k"onnen 0 sein, wenn die
- betreffenden Items ausschlie\slich in der Core verwendet werden.
- "Uber die Flags kann z.B. bestimmt werden, ob Value-Sharing
- (SFX_ITEM_POOLABLE) stattfinden soll.
-
- [Anmerkung]
-
- Wenn der Pool <SfxSetItem>s enthalten soll, k"onnen im Konstruktor noch
- keine static-Defaults angegeben werden. Dies mu\s dann nachtr"aglich
- mit <SfxItemPool::SetDefaults(SfxItemPool**)> geschehen.
-
-
- [Querverweise]
-
- <SfxItemPool::SetDefaults(SfxItemPool**)>
- <SfxItemPool::ReleaseDefaults(SfxPoolItem**,USHORT,BOOL)>
- <SfxItemPool::ReldaseDefaults(BOOL)>
-*/
-
-: aName(rName),
- nStart(nStartWhich),
- nEnd(nEndWhich),
-#ifdef TF_POOLABLE
- pItemInfos(pInfos),
-#else
- pSlotIds(pSlotIdArray),
-#endif
- pImp( new SfxItemPool_Impl( nStart, nEnd ) ),
- ppStaticDefaults(0),
- ppPoolDefaults(new SfxPoolItem* [ nEndWhich - nStartWhich + 1]),
- pSecondary(0),
- pMaster(this),
- _pPoolRanges( 0 ),
- bPersistentRefCounts(bLoadRefCounts),
- maSfxItemPoolUsers()
-{
- DBG_CTOR(SfxItemPool, 0);
- DBG_ASSERT(nStart, "Start-Which-Id must be greater 0" );
-
- pImp->eDefMetric = SFX_MAPUNIT_TWIP;
- pImp->nVersion = 0;
- pImp->bStreaming = FALSE;
- pImp->nLoadingVersion = 0;
- pImp->nInitRefCount = 1;
- pImp->nVerStart = nStart;
- pImp->nVerEnd = nEnd;
- pImp->bInSetItem = FALSE;
- pImp->nStoringStart = nStartWhich;
- pImp->nStoringEnd = nEndWhich;
-
- memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1));
-
- if ( pDefaults )
- SetDefaults(pDefaults);
-}
-
-// -----------------------------------------------------------------------
-
-
-SfxItemPool::SfxItemPool
-(
- const SfxItemPool& rPool, // von dieser Instanz kopieren
- BOOL bCloneStaticDefaults /* TRUE
- statische Defaults kopieren
-
- FALSE
- statische Defaults
- "ubernehehmen */
-)
-
-/* [Beschreibung]
-
- Copy-Konstruktor der Klasse SfxItemPool.
-
-
- [Querverweise]
-
- <SfxItemPool::Clone()const>
-*/
-
-: aName(rPool.aName),
- nStart(rPool.nStart),
- nEnd(rPool.nEnd),
-#ifdef TF_POOLABLE
- pItemInfos(rPool.pItemInfos),
-#else
- pSlotIds(rPool.pSlotIds),
-#endif
- pImp( new SfxItemPool_Impl( nStart, nEnd ) ),
- ppStaticDefaults(0),
- ppPoolDefaults(new SfxPoolItem* [ nEnd - nStart + 1]),
- pSecondary(0),
- pMaster(this),
- _pPoolRanges( 0 ),
- bPersistentRefCounts(rPool.bPersistentRefCounts ),
- maSfxItemPoolUsers()
-{
- DBG_CTOR(SfxItemPool, 0);
- pImp->eDefMetric = rPool.pImp->eDefMetric;
- pImp->nVersion = rPool.pImp->nVersion;
- pImp->bStreaming = FALSE;
- pImp->nLoadingVersion = 0;
- pImp->nInitRefCount = 1;
- pImp->nVerStart = rPool.pImp->nVerStart;
- pImp->nVerEnd = rPool.pImp->nVerEnd;
- pImp->bInSetItem = FALSE;
- pImp->nStoringStart = nStart;
- pImp->nStoringEnd = nEnd;
-
- memset( ppPoolDefaults, 0, sizeof( SfxPoolItem* ) * (nEnd - nStart + 1));
-
- // Static Defaults "ubernehmen
- if ( bCloneStaticDefaults )
- {
- SfxPoolItem **ppDefaults = new SfxPoolItem*[nEnd-nStart+1];
- for ( USHORT n = 0; n <= nEnd - nStart; ++n )
- {
- (*( ppDefaults + n )) = (*( rPool.ppStaticDefaults + n ))->Clone(this);
- (*( ppDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT );
- }
-
- SetDefaults( ppDefaults );
- }
- else
- SetDefaults( rPool.ppStaticDefaults );
-
- // Pool Defaults kopieren
- for ( USHORT n = 0; n <= nEnd - nStart; ++n )
- if ( (*( rPool.ppPoolDefaults + n )) )
- {
- (*( ppPoolDefaults + n )) = (*( rPool.ppPoolDefaults + n ))->Clone(this);
- (*( ppPoolDefaults + n ))->SetKind( SFX_ITEMS_POOLDEFAULT );
- }
-
- // Version-Map kopieren
- USHORT nVerCount = rPool.pImp->aVersions.Count();
- for ( USHORT nVer = 0; nVer < nVerCount; ++nVer )
- {
- const SfxPoolVersion_Impl *pOld = rPool.pImp->aVersions.GetObject(nVer);
- const SfxPoolVersion_Impl *pNew = new SfxPoolVersion_Impl( *pOld );
- pImp->aVersions.Insert( pNew, nVer );
- }
-
- // Verkettung wiederherstellen
- if ( rPool.pSecondary )
- SetSecondaryPool( rPool.pSecondary->Clone() );
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::SetDefaults( SfxPoolItem **pDefaults )
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- DBG_ASSERT( pDefaults, "erst wollen, dann nichts geben..." );
- DBG_ASSERT( !ppStaticDefaults, "habe schon defaults" );
-
- ppStaticDefaults = pDefaults;
- //! if ( (*ppStaticDefaults)->GetKind() != SFX_ITEMS_STATICDEFAULT )
- //! geht wohl nicht im Zshg mit SetItems, die hinten stehen
- {
- DBG_ASSERT( (*ppStaticDefaults)->GetRefCount() == 0 ||
- IsDefaultItem( (*ppStaticDefaults) ),
- "das sind keine statics" );
- for ( USHORT n = 0; n <= nEnd - nStart; ++n )
- {
- SFX_ASSERT( (*( ppStaticDefaults + n ))->Which() == n + nStart,
- n + nStart, "static defaults not sorted" );
- (*( ppStaticDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT );
- DBG_ASSERT( !(pImp->ppPoolItems[n]), "defaults with setitems with items?!" );
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::ReleaseDefaults
-(
- BOOL bDelete /* TRUE
- l"oscht sowohl das Array als auch die einzelnen
- statischen Defaults
-
- FALSE
- l"oscht weder das Array noch die einzelnen
- statischen Defaults */
-)
-
-/* [Beschreibung]
-
- Gibt die statischen Defaults der betreffenden SfxItemPool-Instanz frei
- und l"oscht ggf. die statischen Defaults.
-
- Nach Aufruf dieser Methode darf die SfxItemPool-Instanz nicht mehr
- verwendet werden, einzig ist der Aufruf des Destruktors zu"lassig.
-*/
-
-{
- DBG_ASSERT( ppStaticDefaults, "keine Arme keine Kekse" );
- ReleaseDefaults( ppStaticDefaults, nEnd - nStart + 1, bDelete );
-
- // KSO (22.10.98): ppStaticDefaults zeigt auf geloeschten Speicher,
- // wenn bDelete == TRUE.
- if ( bDelete )
- ppStaticDefaults = 0;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::ReleaseDefaults
-(
- SfxPoolItem** pDefaults, /* freizugebende statische Defaults */
-
- USHORT nCount, /* Anzahl der statischen Defaults */
-
- BOOL bDelete /* TRUE
- l"oscht sowohl das Array als auch die
- einzelnen statischen Defaults
-
- FALSE
- l"oscht weder das Array noch die
- einzelnen statischen Defaults */
-)
-
-/* [Beschreibung]
-
- Gibt die angegebenen statischen Defaults frei und l"oscht ggf.
- die statischen Defaults.
-
- Diese Methode darf erst nach Zerst"orung aller SfxItemPool-Instanzen,
- welche die angegebenen statischen Defaults 'pDefault' verwenden,
- aufgerufen werden.
-*/
-
-{
- DBG_ASSERT( pDefaults, "erst wollen, dann nichts geben..." );
-
- for ( USHORT n = 0; n < nCount; ++n )
- {
- SFX_ASSERT( IsStaticDefaultItem( *(pDefaults+n) ),
- n, "das ist kein static-default" );
- (*( pDefaults + n ))->SetRefCount( 0 );
- if ( bDelete )
- { delete *( pDefaults + n ); *(pDefaults + n) = 0; }
- }
-
- if ( bDelete )
- { delete[] pDefaults; pDefaults = 0; }
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPool::~SfxItemPool()
-{
- DBG_DTOR(SfxItemPool, 0);
- DBG_ASSERT( pMaster == this, "destroying active Secondary-Pool" );
-
- if ( pImp->ppPoolItems && ppPoolDefaults )
- Delete();
- delete[] _pPoolRanges;
- delete pImp;
-}
-
-void SfxItemPool::Free(SfxItemPool* pPool)
-{
- if(pPool)
- {
- // tell all the registered SfxItemPoolUsers that the pool is in destruction
- SfxItemPoolUserVector aListCopy(pPool->maSfxItemPoolUsers.begin(), pPool->maSfxItemPoolUsers.end());
- for(SfxItemPoolUserVector::iterator aIterator = aListCopy.begin(); aIterator != aListCopy.end(); aIterator++)
- {
- SfxItemPoolUser* pSfxItemPoolUser = *aIterator;
- DBG_ASSERT(pSfxItemPoolUser, "corrupt SfxItemPoolUser list (!)");
- pSfxItemPoolUser->ObjectInDestruction(*pPool);
- }
-
- // Clear the vector. This means that user do not need to call RemoveSfxItemPoolUser()
- // when they get called from ObjectInDestruction().
- pPool->maSfxItemPoolUsers.clear();
-
- // delete pool
- delete pPool;
- }
-}
-
-// -----------------------------------------------------------------------
-
-
-void SfxItemPool::SetSecondaryPool( SfxItemPool *pPool )
-{
- // ggf. an abgeh"angten Pools den Master zur"ucksetzen
- if ( pSecondary )
- {
-#ifdef DBG_UTIL
- HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" )
- if ( ppStaticDefaults )
- {
- // Delete() ist noch nicht gelaufen?
- if ( pImp->ppPoolItems && pSecondary->pImp->ppPoolItems )
- {
- // hat der master SetItems?
- BOOL bHasSetItems = FALSE;
- for ( USHORT i = 0; !bHasSetItems && i < nEnd-nStart; ++i )
- bHasSetItems = ppStaticDefaults[i]->ISA(SfxSetItem);
-
- // abgehaengte Pools muessen leer sein
- BOOL bOK = bHasSetItems;
- for ( USHORT n = 0;
- bOK && n <= pSecondary->nEnd - pSecondary->nStart;
- ++n )
- {
- SfxPoolItemArray_Impl** ppItemArr =
- pSecondary->pImp->ppPoolItems + n;
- if ( *ppItemArr )
- {
- SfxPoolItem** ppHtArr =
- (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT i = (*ppItemArr)->Count(); i; ++ppHtArr, --i )
- if ( !(*ppHtArr) )
- {
- DBG_ERROR( "old secondary pool must be empty" );
- bOK = FALSE;
- break;
- }
- }
- }
- }
- }
-#endif
-
- pSecondary->pMaster = pSecondary;
- for ( SfxItemPool *p = pSecondary->pSecondary; p; p = p->pSecondary )
- p->pMaster = pSecondary;
- }
-
- // ggf. den Master der neuen Secondary-Pools setzen
- DBG_ASSERT( !pPool || pPool->pMaster == pPool, "Secondary tanzt auf zwei Hochzeiten " );
- SfxItemPool *pNewMaster = pMaster ? pMaster : this;
- for ( SfxItemPool *p = pPool; p; p = p->pSecondary )
- p->pMaster = pNewMaster;
-
- // neuen Secondary-Pool merken
- pSecondary = pPool;
-}
-
-// -----------------------------------------------------------------------
-
-SfxMapUnit SfxItemPool::GetMetric( USHORT ) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- return pImp->eDefMetric;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::SetDefaultMetric( SfxMapUnit eNewMetric )
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- pImp->eDefMetric = eNewMetric;
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemPresentation SfxItemPool::GetPresentation
-(
- const SfxPoolItem& rItem, /* IN: <SfxPoolItem>, dessen textuelle
- Wert-Darstellung geliefert werden
- soll */
- SfxItemPresentation ePresent, /* IN: gew"unschte Art der Darstellung;
- siehe <SfxItemPresentation> */
- SfxMapUnit eMetric, /* IN: gew"unschte Ma\seinheit der Darstellung */
- XubString& rText, /* OUT: textuelle Darstellung von 'rItem' */
- const IntlWrapper * pIntlWrapper
-) const
-
-/* [Beschreibung]
-
- "Uber diese virtuelle Methode k"onnen textuelle Darstellungen der
- von der jeweilige SfxItemPool-Subklasse verwalteten SfxPoolItems
- angefordert werden.
-
- In Ableitungen sollte diese Methode "uberladen werden und auf
- SfxPoolItems reagiert werden, die bei <SfxPoolItem::GetPresentation()const>
- keine vollst"andige Information liefern k"onnen.
-
- Die Basisklasse liefert die unver"anderte Presentation von 'rItem'.
-*/
-
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- return rItem.GetPresentation(
- ePresent, GetMetric(rItem.Which()), eMetric, rText, pIntlWrapper );
-}
-
-
-// -----------------------------------------------------------------------
-
-SfxItemPool* SfxItemPool::Clone() const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- SfxItemPool *pPool = new SfxItemPool( *this );
- return pPool;
-}
-
-// ----------------------------------------------------------------------
-
-void SfxItemPool::Delete()
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- // schon deleted?
- if ( !pImp->ppPoolItems || !ppPoolDefaults )
- return;
-
- // z.B. laufenden Requests bescheidsagen
- pImp->aBC.Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
-
- //MA 16. Apr. 97: Zweimal durchlaufen, in der ersten Runde fuer die SetItems.
- //Der Klarheit halber wird das jetzt in zwei besser lesbare Schleifen aufgeteilt.
-
- SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems;
- SfxPoolItem** ppDefaultItem = ppPoolDefaults;
- SfxPoolItem** ppStaticDefaultItem = ppStaticDefaults;
- USHORT nArrCnt;
-
- //Erst die SetItems abraeumen
- HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" )
- if ( ppStaticDefaults )
- {
- for ( nArrCnt = GetSize_Impl();
- nArrCnt;
- --nArrCnt, ++ppItemArr, ++ppDefaultItem, ++ppStaticDefaultItem )
- {
- // KSO (22.10.98): *ppStaticDefaultItem kann im dtor einer
- // von SfxItemPool abgeleiteten Klasse bereits geloescht worden
- // sein! -> CHAOS Itempool
- if ( *ppStaticDefaultItem && (*ppStaticDefaultItem)->ISA(SfxSetItem) )
- {
- if ( *ppItemArr )
- {
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
- if (*ppHtArr)
- {
-#ifndef PRODUCT
- ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() );
-#endif
- delete *ppHtArr;
- }
- DELETEZ( *ppItemArr );
- }
- if ( *ppDefaultItem )
- {
-#ifndef PRODUCT
- SetRefCount( **ppDefaultItem, 0 );
-#endif
- DELETEZ( *ppDefaultItem );
- }
- }
- }
- }
-
- ppItemArr = pImp->ppPoolItems;
- ppDefaultItem = ppPoolDefaults;
-
- //Jetzt die 'einfachen' Items
- for ( nArrCnt = GetSize_Impl();
- nArrCnt;
- --nArrCnt, ++ppItemArr, ++ppDefaultItem )
- {
- if ( *ppItemArr )
- {
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
- if (*ppHtArr)
- {
-#ifndef PRODUCT
- ReleaseRef( **ppHtArr, (*ppHtArr)->GetRefCount() );
-#endif
- delete *ppHtArr;
- }
- delete *ppItemArr;
- }
- if ( *ppDefaultItem )
- {
-#ifndef PRODUCT
- SetRefCount( **ppDefaultItem, 0 );
-#endif
- delete *ppDefaultItem;
- }
- }
-
- pImp->DeleteItems();
- delete[] ppPoolDefaults; ppPoolDefaults = 0;
-}
-
-// ----------------------------------------------------------------------
-
-void SfxItemPool::Cleanup()
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- //MA 16. Apr. 97: siehe ::Delete()
-
- SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems;
- SfxPoolItem** ppDefaultItem = ppPoolDefaults;
- SfxPoolItem** ppStaticDefaultItem = ppStaticDefaults;
- USHORT nArrCnt;
-
- HACK( "fuer Image, dort gibt es derzeit keine Statics - Bug" )
- if ( ppStaticDefaults ) //HACK fuer Image, dort gibt es keine Statics!!
- {
- for ( nArrCnt = GetSize_Impl();
- nArrCnt;
- --nArrCnt, ++ppItemArr, ++ppDefaultItem, ++ppStaticDefaultItem )
- {
- //Fuer jedes Item gibt es entweder ein Default oder ein static Default!
- if ( *ppItemArr &&
- ((*ppDefaultItem && (*ppDefaultItem)->ISA(SfxSetItem)) ||
- (*ppStaticDefaultItem)->ISA(SfxSetItem)) )
- {
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
- if ( *ppHtArr && !(*ppHtArr)->GetRefCount() )
- {
- DELETEZ(*ppHtArr);
- }
- }
- }
- }
-
- ppItemArr = pImp->ppPoolItems;
-
- for ( nArrCnt = GetSize_Impl();
- nArrCnt;
- --nArrCnt, ++ppItemArr )
- {
- if ( *ppItemArr )
- {
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for ( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
- if ( *ppHtArr && !(*ppHtArr)->GetRefCount() )
- DELETEZ( *ppHtArr );
- }
- }
-}
-
-// ----------------------------------------------------------------------
-
-void SfxItemPool::SetPoolDefaultItem(const SfxPoolItem &rItem)
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- if ( IsInRange(rItem.Which()) )
- {
- SfxPoolItem **ppOldDefault =
- ppPoolDefaults + GetIndex_Impl(rItem.Which());
- SfxPoolItem *pNewDefault = rItem.Clone(this);
- pNewDefault->SetKind(SFX_ITEMS_POOLDEFAULT);
- if ( *ppOldDefault )
- {
- (*ppOldDefault)->SetRefCount(0);
- DELETEZ( *ppOldDefault );
- }
- *ppOldDefault = pNewDefault;
- }
- else if ( pSecondary )
- pSecondary->SetPoolDefaultItem(rItem);
- else
- {
- SFX_ASSERT( 0, rItem.Which(), "unknown Which-Id - cannot set pool default" );
- }
-}
-
-/*
- * Resets the default of the given <Which-Id> back to the static default.
- * If a pool default exists it is removed.
- */
-void SfxItemPool::ResetPoolDefaultItem( USHORT nWhichId )
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- if ( IsInRange(nWhichId) )
- {
- SfxPoolItem **ppOldDefault =
- ppPoolDefaults + GetIndex_Impl( nWhichId );
- if ( *ppOldDefault )
- {
- (*ppOldDefault)->SetRefCount(0);
- DELETEZ( *ppOldDefault );
- }
- }
- else if ( pSecondary )
- pSecondary->ResetPoolDefaultItem(nWhichId);
- else
- {
- SFX_ASSERT( 0, nWhichId, "unknown Which-Id - cannot set pool default" );
- }
-}
-
-// -----------------------------------------------------------------------
-
-const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, USHORT nWhich )
-{
- DBG_ASSERT( !rItem.ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem&)rItem).GetItemSet(),
- "SetItem without ItemSet" );
-
- DBG_CHKTHIS(SfxItemPool, 0);
- if ( 0 == nWhich )
- nWhich = rItem.Which();
-
- // richtigen Secondary-Pool finden
- BOOL bSID = nWhich > SFX_WHICH_MAX;
- if ( !bSID && !IsInRange(nWhich) )
- {
- if ( pSecondary )
- return pSecondary->Put( rItem, nWhich );
- DBG_ERROR( "unknown Which-Id - cannot put item" );
- }
-
- // SID oder nicht poolable (neue Definition)?
- USHORT nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich);
- if ( USHRT_MAX == nIndex ||
- IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) )
- {
- SFX_ASSERT( USHRT_MAX != nIndex || rItem.Which() != nWhich ||
- !IsDefaultItem(&rItem) || rItem.GetKind() == SFX_ITEMS_DELETEONIDLE,
- nWhich, "ein nicht Pool-Item ist Default?!" );
- SfxPoolItem *pPoolItem = rItem.Clone(pMaster);
- pPoolItem->SetWhich(nWhich);
- AddRef( *pPoolItem );
- return *pPoolItem;
- }
-
- SFX_ASSERT( rItem.IsA(GetDefaultItem(nWhich).Type()), nWhich,
- "SFxItemPool: wrong item type in Put" );
-
- SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems + nIndex;
- if( !*ppItemArr )
- *ppItemArr = new SfxPoolItemArray_Impl;
-
- SfxPoolItem **ppFree = 0;
- SfxPoolItem** ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData();
- if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) )
- {
- // wenn es ueberhaupt gepoolt ist, koennte es schon drin sein
- if ( IsPooledItem(&rItem) )
- {
- // 1. Schleife: teste ob der Pointer vorhanden ist.
- for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArray, --n )
- if( &rItem == (*ppHtArray) )
- {
- AddRef( **ppHtArray );
- return **ppHtArray;
- }
- }
-
- // 2. Schleife: dann muessen eben die Attribute verglichen werden
- USHORT n;
- for ( n = (*ppItemArr)->Count(), ppHtArray = (SfxPoolItem**)(*ppItemArr)->GetData();
- n; ++ppHtArray, --n )
- {
- if ( *ppHtArray )
- {
- if( **ppHtArray == rItem )
- {
- AddRef( **ppHtArray );
- return **ppHtArray;
- }
- }
- else
- if ( !ppFree )
- ppFree = ppHtArray;
- }
- }
- else
- {
- // freien Platz suchen
- SfxPoolItem** ppHtArr;
- USHORT n, nCount = (*ppItemArr)->Count();
- for ( n = (*ppItemArr)->nFirstFree,
- ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData() + n;
- n < nCount;
- ++ppHtArr, ++n )
- if ( !*ppHtArr )
- {
- ppFree = ppHtArr;
- break;
- }
-
- // naechstmoeglichen freien Platz merken
- (*ppItemArr)->nFirstFree = n;
- }
-
- // nicht vorhanden, also im PtrArray eintragen
- SfxPoolItem* pNewItem = rItem.Clone(pMaster);
- pNewItem->SetWhich(nWhich);
-#ifdef DBG_UTIL
- SFX_ASSERT( rItem.Type() == pNewItem->Type(), nWhich, "unequal types in Put(): no Clone()?" )
-#ifdef TF_POOLABLE
- if ( !rItem.ISA(SfxSetItem) )
- {
- SFX_ASSERT( !IsItemFlag(nWhich, SFX_ITEM_POOLABLE) ||
- rItem == *pNewItem,
- nWhich, "unequal items in Put(): no operator==?" );
- SFX_ASSERT( !IsItemFlag(*pNewItem, SFX_ITEM_POOLABLE) ||
- *pNewItem == rItem,
- nWhich, "unequal items in Put(): no operator==?" );
- }
-#endif
-#endif
- AddRef( *pNewItem, pImp->nInitRefCount );
- const SfxPoolItem* pTemp = pNewItem;
- if ( !ppFree )
- (*ppItemArr)->Insert( pTemp, (*ppItemArr)->Count() );
- else
- {
- DBG_ASSERT( *ppFree == 0, "using surrogate in use" );
- *ppFree = pNewItem;
- }
- return *pNewItem;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::Remove( const SfxPoolItem& rItem )
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- DBG_ASSERT( !rItem.ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem&)rItem).GetItemSet(),
- "SetItem without ItemSet" );
-
- SFX_ASSERT( !IsPoolDefaultItem(&rItem), rItem.Which(),
- "wo kommt denn hier ein Pool-Default her" );
-
- // richtigen Secondary-Pool finden
- const USHORT nWhich = rItem.Which();
- BOOL bSID = nWhich > SFX_WHICH_MAX;
- if ( !bSID && !IsInRange(nWhich) )
- {
- if ( pSecondary )
- {
- pSecondary->Remove( rItem );
- return;
- }
- DBG_ERROR( "unknown Which-Id - cannot remove item" );
- }
-
- // SID oder nicht poolable (neue Definition)?
- USHORT nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich);
- if ( bSID || IsItemFlag_Impl( nIndex, SFX_ITEM_NOT_POOLABLE ) )
- {
- SFX_ASSERT( USHRT_MAX != nIndex ||
- !IsDefaultItem(&rItem), rItem.Which(),
- "ein nicht Pool-Item ist Default?!" );
- if ( 0 == ReleaseRef(rItem) )
- {
- SfxPoolItem *pItem = &(SfxPoolItem &)rItem;
- delete pItem;
- }
- return;
- }
-
- SFX_ASSERT( rItem.GetRefCount(), rItem.Which(), "RefCount == 0, Remove unmoeglich" );
-
- // statische Defaults sind eben einfach da
- if ( rItem.GetKind() == SFX_ITEMS_STATICDEFAULT &&
- &rItem == *( ppStaticDefaults + GetIndex_Impl(nWhich) ) )
- return;
-
- // Item im eigenen Pool suchen
- SfxPoolItemArray_Impl** ppItemArr = (pImp->ppPoolItems + nIndex);
- SFX_ASSERT( *ppItemArr, rItem.Which(), "removing Item not in Pool" );
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT n = (*ppItemArr)->Count(); n; ++ppHtArr, --n )
- if( *ppHtArr == &rItem )
- {
- if ( (*ppHtArr)->GetRefCount() ) //!
- ReleaseRef( **ppHtArr );
- else
- {
- SFX_ASSERT( 0, rItem.Which(), "removing Item without ref" );
- SFX_TRACE( "to be removed, but not no refs: ", *ppHtArr );
- }
-
- // ggf. kleinstmoegliche freie Position merken
- USHORT nPos = (*ppItemArr)->Count() - n;
- if ( (*ppItemArr)->nFirstFree > nPos )
- (*ppItemArr)->nFirstFree = nPos;
-
- //! MI: Hack, solange wir das Problem mit dem Outliner haben
- //! siehe anderes MI-REF
- if ( 0 == (*ppHtArr)->GetRefCount() && nWhich < 4000 )
- DELETEZ(*ppHtArr);
- return;
- }
-
- // nicht vorhanden
- SFX_ASSERT( 0, rItem.Which(), "removing Item not in Pool" );
- SFX_TRACE( "to be removed, but not in pool: ", &rItem );
-}
-
-// -----------------------------------------------------------------------
-
-const SfxPoolItem& SfxItemPool::GetDefaultItem( USHORT nWhich ) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- if ( !IsInRange(nWhich) )
- {
- if ( pSecondary )
- return pSecondary->GetDefaultItem( nWhich );
- SFX_ASSERT( 0, nWhich, "unknown which - dont ask me for defaults" );
- }
-
- DBG_ASSERT( ppStaticDefaults, "no defaults known - dont ask me for defaults" );
- USHORT nPos = GetIndex_Impl(nWhich);
- SfxPoolItem *pDefault = *(ppPoolDefaults + nPos);
- if ( pDefault )
- return *pDefault;
- return **(ppStaticDefaults + nPos);
-}
-
-// -----------------------------------------------------------------------
-
-
-void SfxItemPool::FreezeIdRanges()
-
-/* [Beschreibung]
-
- This method should be called at the master pool, when all secondary
- pools are appended to it.
-
- It calculates the ranges of 'which-ids' for fast construction of
- item-sets, which contains all 'which-ids'.
-*/
-
-{
- FillItemIdRanges_Impl( _pPoolRanges );
-}
-
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::FillItemIdRanges_Impl( USHORT*& pWhichRanges ) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- DBG_ASSERT( !_pPoolRanges, "GetFrozenRanges() would be faster!" );
-
- const SfxItemPool *pPool;
- USHORT nLevel = 0;
- for( pPool = this; pPool; pPool = pPool->pSecondary )
- ++nLevel;
-
- pWhichRanges = new USHORT[ 2*nLevel + 1 ];
-
- nLevel = 0;
- for( pPool = this; pPool; pPool = pPool->pSecondary )
- {
- *(pWhichRanges+(nLevel++)) = pPool->nStart;
- *(pWhichRanges+(nLevel++)) = pPool->nEnd;
- *(pWhichRanges+nLevel) = 0;
- }
-}
-
-// -----------------------------------------------------------------------
-
-const SfxPoolItem *SfxItemPool::GetItem(USHORT nWhich, USHORT nOfst) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- if ( !IsInRange(nWhich) )
- {
- if ( pSecondary )
- return pSecondary->GetItem( nWhich, nOfst );
- SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" );
- return 0;
- }
-
- // dflt-Attribut?
- if ( nOfst == SFX_ITEMS_STATICDEFAULT )
- return *(ppStaticDefaults + GetIndex_Impl(nWhich));
-
- SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich));
- if( pItemArr && nOfst < pItemArr->Count() )
- return (*pItemArr)[nOfst];
-
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetItemCount(USHORT nWhich) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- if ( !IsInRange(nWhich) )
- {
- if ( pSecondary )
- return pSecondary->GetItemCount( nWhich );
- SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot resolve surrogate" );
- return 0;
- }
-
- SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(nWhich));
- if ( pItemArr )
- return pItemArr->Count();
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetWhich( USHORT nSlotId, BOOL bDeep ) const
-{
- if ( !IsSlot(nSlotId) )
- return nSlotId;
-
-#ifdef TF_POOLABLE
- USHORT nCount = nEnd - nStart + 1;
- for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs )
- if ( pItemInfos[nOfs]._nSID == nSlotId )
- return nOfs + nStart;
-#else
- if ( pSlotIds )
- {
- USHORT nCount = nEnd - nStart + 1;
- for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs )
- if ( pSlotIds[nOfs] == nSlotId )
- return nOfs + nStart;
- }
-#endif
- if ( pSecondary && bDeep )
- return pSecondary->GetWhich(nSlotId);
- return nSlotId;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetSlotId( USHORT nWhich, BOOL bDeep ) const
-{
- if ( !IsWhich(nWhich) )
- return nWhich;
-
- if ( !IsInRange( nWhich ) )
- {
- if ( pSecondary && bDeep )
- return pSecondary->GetSlotId(nWhich);
- SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get slot-id" );
- return 0;
- }
-#ifdef TF_POOLABLE
-
- USHORT nSID = pItemInfos[nWhich - nStart]._nSID;
- return nSID ? nSID : nWhich;
-#else
- else if ( pSlotIds )
- return pSlotIds[nWhich - nStart];
- return nWhich;
-#endif
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetTrueWhich( USHORT nSlotId, BOOL bDeep ) const
-{
- if ( !IsSlot(nSlotId) )
- return 0;
-
-#ifdef TF_POOLABLE
- USHORT nCount = nEnd - nStart + 1;
- for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs )
- if ( pItemInfos[nOfs]._nSID == nSlotId )
- return nOfs + nStart;
-#else
- if ( pSlotIds )
- {
- USHORT nCount = nEnd - nStart + 1;
- for ( USHORT nOfs = 0; nOfs < nCount; ++nOfs )
- if ( pSlotIds[nOfs] == nSlotId )
- return nOfs + nStart;
- }
-#endif
- if ( pSecondary && bDeep )
- return pSecondary->GetTrueWhich(nSlotId);
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetTrueSlotId( USHORT nWhich, BOOL bDeep ) const
-{
- if ( !IsWhich(nWhich) )
- return 0;
-
- if ( !IsInRange( nWhich ) )
- {
- if ( pSecondary && bDeep )
- return pSecondary->GetTrueSlotId(nWhich);
- SFX_ASSERT( 0, nWhich, "unknown Which-Id - cannot get slot-id" );
- return 0;
- }
-#ifdef TF_POOLABLE
- return pItemInfos[nWhich - nStart]._nSID;
-#else
- else if ( pSlotIds )
- return pSlotIds[nWhich - nStart];
- else
- return 0;
-#endif
-}
-// -----------------------------------------------------------------------
-void SfxItemPool::SetFileFormatVersion( USHORT nFileFormatVersion )
-
-/* [Description]
-
- You must call this function to set the file format version after
- concatenating your secondary-pools but before you store any
- pool, itemset or item. Only set the version at the master pool,
- never at any secondary pool.
-*/
-
-{
- DBG_ASSERT( this == pMaster,
- "SfxItemPool::SetFileFormatVersion() but not a master pool" );
- for ( SfxItemPool *pPool = this; pPool; pPool = pPool->pSecondary )
- pPool->_nFileFormatVersion = nFileFormatVersion;
-}
-
-
diff --git a/svtools/source/items1/itemprop.cxx b/svtools/source/items1/itemprop.cxx
deleted file mode 100644
index 354e0a1441ba..000000000000
--- a/svtools/source/items1/itemprop.cxx
+++ /dev/null
@@ -1,506 +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: itemprop.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <svtools/itemprop.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/itemset.hxx>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <hash_map>
-/*************************************************************************
- UNO III Implementation
-*************************************************************************/
-using namespace com::sun::star;
-using namespace com::sun::star::beans;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::uno;
-using namespace ::rtl;
-/*-- 16.02.2009 10:03:55---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-
-struct equalOUString
-{
- bool operator()(const ::rtl::OUString& r1, const ::rtl::OUString& r2) const
- {
- return r1.equals( r2 );
- }
-};
-
-typedef ::std::hash_map< ::rtl::OUString,
- SfxItemPropertySimpleEntry,
- ::rtl::OUStringHash,
- equalOUString > SfxItemPropertyHashMap_t;
-
-class SfxItemPropertyMap_Impl : public SfxItemPropertyHashMap_t
-{
-public:
- mutable uno::Sequence< beans::Property > m_aPropSeq;
-
- SfxItemPropertyMap_Impl(){}
- SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource );
-};
-SfxItemPropertyMap_Impl::SfxItemPropertyMap_Impl( const SfxItemPropertyMap_Impl* pSource )
-{
- this->SfxItemPropertyHashMap_t::operator=( *pSource );
- m_aPropSeq = pSource->m_aPropSeq;
-}
-
-/*-- 16.02.2009 10:03:51---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMapEntry* pEntries ) :
- m_pImpl( new SfxItemPropertyMap_Impl )
-{
- while( pEntries->pName )
- {
- ::rtl::OUString sEntry(pEntries->pName, pEntries->nNameLen, RTL_TEXTENCODING_ASCII_US );
- (*m_pImpl) [ sEntry ] = pEntries;
- ++pEntries;
- }
-}
-/*-- 16.02.2009 12:46:41---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertyMap::SfxItemPropertyMap( const SfxItemPropertyMap* pSource ) :
- m_pImpl( new SfxItemPropertyMap_Impl( pSource->m_pImpl ) )
-{
-}
-/*-- 16.02.2009 10:03:51---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertyMap::~SfxItemPropertyMap()
-{
- delete m_pImpl;
-}
-/*-- 16.02.2009 10:03:51---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-const SfxItemPropertySimpleEntry* SfxItemPropertyMap::getByName( const ::rtl::OUString &rName ) const
-{
- SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
- if( aIter == m_pImpl->end() )
- return 0;
- return &aIter->second;
-}
-
-/*-- 16.02.2009 10:44:24---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-uno::Sequence<beans::Property> SfxItemPropertyMap::getProperties() const
-{
- if( !m_pImpl->m_aPropSeq.getLength() )
- {
- m_pImpl->m_aPropSeq.realloc( m_pImpl->size() );
- beans::Property* pPropArray = m_pImpl->m_aPropSeq.getArray();
- sal_uInt32 n = 0;
- SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin();
- while( aIt != m_pImpl->end() )
- //for ( const SfxItemPropertyMap *pMap = _pMap; pMap->pName; ++pMap )
- {
- const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
- pPropArray[n].Name = (*aIt).first;
- pPropArray[n].Handle = pEntry->nWID;
- if(pEntry->pType)
- pPropArray[n].Type = *pEntry->pType;
- pPropArray[n].Attributes =
- sal::static_int_cast< sal_Int16 >(pEntry->nFlags);
- n++;
- ++aIt;
- }
- }
-
- return m_pImpl->m_aPropSeq;
-}
-/*-- 16.02.2009 11:04:31---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-beans::Property SfxItemPropertyMap::getPropertyByName( const ::rtl::OUString rName ) const
- throw( beans::UnknownPropertyException )
-{
- SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
- if( aIter == m_pImpl->end() )
- throw UnknownPropertyException();
- const SfxItemPropertySimpleEntry* pEntry = &aIter->second;
- beans::Property aProp;
- aProp.Name = rName;
- aProp.Handle = pEntry->nWID;
- if(pEntry->pType)
- aProp.Type = *pEntry->pType;
- aProp.Attributes = sal::static_int_cast< sal_Int16 >(pEntry->nFlags);
- return aProp;
-}
-/*-- 16.02.2009 11:09:16---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_Bool SfxItemPropertyMap::hasPropertyByName( const ::rtl::OUString& rName ) const
-{
- SfxItemPropertyHashMap_t::const_iterator aIter = m_pImpl->find(rName);
- return aIter != m_pImpl->end();
-}
-/*-- 16.02.2009 11:25:14---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-void SfxItemPropertyMap::mergeProperties( const uno::Sequence< beans::Property >& rPropSeq )
-{
- const beans::Property* pPropArray = rPropSeq.getConstArray();
- sal_uInt32 nElements = rPropSeq.getLength();
- for( sal_uInt32 nElement = 0; nElement < nElements; ++nElement )
- {
- SfxItemPropertySimpleEntry aTemp(
- sal::static_int_cast< sal_Int16 >( pPropArray[nElement].Handle ), //nWID
- &pPropArray[nElement].Type, //pType
- pPropArray[nElement].Attributes, //nFlags
- 0 ); //nMemberId
- (*m_pImpl)[pPropArray[nElement].Name] = aTemp;
- }
-}
-/*-- 18.02.2009 12:04:42---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-PropertyEntryVector_t SfxItemPropertyMap::getPropertyEntries() const
-{
- PropertyEntryVector_t aRet;
- aRet.reserve(m_pImpl->size());
-
- SfxItemPropertyHashMap_t::const_iterator aIt = m_pImpl->begin();
- while( aIt != m_pImpl->end() )
- {
- const SfxItemPropertySimpleEntry* pEntry = &(*aIt).second;
- aRet.push_back( SfxItemPropertyNamedEntry( (*aIt).first, * pEntry ) );
- ++aIt;
- }
- return aRet;
-}
-/*-- 18.02.2009 15:11:06---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-sal_uInt32 SfxItemPropertyMap::getSize() const
-{
- return m_pImpl->size();
-}
-/*-- 16.02.2009 13:44:54---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertySet::~SfxItemPropertySet()
-{
-}
-/* -----------------------------21.02.00 11:26--------------------------------
-
- ---------------------------------------------------------------------------*/
-BOOL SfxItemPropertySet::FillItem(SfxItemSet&, USHORT, BOOL) const
-{
- return FALSE;
-}
-/* -----------------------------06.06.01 12:32--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
- const SfxItemSet& rSet, Any& rAny ) const
- throw(RuntimeException)
-{
- // get the SfxPoolItem
- const SfxPoolItem* pItem = 0;
- SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem );
- if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID )
- pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID);
- // return item values as uno::Any
- if(eState >= SFX_ITEM_DEFAULT && pItem)
- {
- pItem->QueryValue( rAny, rEntry.nMemberId );
- }
- else
- {
- SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID);
- if(FillItem(aSet, rEntry.nWID, TRUE))
- {
- const SfxPoolItem& rItem = aSet.Get(rEntry.nWID);
- rItem.QueryValue( rAny, rEntry.nMemberId );
- }
- else if(0 == (rEntry.nFlags & PropertyAttribute::MAYBEVOID))
- throw RuntimeException();
- }
-
-
- // convert general SfxEnumItem values to specific values
- if( rEntry.pType && TypeClass_ENUM == rEntry.pType->getTypeClass() &&
- rAny.getValueTypeClass() == TypeClass_LONG )
- {
- INT32 nTmp = *(INT32*)rAny.getValue();
- rAny.setValue( &nTmp, *rEntry.pType );
- }
-}
-/* -----------------------------06.06.01 12:32--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxItemPropertySet::getPropertyValue( const OUString &rName,
- const SfxItemSet& rSet, Any& rAny ) const
- throw(RuntimeException, UnknownPropertyException)
-{
- // detect which-id
- const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName );
- if ( !pEntry )
- throw UnknownPropertyException();
- getPropertyValue( *pEntry,rSet, rAny );
-}
-/* -----------------------------21.02.00 11:26--------------------------------
-
- ---------------------------------------------------------------------------*/
-Any SfxItemPropertySet::getPropertyValue( const OUString &rName,
- const SfxItemSet& rSet ) const
- throw(RuntimeException, UnknownPropertyException)
-{
- Any aVal;
- getPropertyValue( rName,rSet, aVal );
- return aVal;
-}
-/* -----------------------------15.11.00 14:46--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry& rEntry,
- const Any& aVal,
- SfxItemSet& rSet ) const
- throw(RuntimeException,
- IllegalArgumentException)
-{
- // get the SfxPoolItem
- const SfxPoolItem* pItem = 0;
- SfxPoolItem *pNewItem = 0;
- SfxItemState eState = rSet.GetItemState( rEntry.nWID, TRUE, &pItem );
- if(SFX_ITEM_SET != eState && SFX_WHICH_MAX > rEntry.nWID )
- pItem = &rSet.GetPool()->GetDefaultItem(rEntry.nWID);
- //maybe there's another way to find an Item
- if(eState < SFX_ITEM_DEFAULT)
- {
- SfxItemSet aSet(*rSet.GetPool(), rEntry.nWID, rEntry.nWID);
- if(FillItem(aSet, rEntry.nWID, FALSE))
- {
- const SfxPoolItem &rItem = aSet.Get(rEntry.nWID);
- pNewItem = rItem.Clone();
- }
- }
- if(!pNewItem && pItem)
- {
- pNewItem = pItem->Clone();
- }
- if(pNewItem)
- {
- if( !pNewItem->PutValue( aVal, rEntry.nMemberId ) )
- {
- DELETEZ(pNewItem);
- throw IllegalArgumentException();
- }
- // apply new item
- rSet.Put( *pNewItem, rEntry.nWID );
- delete pNewItem;
- }
-}
-/* -----------------------------21.02.00 11:26--------------------------------
-
- ---------------------------------------------------------------------------*/
-void SfxItemPropertySet::setPropertyValue( const OUString &rName,
- const Any& aVal,
- SfxItemSet& rSet ) const
- throw(RuntimeException,
- IllegalArgumentException,
- UnknownPropertyException)
-{
- const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName );
- if ( !pEntry )
- {
- throw UnknownPropertyException();
- }
- setPropertyValue(*pEntry, aVal, rSet);
-}
-/* -----------------------------21.02.00 11:26--------------------------------
-
- ---------------------------------------------------------------------------*/
-PropertyState SfxItemPropertySet::getPropertyState(const SfxItemPropertySimpleEntry& rEntry, const SfxItemSet& rSet) const
- throw()
-{
- PropertyState eRet = PropertyState_DIRECT_VALUE;
- USHORT nWhich = rEntry.nWID;
-
- // item state holen
- SfxItemState eState = rSet.GetItemState( nWhich, FALSE );
- // item-Wert als UnoAny zurueckgeben
- if(eState == SFX_ITEM_DEFAULT)
- eRet = PropertyState_DEFAULT_VALUE;
- else if(eState < SFX_ITEM_DEFAULT)
- eRet = PropertyState_AMBIGUOUS_VALUE;
- return eRet;
-}
-PropertyState SfxItemPropertySet::getPropertyState(
- const OUString& rName, const SfxItemSet& rSet) const
- throw(UnknownPropertyException)
-{
- PropertyState eRet = PropertyState_DIRECT_VALUE;
-
- // which-id ermitteln
- const SfxItemPropertySimpleEntry* pEntry = m_aMap.getByName( rName );
- if( !pEntry || !pEntry->nWID )
- {
- throw UnknownPropertyException();
- }
- USHORT nWhich = pEntry->nWID;
-
- // item holen
- const SfxPoolItem* pItem = 0;
- SfxItemState eState = rSet.GetItemState( nWhich, FALSE, &pItem );
- if(!pItem && nWhich != rSet.GetPool()->GetSlotId(nWhich))
- pItem = &rSet.GetPool()->GetDefaultItem(nWhich);
- // item-Wert als UnoAny zurueckgeben
- if(eState == SFX_ITEM_DEFAULT)
- eRet = PropertyState_DEFAULT_VALUE;
- else if(eState < SFX_ITEM_DEFAULT)
- eRet = PropertyState_AMBIGUOUS_VALUE;
- return eRet;
-}
-/* -----------------------------21.02.00 11:26--------------------------------
-
- ---------------------------------------------------------------------------*/
-Reference<XPropertySetInfo>
- SfxItemPropertySet::getPropertySetInfo() const
-{
- if( !m_xInfo.is() )
- m_xInfo = new SfxItemPropertySetInfo( &m_aMap );
- return m_xInfo;
-}
-/*-- 16.02.2009 13:49:25---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-struct SfxItemPropertySetInfo_Impl
-{
- SfxItemPropertyMap* m_pOwnMap;
-};
-/*-- 16.02.2009 13:49:24---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMap *pMap ) :
- m_pImpl( new SfxItemPropertySetInfo_Impl )
-{
- m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pMap );
-}
-/*-- 16.02.2009 13:49:25---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertySetInfo::SfxItemPropertySetInfo(const SfxItemPropertyMapEntry *pEntries ) :
- m_pImpl( new SfxItemPropertySetInfo_Impl )
-{
- m_pImpl->m_pOwnMap = new SfxItemPropertyMap( pEntries );
-}
-/* -----------------------------21.02.00 11:09--------------------------------
-
- ---------------------------------------------------------------------------*/
-Sequence< Property > SAL_CALL
- SfxItemPropertySetInfo::getProperties( )
- throw(RuntimeException)
-{
- return m_pImpl->m_pOwnMap->getProperties();
-}
-/*-- 16.02.2009 13:49:27---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-const SfxItemPropertyMap* SfxItemPropertySetInfo::getMap() const
-{
- return m_pImpl->m_pOwnMap;
-}
-
-/*-- 16.02.2009 12:43:36---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxItemPropertySetInfo::~SfxItemPropertySetInfo()
-{
- delete m_pImpl->m_pOwnMap;
- delete m_pImpl;
-}
-/* -----------------------------21.02.00 11:27--------------------------------
-
- ---------------------------------------------------------------------------*/
-Property SAL_CALL
- SfxItemPropertySetInfo::getPropertyByName( const ::rtl::OUString& rName )
- throw(UnknownPropertyException, RuntimeException)
-{
- return m_pImpl->m_pOwnMap->getPropertyByName( rName );
-}
-/* -----------------------------21.02.00 11:28--------------------------------
-
- ---------------------------------------------------------------------------*/
-sal_Bool SAL_CALL
- SfxItemPropertySetInfo::hasPropertyByName( const ::rtl::OUString& rName )
- throw(RuntimeException)
-{
- return m_pImpl->m_pOwnMap->hasPropertyByName( rName );
-}
-/* -----------------------------21.02.00 12:03--------------------------------
-
- ---------------------------------------------------------------------------*/
-SfxExtItemPropertySetInfo::SfxExtItemPropertySetInfo(
- const SfxItemPropertyMapEntry *pMap,
- const Sequence<Property>& rPropSeq ) :
- aExtMap( pMap )
-{
- aExtMap.mergeProperties( rPropSeq );
-}
-/*-- 16.02.2009 12:06:49---------------------------------------------------
-
- -----------------------------------------------------------------------*/
-SfxExtItemPropertySetInfo::~SfxExtItemPropertySetInfo()
-{
-}
-/* -----------------------------21.02.00 12:03--------------------------------
-
- ---------------------------------------------------------------------------*/
-Sequence< Property > SAL_CALL
- SfxExtItemPropertySetInfo::getProperties( ) throw(RuntimeException)
-{
- return aExtMap.getProperties();
-}
-/* -----------------------------21.02.00 12:03--------------------------------
-
- ---------------------------------------------------------------------------*/
-Property SAL_CALL
- SfxExtItemPropertySetInfo::getPropertyByName( const OUString& rPropertyName )
- throw(UnknownPropertyException, RuntimeException)
-{
- return aExtMap.getPropertyByName( rPropertyName );
-}
-/* -----------------------------21.02.00 12:03--------------------------------
-
- ---------------------------------------------------------------------------*/
-sal_Bool SAL_CALL
- SfxExtItemPropertySetInfo::hasPropertyByName( const OUString& rPropertyName )
- throw(RuntimeException)
-{
- return aExtMap.hasPropertyByName( rPropertyName );
-}
-
diff --git a/svtools/source/items1/itemset.cxx b/svtools/source/items1/itemset.cxx
deleted file mode 100644
index fee00dca854a..000000000000
--- a/svtools/source/items1/itemset.cxx
+++ /dev/null
@@ -1,2128 +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: itemset.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <string.h>
-
-#if STLPORT_VERSION>=321
-#include <cstdarg>
-#endif
-
-#ifndef GCC
-#endif
-
-#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
-
-#include <svtools/svstdarr.hxx>
-#include <svtools/itemset.hxx>
-#include <svtools/itempool.hxx>
-#include <svtools/itemiter.hxx>
-#include "whiter.hxx"
-#include <svtools/nranges.hxx>
-#include "whassert.hxx"
-
-#include <tools/stream.hxx>
-#include <tools/solar.h>
-
-// STATIC DATA -----------------------------------------------------------
-
-static const USHORT nInitCount = 10; // einzelne USHORTs => 5 Paare ohne '0'
-#ifdef DBG_UTIL
-static ULONG nRangesCopyCount = 0; // wie oft wurden Ranges kopiert
-#endif
-
-DBG_NAME(SfxItemSet)
-
-//========================================================================
-
-#define NUMTYPE USHORT
-#define SvNums SvUShorts
-#define SfxNumRanges SfxUShortRanges
-#include "nranges.cxx"
-#undef NUMTYPE
-#undef SvNums
-#undef SfxNumRanges
-
-#define NUMTYPE ULONG
-#define SvNums SvULongs
-#define SfxNumRanges SfxULongRanges
-#include "nranges.cxx"
-#undef NUMTYPE
-#undef SvNums
-#undef SfxNumRanges
-
-//========================================================================
-
-#ifdef DBG_UTIL
-
-
-const sal_Char *DbgCheckItemSet( const void* pVoid )
-{
- const SfxItemSet *pSet = (const SfxItemSet*) pVoid;
- SfxWhichIter aIter( *pSet );
- USHORT nCount = 0, n = 0;
- for ( USHORT nWh = aIter.FirstWhich(); nWh; nWh = aIter.NextWhich(), ++n )
- {
- const SfxPoolItem *pItem = pSet->_aItems[n];
- if ( pItem )
- {
- ++nCount;
- DBG_ASSERT( IsInvalidItem(pItem) ||
- pItem->Which() == 0 || pItem->Which() == nWh,
- "SfxItemSet: invalid which-id" );
- DBG_ASSERT( IsInvalidItem(pItem) || !pItem->Which() ||
- !SfxItemPool::IsWhich(pItem->Which()) ||
- pSet->GetPool()->IsItemFlag(nWh, SFX_ITEM_NOT_POOLABLE) ||
- SFX_ITEMS_NULL != pSet->GetPool()->GetSurrogate(pItem),
- "SfxItemSet: item in set which is not in pool" );
- }
-
- }
- DBG_ASSERT( pSet->_nCount == nCount, "wrong SfxItemSet::nCount detected" );
-
- return 0;
-}
-
-#endif
-// -----------------------------------------------------------------------
-
-SfxItemSet::SfxItemSet
-(
- SfxItemPool& rPool, /* der Pool, in dem die SfxPoolItems,
- welche in dieses SfxItemSet gelangen,
- aufgenommen werden sollen */
- BOOL
-#ifdef DBG_UTIL
-#ifdef SFX_ITEMSET_NO_DEFAULT_CTOR
-
- bTotalRanges /* komplette Pool-Ranges uebernehmen,
- muss auf TRUE gesetzt werden */
-#endif
-#endif
-)
-/* [Beschreibung]
-
- Konstruktor fuer ein SfxItemSet mit genau den Which-Bereichen, welche
- dem angegebenen <SfxItemPool> bekannt sind.
-
-
- [Anmerkung]
-
- F"ur Sfx-Programmierer ein derart konstruiertes SfxItemSet kann
- keinerlei Items mit Slot-Ids als Which-Werte aufnehmen!
-*/
-
-: _pPool( &rPool ),
- _pParent( 0 ),
- _nCount( 0 )
-{
- DBG_CTOR(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" );
- DBG( _pChildCountCtor; *_pChildCount(this) = 0 );
-// DBG_ASSERT( bTotalRanges || abs( &bTotalRanges - this ) < 1000,
-// "please use suitable ranges" );
-#ifdef DBG_UTIL
-#ifdef SFX_ITEMSET_NO_DEFAULT_CTOR
- if ( !bTotalRanges )
- *(int*)0 = 0; // GPF
-#endif
-#endif
-
- _pWhichRanges = (USHORT*) _pPool->GetFrozenIdRanges();
- DBG_ASSERT( _pWhichRanges, "don't create ItemSets with full range before FreezeIdRanges()" );
- if ( !_pWhichRanges )
- _pPool->FillItemIdRanges_Impl( _pWhichRanges );
-
- const USHORT nSize = TotalCount();
- _aItems = new const SfxPoolItem* [ nSize ];
- memset( (void*) _aItems, 0, nSize * sizeof( SfxPoolItem* ) );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemSet::SfxItemSet( SfxItemPool& rPool, USHORT nWhich1, USHORT nWhich2 ):
- _pPool( &rPool ),
- _pParent( 0 ),
- _nCount( 0 )
-{
- DBG_CTOR(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( nWhich1 <= nWhich2, "Ungueltiger Bereich" );
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" );
- DBG( _pChildCountCtor; *_pChildCount(this) = 0 );
-
- InitRanges_Impl(nWhich1, nWhich2);
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::InitRanges_Impl(USHORT nWh1, USHORT nWh2)
-{
- DBG_CHKTHIS(SfxItemSet, 0);
- _pWhichRanges = new USHORT[ 3 ];
- *(_pWhichRanges+0) = nWh1;
- *(_pWhichRanges+1) = nWh2;
- *(_pWhichRanges+2) = 0;
- const USHORT nRg = nWh2 - nWh1 + 1;
- _aItems = new const SfxPoolItem* [ nRg ];
- memset( (void*) _aItems, 0, nRg * sizeof( SfxPoolItem* ) );
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::InitRanges_Impl(va_list pArgs, USHORT nWh1, USHORT nWh2, USHORT nNull)
-{
- DBG_CHKTHIS(SfxItemSet, 0);
-
- USHORT nSize = InitializeRanges_Impl( _pWhichRanges, pArgs, nWh1, nWh2, nNull );
- _aItems = new const SfxPoolItem* [ nSize ];
- memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nSize );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemSet::SfxItemSet( SfxItemPool& rPool,
- USHORT_ARG nWh1, USHORT_ARG nWh2, USHORT_ARG nNull, ... ):
- _pPool( &rPool ),
- _pParent( 0 ),
- _pWhichRanges( 0 ),
- _nCount( 0 )
-{
- DBG_CTOR(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" );
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" );
- DBG( _pChildCountCtor; *_pChildCount(this) = 0 );
-
- if(!nNull)
- InitRanges_Impl(
- sal::static_int_cast< USHORT >(nWh1),
- sal::static_int_cast< USHORT >(nWh2));
- else {
- va_list pArgs;
- va_start( pArgs, nNull );
- InitRanges_Impl(
- pArgs, sal::static_int_cast< USHORT >(nWh1),
- sal::static_int_cast< USHORT >(nWh2),
- sal::static_int_cast< USHORT >(nNull));
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::InitRanges_Impl(const USHORT *pWhichPairTable)
-{
- DBG_CHKTHIS(SfxItemSet, 0);
- DBG_TRACE1("SfxItemSet: Ranges-CopyCount==%ul", ++nRangesCopyCount);
-
- USHORT nCnt = 0;
- const USHORT* pPtr = pWhichPairTable;
- while( *pPtr )
- {
- nCnt += ( *(pPtr+1) - *pPtr ) + 1;
- pPtr += 2;
- }
-
- _aItems = new const SfxPoolItem* [ nCnt ];
- memset( (void*) _aItems, 0, sizeof( SfxPoolItem* ) * nCnt );
-
- std::ptrdiff_t cnt = pPtr - pWhichPairTable +1;
- _pWhichRanges = new USHORT[ cnt ];
- memcpy( _pWhichRanges, pWhichPairTable, sizeof( USHORT ) * cnt );
-}
-
-
-// -----------------------------------------------------------------------
-
-SfxItemSet::SfxItemSet( SfxItemPool& rPool, const USHORT* pWhichPairTable ):
- _pPool( &rPool ),
- _pParent( 0 ),
- _pWhichRanges(0),
- _nCount( 0 )
-{
- DBG_CTOR(SfxItemSet, 0);
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" );
- DBG( _pChildCountCtor; *_pChildCount(this) = 0 );
-
- // pWhichPairTable == 0 ist f"ur das SfxAllEnumItemSet
- if ( pWhichPairTable )
- InitRanges_Impl(pWhichPairTable);
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemSet::SfxItemSet( const SfxItemSet& rASet ):
- _pPool( rASet._pPool ),
- _pParent( rASet._pParent ),
- _nCount( rASet._nCount )
-{
- DBG_CTOR(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" );
- DBG( _pChildCountCtor; *_pChildCount(this) = 0 );
- DBG( ++*_pChildCount(_pParent) );
-
- // errechne die Anzahl von Attributen
- USHORT nCnt = 0;
- USHORT* pPtr = rASet._pWhichRanges;
- while( *pPtr )
- {
- nCnt += ( *(pPtr+1) - *pPtr ) + 1;
- pPtr += 2;
- }
-
- _aItems = new const SfxPoolItem* [ nCnt ];
-
- // Attribute kopieren
- SfxItemArray ppDst = _aItems, ppSrc = rASet._aItems;
- for( USHORT n = nCnt; n; --n, ++ppDst, ++ppSrc )
- if ( 0 == *ppSrc || // aktueller Default?
- IsInvalidItem(*ppSrc) || // Dont Care?
- IsStaticDefaultItem(*ppSrc) ) // nicht zu poolende Defaults
- // einfach Pointer kopieren
- *ppDst = *ppSrc;
- else if ( _pPool->IsItemFlag( **ppSrc, SFX_ITEM_POOLABLE ) )
- {
- // einfach Pointer kopieren und Ref-Count erh"ohen
- *ppDst = *ppSrc;
- ( (SfxPoolItem*) (*ppDst) )->AddRef();
- }
- else if ( !(*ppSrc)->Which() )
- *ppDst = (*ppSrc)->Clone();
- else
- // !IsPoolable() => via Pool zuweisen
- *ppDst = &_pPool->Put( **ppSrc );
-
- // dann noch die Which Ranges kopieren
- DBG_TRACE1("SfxItemSet: Ranges-CopyCount==%ul", ++nRangesCopyCount);
- std::ptrdiff_t cnt = pPtr - rASet._pWhichRanges+1;
- _pWhichRanges = new USHORT[ cnt ];
- memcpy( _pWhichRanges, rASet._pWhichRanges, sizeof( USHORT ) * cnt);
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemSet::~SfxItemSet()
-{
- DBG_DTOR(SfxItemSet, DbgCheckItemSet);
-#ifdef DBG_UTIL
- DBG( DBG_ASSERT( 0 == *_pChildCount(this), "SfxItemSet: deleting parent-itemset" ) )
-#endif
-
- USHORT nCount = TotalCount();
- if( Count() )
- {
- SfxItemArray ppFnd = _aItems;
- for( USHORT nCnt = nCount; nCnt; --nCnt, ++ppFnd )
- if( *ppFnd && !IsInvalidItem(*ppFnd) )
- {
- if( !(*ppFnd)->Which() )
- delete (SfxPoolItem*) *ppFnd;
- else {
- // noch mehrer Referenzen vorhanden, also nur den
- // ReferenzCounter manipulieren
- if ( 1 < (*ppFnd)->GetRefCount() && !IsDefaultItem(*ppFnd) )
- (*ppFnd)->ReleaseRef();
- else
- if ( !IsDefaultItem(*ppFnd) )
- // aus dem Pool loeschen
- _pPool->Remove( **ppFnd );
- }
- }
- }
-
- // FIXME: could be delete[] (SfxPoolItem **)_aItems;
- delete[] _aItems;
- if ( _pWhichRanges != _pPool->GetFrozenIdRanges() )
- delete[] _pWhichRanges;
- _pWhichRanges = 0; // for invariant-testing
-
- DBG( --*_pChildCount(_pParent) );
- DBG( delete _pChildCount(this); _pChildCountDtor );
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemSet::ClearItem( USHORT nWhich )
-
-// einzelnes Item oder alle Items (nWhich==0) l"oschen
-
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- if( !Count() )
- return 0;
-
- USHORT nDel = 0;
- SfxItemArray ppFnd = _aItems;
-
- if( nWhich )
- {
- const USHORT* pPtr = _pWhichRanges;
- while( *pPtr )
- {
- // in diesem Bereich?
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // "uberhaupt gesetzt?
- ppFnd += nWhich - *pPtr;
- if( *ppFnd )
- {
- // wegen der Assertions ins Sub-Calls mu\s das hier sein
- --_nCount;
- const SfxPoolItem *pItemToClear = *ppFnd;
- *ppFnd = 0;
-
- if ( !IsInvalidItem(pItemToClear) )
- {
- if ( nWhich <= SFX_WHICH_MAX )
- {
- const SfxPoolItem& rNew = _pParent
- ? _pParent->Get( nWhich, TRUE )
- : _pPool->GetDefaultItem( nWhich );
-
- Changed( *pItemToClear, rNew );
- }
- if ( pItemToClear->Which() )
- _pPool->Remove( *pItemToClear );
- }
- ++nDel;
- }
-
- // gefunden => raus
- break;
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- }
- else
- {
- nDel = _nCount;
-
- USHORT* pPtr = _pWhichRanges;
- while( *pPtr )
- {
- for( nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
- if( *ppFnd )
- {
- // wegen der Assertions ins Sub-Calls mu\s das hier sein
- --_nCount;
- const SfxPoolItem *pItemToClear = *ppFnd;
- *ppFnd = 0;
-
- if ( !IsInvalidItem(pItemToClear) )
- {
- if ( nWhich <= SFX_WHICH_MAX )
- {
- const SfxPoolItem& rNew = _pParent
- ? _pParent->Get( nWhich, TRUE )
- : _pPool->GetDefaultItem( nWhich );
-
- Changed( *pItemToClear, rNew );
- }
-
- // #i32448#
- // Take care of disabled items, too.
- if(!pItemToClear->nWhich)
- {
- // item is disabled, delete it
- delete pItemToClear;
- }
- else
- {
- // remove item from pool
- _pPool->Remove( *pItemToClear );
- }
- }
- }
- pPtr += 2;
- }
- }
- return nDel;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::ClearInvalidItems( BOOL bHardDefault )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- USHORT* pPtr = _pWhichRanges;
- SfxItemArray ppFnd = _aItems;
- if ( bHardDefault )
- while( *pPtr )
- {
- for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
- if ( IsInvalidItem(*ppFnd) )
- *ppFnd = &_pPool->Put( _pPool->GetDefaultItem(nWhich) );
- pPtr += 2;
- }
- else
- while( *pPtr )
- {
- for( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
- if( IsInvalidItem(*ppFnd) )
- {
- *ppFnd = 0;
- --_nCount;
- }
- pPtr += 2;
- }
-}
-
-//------------------------------------------------------------------------
-
-
-void SfxItemSet::InvalidateAllItems()
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( !_nCount, "Es sind noch Items gesetzt" );
-
- memset( (void*)_aItems, -1, ( _nCount = TotalCount() ) * sizeof( SfxPoolItem*) );
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemState SfxItemSet::GetItemState( USHORT nWhich,
- BOOL bSrchInParent,
- const SfxPoolItem **ppItem ) const
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- // suche den Bereich in dem das Which steht:
- const SfxItemSet* pAktSet = this;
- SfxItemState eRet = SFX_ITEM_UNKNOWN;
- do
- {
- SfxItemArray ppFnd = pAktSet->_aItems;
- const USHORT* pPtr = pAktSet->_pWhichRanges;
- if (pPtr)
- {
- while ( *pPtr )
- {
- if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // in diesem Bereich
- ppFnd += nWhich - *pPtr;
- if ( !*ppFnd )
- {
- eRet = SFX_ITEM_DEFAULT;
- if( !bSrchInParent )
- return eRet; // nicht vorhanden
- break; // JP: in den Parents weitersuchen !!!
- }
-
- if ( (SfxPoolItem*) -1 == *ppFnd )
- // Unterschiedlich vorhanden
- return SFX_ITEM_DONTCARE;
-
- if ( (*ppFnd)->Type() == TYPE(SfxVoidItem) )
- return SFX_ITEM_DISABLED;
-
- if (ppItem)
- {
- #ifdef DBG_UTIL
- const SfxPoolItem *pItem = *ppFnd;
- DBG_ASSERT( !pItem->ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem*)pItem)->GetItemSet(),
- "SetItem without ItemSet" );
- #endif
- *ppItem = *ppFnd;
- }
- return SFX_ITEM_SET;
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- }
- } while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent ));
- return eRet;
-}
-
-// -----------------------------------------------------------------------
-
-const SfxPoolItem* SfxItemSet::Put( const SfxPoolItem& rItem, USHORT nWhich )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( !rItem.ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem&)rItem).GetItemSet(),
- "SetItem without ItemSet" );
- if ( !nWhich )
- return 0; //! nur wegen Outliner-Bug
- SfxItemArray ppFnd = _aItems;
- const USHORT* pPtr = _pWhichRanges;
- while( *pPtr )
- {
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // in diesem Bereich
- ppFnd += nWhich - *pPtr;
- if( *ppFnd ) // schon einer vorhanden
- {
- // selbes Item bereits vorhanden?
- if ( *ppFnd == &rItem )
- return 0;
-
- // wird dontcare oder disabled mit was echtem ueberschrieben?
- if ( rItem.Which() && ( IsInvalidItem(*ppFnd) || !(*ppFnd)->Which() ) )
- {
- *ppFnd = &_pPool->Put( rItem, nWhich );
- return *ppFnd;
- }
-
- // wird disabled?
- if( !rItem.Which() )
- {
- *ppFnd = rItem.Clone(_pPool);
- return 0;
- }
- else
- {
- // selber Wert bereits vorhanden?
- if ( rItem == **ppFnd )
- return 0;
-
- // den neuen eintragen, den alten austragen
- const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich );
- const SfxPoolItem* pOld = *ppFnd;
- *ppFnd = &rNew;
- if(nWhich <= SFX_WHICH_MAX)
- Changed( *pOld, rNew );
- _pPool->Remove( *pOld );
- }
- }
- else
- {
- ++_nCount;
- if( !rItem.Which() )
- *ppFnd = rItem.Clone(_pPool);
- else {
- const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich );
- *ppFnd = &rNew;
- if (nWhich <= SFX_WHICH_MAX )
- {
- const SfxPoolItem& rOld = _pParent
- ? _pParent->Get( nWhich, TRUE )
- : _pPool->GetDefaultItem( nWhich );
- Changed( rOld, rNew );
- }
- }
- }
- SFX_ASSERT( !_pPool->IsItemFlag(nWhich, SFX_ITEM_POOLABLE) ||
- rItem.ISA(SfxSetItem) || **ppFnd == rItem,
- nWhich, "putted Item unequal" );
- return *ppFnd;
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxItemSet::Put( const SfxItemSet& rSet, BOOL bInvalidAsDefault )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- BOOL bRet = FALSE;
- if( rSet.Count() )
- {
- SfxItemArray ppFnd = rSet._aItems;
- const USHORT* pPtr = rSet._pWhichRanges;
- while ( *pPtr )
- {
- for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
- if( *ppFnd )
- {
- if ( IsInvalidItem( *ppFnd ) )
- {
- if ( bInvalidAsDefault )
- bRet |= 0 != ClearItem( nWhich );
- // gab GPF bei non.WIDs:
- // bRet |= 0 != Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich );
- else
- InvalidateItem( nWhich );
- }
- else
- bRet |= 0 != Put( **ppFnd, nWhich );
- }
- pPtr += 2;
- }
- }
- return bRet;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::PutExtended
-(
- const SfxItemSet& rSet, // Quelle der zu puttenden Items
- SfxItemState eDontCareAs, // was mit DontCare-Items passiert
- SfxItemState eDefaultAs // was mit Default-Items passiert
-)
-
-/* [Beschreibung]
-
- Diese Methode "ubernimmt die Items aus 'rSet' in '*this'. Die
- Which-Bereiche in '*this', die in 'rSet' nicht vorkommen bleiben unver-
- "andert. Der Which-Bereich von '*this' bleibt auch unver"andert.
-
- In 'rSet' gesetzte Items werden auch in '*this*' gesetzt. Default-
- (0 Pointer) und Invalid- (-1 Pointer) Items werden je nach Parameter
- ('eDontCareAs' und 'eDefaultAs' behandelt:
-
- SFX_ITEM_SET: hart auf Default des Pools gesetzt
- SFX_ITEM_DEFAULT: gel"oscht (0 Pointer)
- SFX_ITEM_DONTCARE: invalidiert (-1 Pointer)
-
- Alle anderen Werte f"ur 'eDontCareAs' und 'eDefaultAs' sind ung"ultig.
-*/
-
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
-
- // don't "optimize" with "if( rSet.Count()" because of dont-care + defaults
- SfxItemArray ppFnd = rSet._aItems;
- const USHORT* pPtr = rSet._pWhichRanges;
- while ( *pPtr )
- {
- for ( USHORT nWhich = *pPtr; nWhich <= *(pPtr+1); ++nWhich, ++ppFnd )
- if( *ppFnd )
- {
- if ( IsInvalidItem( *ppFnd ) )
- {
- // Item ist DontCare:
- switch ( eDontCareAs )
- {
- case SFX_ITEM_SET:
- Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich );
- break;
-
- case SFX_ITEM_DEFAULT:
- ClearItem( nWhich );
- break;
-
- case SFX_ITEM_DONTCARE:
- InvalidateItem( nWhich );
- break;
-
- default:
- DBG_ERROR( "invalid Argument for eDontCareAs" );
- }
- }
- else
- // Item ist gesetzt:
- Put( **ppFnd, nWhich );
- }
- else
- {
- // Item ist Default:
- switch ( eDefaultAs )
- {
- case SFX_ITEM_SET:
- Put( rSet.GetPool()->GetDefaultItem(nWhich), nWhich );
- break;
-
- case SFX_ITEM_DEFAULT:
- ClearItem( nWhich );
- break;
-
- case SFX_ITEM_DONTCARE:
- InvalidateItem( nWhich );
- break;
-
- default:
- DBG_ERROR( "invalid Argument for eDefaultAs" );
- }
- }
- pPtr += 2;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::MergeRange( USHORT nFrom, USHORT nTo )
-/** <H3>Description</H3>
-
- Expands the ranges of settable items by 'nFrom' to 'nTo'. Keeps state of
- items which are new ranges too.
-*/
-
-{
- // special case: exactly one USHORT which is already included?
- if ( nFrom == nTo && SFX_ITEM_AVAILABLE <= GetItemState(nFrom, FALSE) )
- return;
-
- // merge new range
- SfxUShortRanges aRanges( _pWhichRanges );
- aRanges += SfxUShortRanges( nFrom, nTo );
- SetRanges( aRanges );
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::SetRanges( const USHORT *pNewRanges )
-
-/** <H3>Description</H3>
-
- Modifies the ranges of settable items. Keeps state of items which
- are new ranges too.
-*/
-
-{
- // identische Ranges?
- if ( _pWhichRanges == pNewRanges )
- return;
- const USHORT* pOld = _pWhichRanges;
- const USHORT* pNew = pNewRanges;
- while ( *pOld == *pNew )
- {
- if ( !*pOld && !*pNew )
- return;
- ++pOld, ++pNew;
- }
-
- // create new item-array (by iterating through all new ranges)
- ULONG nSize = Capacity_Impl(pNewRanges);
- SfxItemArray aNewItems = new const SfxPoolItem* [ nSize ];
- USHORT n = 0, nNewCount = 0;
- if ( _nCount == 0 )
- memset( aNewItems, 0, nSize * sizeof( SfxPoolItem* ) );
- else
- {
- for ( const USHORT *pRange = pNewRanges; *pRange; pRange += 2 )
- {
- // iterate through all ids in the range
- for ( USHORT nWID = *pRange; nWID <= pRange[1]; ++nWID, ++n )
- {
- // direct move of pointer (not via pool)
- SfxItemState eState = GetItemState( nWID, FALSE, aNewItems+n );
- if ( SFX_ITEM_SET == eState )
- {
- // increment new item count and possibly increment ref count
- ++nNewCount;
- aNewItems[n]->AddRef();
- }
- else if ( SFX_ITEM_DISABLED == eState )
- {
- // put "disabled" item
- ++nNewCount;
- aNewItems[n] = new SfxVoidItem(0);
- }
- else if ( SFX_ITEM_DONTCARE == eState )
- {
- ++nNewCount;
- aNewItems[n] = (SfxPoolItem*)-1;
- }
- else
- {
- // default
- aNewItems[n] = 0;
- }
- }
- }
- // free old items
- USHORT nOldTotalCount = TotalCount();
- for ( USHORT nItem = 0; nItem < nOldTotalCount; ++nItem )
- {
- const SfxPoolItem *pItem = _aItems[nItem];
- if ( pItem && !IsInvalidItem(pItem) && pItem->Which() )
- _pPool->Remove(*pItem);
- }
- }
-
- // replace old items-array and ranges
- delete[] _aItems;
- _aItems = aNewItems;
- _nCount = nNewCount;
-
- if( pNewRanges == GetPool()->GetFrozenIdRanges() )
- {
- delete[] _pWhichRanges;
- _pWhichRanges = ( USHORT* ) pNewRanges;
- }
- else
- {
- USHORT nCount = Count_Impl(pNewRanges) + 1;
- if ( _pWhichRanges != _pPool->GetFrozenIdRanges() )
- delete[] _pWhichRanges;
- _pWhichRanges = new USHORT[ nCount ];
- memcpy( _pWhichRanges, pNewRanges, sizeof( USHORT ) * nCount );
- }
-}
-
-// -----------------------------------------------------------------------
-
-int SfxItemSet::Set
-(
- const SfxItemSet& rSet, /* das SfxItemSet, dessen SfxPoolItems
- "ubernommen werden sollen */
-
- BOOL bDeep /* TRUE (default)
- auch die SfxPoolItems aus den ggf. an
- rSet vorhandenen Parents werden direkt
- in das SfxItemSet "ubernommen
-
- FALSE
- die SfxPoolItems aus den Parents von
- rSet werden nicht ber"ucksichtigt */
-)
-
-/* [Beschreibung]
-
- Das SfxItemSet nimmt genau die SfxPoolItems an, die auch in
- rSet gesetzt sind und im eigenen <Which-Bereich> liegen. Alle
- anderen werden entfernt. Der SfxItemPool wird dabei beibehalten,
- so da"s die "ubernommenen SfxPoolItems dabei ggf. vom SfxItemPool
- von rSet in den SfxItemPool von *this "ubernommen werden.
-
- SfxPoolItems, f"ur die in rSet IsInvalidItem() == TRUE gilt,
- werden als Invalid-Item "ubernommen.
-
-
- [R"uckgabewert]
-
- int TRUE
- es wurden SfxPoolItems "ubernommen
-
- FALSE
- es wurden keine SfxPoolItems "ubernommen,
- da z.B. die Which-Bereiche der SfxItemSets
- keine Schnittmenge haben oder in der
- Schnittmenge keine SfxPoolItems in rSet
- gesetzt sind
-
-*/
-
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- int bRet = FALSE;
- if ( _nCount )
- ClearItem();
- if ( bDeep )
- {
- SfxWhichIter aIter(*this);
- USHORT nWhich = aIter.FirstWhich();
- while ( nWhich )
- {
- const SfxPoolItem* pItem;
- if( SFX_ITEM_SET == rSet.GetItemState( nWhich, TRUE, &pItem ) )
- bRet |= 0 != Put( *pItem, pItem->Which() );
- nWhich = aIter.NextWhich();
- }
- }
- else
- bRet = Put(rSet, FALSE);
-
- return bRet;
-}
-
-//------------------------------------------------------------------------
-
-const SfxPoolItem* SfxItemSet::GetItem
-(
- USHORT nId, // Slot-Id oder Which-Id des Items
- BOOL bSrchInParent, // TRUE: auch in Parent-ItemSets suchen
- TypeId aItemType // != 0 => RTTI Pruefung mit Assertion
-) const
-
-/* [Beschreibung]
-
- Mit dieser Methode wird der Zugriff auf einzelne Items im
- SfxItemSet wesentlich vereinfacht. Insbesondere wird die Typpr"ufung
- (per Assertion) durchgef"uhrt, wodurch die Applikations-Sourcen
- wesentlich "ubersichtlicher werden. In der PRODUCT-Version wird
- eine 0 zur"uckgegeben, wenn das gefundene Item nicht von der
- angegebenen Klasse ist. Ist kein Item mit der Id 'nWhich' in dem ItemSet,
- so wird 0 zurueckgegeben.
-*/
-
-{
- // ggf. in Which-Id umrechnen
- USHORT nWhich = GetPool()->GetWhich(nId);
-
- // ist das Item gesetzt oder bei bDeep==TRUE verf"ugbar?
- const SfxPoolItem *pItem = 0;
- SfxItemState eState = GetItemState( nWhich, bSrchInParent, &pItem );
- if ( bSrchInParent && SFX_ITEM_AVAILABLE == eState &&
- nWhich <= SFX_WHICH_MAX )
- pItem = &_pPool->GetDefaultItem(nWhich);
- if ( pItem )
- {
- // stimmt der Typ "uberein?
- if ( !aItemType || pItem->IsA(aItemType) )
- return pItem;
-
- // sonst Fehler melden
- DBG_ERROR( "invalid argument type" );
- }
-
- // kein Item gefunden oder falschen Typ gefunden
- return 0;
-}
-
-
-//------------------------------------------------------------------------
-
-
-const SfxPoolItem& SfxItemSet::Get( USHORT nWhich, BOOL bSrchInParent) const
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- // suche den Bereich in dem das Which steht:
- const SfxItemSet* pAktSet = this;
- do
- {
- if( pAktSet->Count() )
- {
- SfxItemArray ppFnd = pAktSet->_aItems;
- const USHORT* pPtr = pAktSet->_pWhichRanges;
- while( *pPtr )
- {
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // in diesem Bereich
- ppFnd += nWhich - *pPtr;
- if( *ppFnd )
- {
- if( (SfxPoolItem*)-1 == *ppFnd ) {
- //?MI: folgender code ist Doppelt (unten)
- SFX_ASSERT(_pPool, nWhich, "kein Pool, aber Status uneindeutig");
- //!((SfxAllItemSet *)this)->aDefault.SetWhich(nWhich);
- //!return aDefault;
- return _pPool->GetDefaultItem( nWhich );
- }
-#ifdef DBG_UTIL
- const SfxPoolItem *pItem = *ppFnd;
- DBG_ASSERT( !pItem->ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem*)pItem)->GetItemSet(),
- "SetItem without ItemSet" );
- if ( pItem->ISA(SfxVoidItem) || !pItem->Which() )
- DBG_WARNING( "SFX_WARNING: Getting disabled Item" );
-#endif
- return **ppFnd;
- }
- break; // dann beim Parent suchen
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- }
-// bis zum Ende vom Such-Bereich: was nun ? zum Parent, oder Default ??
-// if( !*pPtr ) // bis zum Ende vom Such-Bereich ?
-// break;
- } while( bSrchInParent && 0 != ( pAktSet = pAktSet->_pParent ));
-
- // dann das Default vom Pool holen und returnen
- SFX_ASSERT(_pPool, nWhich, "kein Pool, aber Status uneindeutig");
- const SfxPoolItem *pItem = &_pPool->GetDefaultItem( nWhich );
- DBG_ASSERT( !pItem->ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem*)pItem)->GetItemSet(),
- "SetItem without ItemSet" );
- return *pItem;
-}
-
- // Notification-Callback
-// -----------------------------------------------------------------------
-
-void SfxItemSet::Changed( const SfxPoolItem&, const SfxPoolItem& )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemSet::TotalCount() const
-{
- DBG_CHKTHIS(SfxItemSet, 0); // wird im Ctor benutzt bevor vollst. init.
- USHORT nRet = 0;
- USHORT* pPtr = _pWhichRanges;
- while( *pPtr )
- {
- nRet += ( *(pPtr+1) - *pPtr ) + 1;
- pPtr += 2;
- }
- return nRet;
-}
-// -----------------------------------------------------------------------
-
-// behalte nur die Items, die auch in rSet enthalten sein (Wert egal)
-
-void SfxItemSet::Intersect( const SfxItemSet& rSet )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT(_pPool, "nicht implementiert ohne Pool");
- if( !Count() ) // gar keine gesetzt ?
- return;
-
- // loesche alle Items, die im rSet nicht mehr vorhanden sind
- if( !rSet.Count() )
- {
- ClearItem(); // alles loeschen
- return;
- }
-
- // teste mal, ob sich die Which-Bereiche unterscheiden.
- BOOL bEqual = TRUE;
- USHORT* pWh1 = _pWhichRanges;
- USHORT* pWh2 = rSet._pWhichRanges;
- USHORT nSize = 0;
-
- for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n )
- {
- if( *pWh1 != *pWh2 )
- {
- bEqual = FALSE;
- break;
- }
- if( n & 1 )
- nSize += ( *(pWh1) - *(pWh1-1) ) + 1;
- }
- bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen
-
- // sind die Bereiche identisch, ist es einfacher zu handhaben !
- if( bEqual )
- {
- SfxItemArray ppFnd1 = _aItems;
- SfxItemArray ppFnd2 = rSet._aItems;
-
- for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
- if( *ppFnd1 && !*ppFnd2 )
- {
- // aus dem Pool loeschen
- if( !IsInvalidItem( *ppFnd1 ) )
- {
- USHORT nWhich = (*ppFnd1)->Which();
- if(nWhich <= SFX_WHICH_MAX)
- {
- const SfxPoolItem& rNew = _pParent
- ? _pParent->Get( nWhich, TRUE )
- : _pPool->GetDefaultItem( nWhich );
-
- Changed( **ppFnd1, rNew );
- }
- _pPool->Remove( **ppFnd1 );
- }
- *ppFnd1 = 0;
- --_nCount;
- }
- }
- else
- {
- SfxItemIter aIter( *this );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( TRUE )
- {
- USHORT nWhich = IsInvalidItem( pItem )
- ? GetWhichByPos( aIter.GetCurPos() )
- : pItem->Which();
- if( 0 == rSet.GetItemState( nWhich, FALSE ) )
- ClearItem( nWhich ); // loeschen
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::Differentiate( const SfxItemSet& rSet )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- if( !Count() || !rSet.Count() ) // gar keine gesetzt ?
- return;
-
- // teste mal, ob sich die Which-Bereiche unterscheiden.
- BOOL bEqual = TRUE;
- USHORT* pWh1 = _pWhichRanges;
- USHORT* pWh2 = rSet._pWhichRanges;
- USHORT nSize = 0;
-
- for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n )
- {
- if( *pWh1 != *pWh2 )
- {
- bEqual = FALSE;
- break;
- }
- if( n & 1 )
- nSize += ( *(pWh1) - *(pWh1-1) ) + 1;
- }
- bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen
-
- // sind die Bereiche identisch, ist es einfacher zu handhaben !
- if( bEqual )
- {
- SfxItemArray ppFnd1 = _aItems;
- SfxItemArray ppFnd2 = rSet._aItems;
-
- for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
- if( *ppFnd1 && *ppFnd2 )
- {
- // aus dem Pool loeschen
- if( !IsInvalidItem( *ppFnd1 ) )
- {
- USHORT nWhich = (*ppFnd1)->Which();
- if(nWhich <= SFX_WHICH_MAX)
- {
- const SfxPoolItem& rNew = _pParent
- ? _pParent->Get( nWhich, TRUE )
- : _pPool->GetDefaultItem( nWhich );
-
- Changed( **ppFnd1, rNew );
- }
- _pPool->Remove( **ppFnd1 );
- }
- *ppFnd1 = 0;
- --_nCount;
- }
- }
- else
- {
- SfxItemIter aIter( *this );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- while( TRUE )
- {
- USHORT nWhich = IsInvalidItem( pItem )
- ? GetWhichByPos( aIter.GetCurPos() )
- : pItem->Which();
- if( SFX_ITEM_SET == rSet.GetItemState( nWhich, FALSE ) )
- ClearItem( nWhich ); // loeschen
- if( aIter.IsAtEnd() )
- break;
- pItem = aIter.NextItem();
- }
-
- }
-}
-
-// -----------------------------------------------------------------------
-/* Entscheidungstabelle fuer MergeValue[s]
-
-Grundsaetze:
- 1. Ist der Which-Wert im 1.Set "unknown", dann folgt niemals eine Aktion.
- 2. Ist der Which-Wert im 2.Set "unknown", dann gilt er als "default".
- 3. Es gelten fuer Vergleiche die Werte der "default"-Items.
-
-1.-Item 2.-Item Values bIgnoreDefs Remove Assign Add
-
-set set == FALSE - - -
-default set == FALSE - - -
-dontcare set == FALSE - - -
-unknown set == FALSE - - -
-set default == FALSE - - -
-default default == FALSE - - -
-dontcare default == FALSE - - -
-unknown default == FALSE - - -
-set dontcare == FALSE 1.-Item -1 -
-default dontcare == FALSE - -1 -
-dontcare dontcare == FALSE - - -
-unknown dontcare == FALSE - - -
-set unknown == FALSE 1.-Item -1 -
-default unknown == FALSE - - -
-dontcare unknown == FALSE - - -
-unknown unknown == FALSE - - -
-
-set set != FALSE 1.-Item -1 -
-default set != FALSE - -1 -
-dontcare set != FALSE - - -
-unknown set != FALSE - - -
-set default != FALSE 1.-Item -1 -
-default default != FALSE - - -
-dontcare default != FALSE - - -
-unknown default != FALSE - - -
-set dontcare != FALSE 1.-Item -1 -
-default dontcare != FALSE - -1 -
-dontcare dontcare != FALSE - - -
-unknown dontcare != FALSE - - -
-set unknown != FALSE 1.-Item -1 -
-default unknown != FALSE - - -
-dontcare unknown != FALSE - - -
-unknown unknown != FALSE - - -
-
-set set == TRUE - - -
-default set == TRUE - 2.-Item 2.-Item
-dontcare set == TRUE - - -
-unknown set == TRUE - - -
-set default == TRUE - - -
-default default == TRUE - - -
-dontcare default == TRUE - - -
-unknown default == TRUE - - -
-set dontcare == TRUE - - -
-default dontcare == TRUE - -1 -
-dontcare dontcare == TRUE - - -
-unknown dontcare == TRUE - - -
-set unknown == TRUE - - -
-default unknown == TRUE - - -
-dontcare unknown == TRUE - - -
-unknown unknown == TRUE - - -
-
-set set != TRUE 1.-Item -1 -
-default set != TRUE - 2.-Item 2.-Item
-dontcare set != TRUE - - -
-unknown set != TRUE - - -
-set default != TRUE - - -
-default default != TRUE - - -
-dontcare default != TRUE - - -
-unknown default != TRUE - - -
-set dontcare != TRUE 1.-Item -1 -
-default dontcare != TRUE - -1 -
-dontcare dontcare != TRUE - - -
-unknown dontcare != TRUE - - -
-set unknown != TRUE - - -
-default unknown != TRUE - - -
-dontcare unknown != TRUE - - -
-unknown unknown != TRUE - - -
-*/
-
-
-static void MergeItem_Impl( SfxItemPool *_pPool, USHORT &rCount,
- const SfxPoolItem **ppFnd1, const SfxPoolItem *pFnd2,
- BOOL bIgnoreDefaults )
-{
- DBG_ASSERT( ppFnd1 != 0, "Merging to 0-Item" );
-
- // 1. Item ist default?
- if ( !*ppFnd1 )
- {
- if ( IsInvalidItem(pFnd2) )
- // Entscheidungstabelle: default, dontcare, egal, egal
- *ppFnd1 = (SfxPoolItem*) -1;
-
- else if ( pFnd2 && !bIgnoreDefaults &&
- _pPool->GetDefaultItem(pFnd2->Which()) != *pFnd2 )
- // Entscheidungstabelle: default, set, !=, FALSE
- *ppFnd1 = (SfxPoolItem*) -1;
-
- else if ( pFnd2 && bIgnoreDefaults )
- // Entscheidungstabelle: default, set, egal, TRUE
- *ppFnd1 = &_pPool->Put( *pFnd2 );
-
- if ( *ppFnd1 )
- ++rCount;
- }
-
- // 1. Item ist gesetzt?
- else if ( !IsInvalidItem(*ppFnd1) )
- {
- if ( !pFnd2 )
- {
- // 2. Item ist default
- if ( !bIgnoreDefaults &&
- **ppFnd1 != _pPool->GetDefaultItem((*ppFnd1)->Which()) )
- {
- // Entscheidungstabelle: set, default, !=, FALSE
- _pPool->Remove( **ppFnd1 );
- *ppFnd1 = (SfxPoolItem*) -1;
- }
- }
- else if ( IsInvalidItem(pFnd2) )
- {
- // 2. Item ist dontcare
- if ( !bIgnoreDefaults ||
- **ppFnd1 != _pPool->GetDefaultItem( (*ppFnd1)->Which()) )
- {
- // Entscheidungstabelle: set, dontcare, egal, FALSE
- // oder: set, dontcare, !=, TRUE
- _pPool->Remove( **ppFnd1 );
- *ppFnd1 = (SfxPoolItem*) -1;
- }
- }
- else
- {
- // 2. Item ist gesetzt
- if ( **ppFnd1 != *pFnd2 )
- {
- // Entscheidungstabelle: set, set, !=, egal
- _pPool->Remove( **ppFnd1 );
- *ppFnd1 = (SfxPoolItem*) -1;
- }
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::MergeValues( const SfxItemSet& rSet, BOOL bIgnoreDefaults )
-{
- // Achtung!!! Bei Aenderungen/Bugfixes immer obenstehende Tabelle pflegen!
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( GetPool() == rSet.GetPool(), "MergeValues mit verschiedenen Pools" );
-
- // teste mal, ob sich die Which-Bereiche unterscheiden.
- BOOL bEqual = TRUE;
- USHORT* pWh1 = _pWhichRanges;
- USHORT* pWh2 = rSet._pWhichRanges;
- USHORT nSize = 0;
-
- for( USHORT n = 0; *pWh1 && *pWh2; ++pWh1, ++pWh2, ++n )
- {
- if( *pWh1 != *pWh2 )
- {
- bEqual = FALSE;
- break;
- }
- if( n & 1 )
- nSize += ( *(pWh1) - *(pWh1-1) ) + 1;
- }
- bEqual = *pWh1 == *pWh2; // auch die 0 abpruefen
-
- // sind die Bereiche identisch, ist es effizieter zu handhaben !
- if( bEqual )
- {
- SfxItemArray ppFnd1 = _aItems;
- SfxItemArray ppFnd2 = rSet._aItems;
-
- for( ; nSize; --nSize, ++ppFnd1, ++ppFnd2 )
- MergeItem_Impl( _pPool, _nCount, ppFnd1, *ppFnd2, bIgnoreDefaults );
- }
- else
- {
- SfxWhichIter aIter( rSet );
- register USHORT nWhich;
- while( 0 != ( nWhich = aIter.NextWhich() ) )
- {
- const SfxPoolItem* pItem = 0;
- rSet.GetItemState( nWhich, TRUE, &pItem );
- if( !pItem )
- {
- // nicht gesetzt, also default
- if ( !bIgnoreDefaults )
- MergeValue( rSet.GetPool()->GetDefaultItem( nWhich ), bIgnoreDefaults );
- }
- else if( IsInvalidItem( pItem ) )
- // dont care
- InvalidateItem( nWhich );
- else
- MergeValue( *pItem, bIgnoreDefaults );
- }
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::MergeValue( const SfxPoolItem& rAttr, BOOL bIgnoreDefaults )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- SfxItemArray ppFnd = _aItems;
- const USHORT* pPtr = _pWhichRanges;
- const USHORT nWhich = rAttr.Which();
- while( *pPtr )
- {
- // in diesem Bereich?
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- ppFnd += nWhich - *pPtr;
- MergeItem_Impl( _pPool, _nCount, ppFnd, &rAttr, bIgnoreDefaults );
- break;
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemSet::InvalidateItem( USHORT nWhich )
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- SfxItemArray ppFnd = _aItems;
- const USHORT* pPtr = _pWhichRanges;
- while( *pPtr )
- {
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // in diesem Bereich
- ppFnd += nWhich - *pPtr;
-
- if( *ppFnd ) // bei mir gesetzt
- {
- if( (SfxPoolItem*)-1 != *ppFnd ) // noch nicht dontcare !
- {
- _pPool->Remove( **ppFnd );
- *ppFnd = (SfxPoolItem*)-1;
- }
- }
- else
- {
- *ppFnd = (SfxPoolItem*)-1;
- ++_nCount;
- }
- break;
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemSet::GetWhichByPos( USHORT nPos ) const
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- USHORT n = 0;
- USHORT* pPtr = _pWhichRanges;
- while( *pPtr )
- {
- n = ( *(pPtr+1) - *pPtr ) + 1;
- if( nPos < n )
- return *(pPtr)+nPos;
- nPos = nPos - n;
- pPtr += 2;
- }
- DBG_ASSERT( FALSE, "Hier sind wir falsch" );
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream &SfxItemSet::Store
-(
- SvStream& rStream, // Zielstream f"ur normale Items
- FASTBOOL bDirect // TRUE: Items direkt speicher, FALSE: Surrogate
-) const
-
-/* [Beschreibung]
-
- Speichert die <SfxItemSet>-Instanz in den angegebenen Stream. Dabei
- werden die Surrorage der gesetzten <SfxPoolItem>s bzw. ('bDirect==TRUE')
- die gesetzten Items selbst wie folgt im Stream abgelegt:
-
- USHORT (Count) Anzahl der gesetzten Items
- Count* _pPool->StoreItem() siehe <SfxItemPool::StoreItem()const>
-
-
- [Querverweise]
-
- <SfxItemSet::Load(SvStream&,BOOL,const SfxItemPool*)>
-*/
-
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( _pPool, "Kein Pool" );
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "kein Master-Pool" );
-
- // Position des Counts merken, um ggf. zu korrigieren
- ULONG nCountPos = rStream.Tell();
- rStream << _nCount;
-
- // wenn nichts zu speichern ist, auch keinen ItemIter aufsetzen!
- if ( _nCount )
- {
- // mitz"ahlen wieviel Items tats"achlich gespeichert werden
- USHORT nWrittenCount = 0; // Anzahl in 'rStream' gestreamter Items
-
- // "uber alle gesetzten Items iterieren
- SfxItemIter aIter(*this);
- for ( const SfxPoolItem *pItem = aIter.FirstItem();
- pItem;
- pItem = aIter.NextItem() )
- {
- // Item (ggf. als Surrogat) via Pool speichern lassen
- DBG_ASSERT( !IsInvalidItem(pItem), "can't store invalid items" );
- if ( !IsInvalidItem(pItem) &&
- _pPool->StoreItem( rStream, *pItem, bDirect ) )
- // Item wurde in 'rStream' gestreamt
- ++nWrittenCount;
- };
-
- // weniger geschrieben als enthalten (z.B. altes Format)
- if ( nWrittenCount != _nCount )
- {
- // tats"achlichen Count im Stream ablegen
- ULONG nPos = rStream.Tell();
- rStream.Seek( nCountPos );
- rStream << nWrittenCount;
- rStream.Seek( nPos );
- }
- }
-
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream &SfxItemSet::Load
-(
- SvStream& rStream, // Stream, aus dem geladen werden soll
-
- FASTBOOL bDirect, /* TRUE
- Items werden direkt aus dem Stream
- gelesen, nicht "uber Surrogate
-
- FALSE (default)
- Items werden "uber Surrogate gelesen */
-
- const SfxItemPool* pRefPool /* Pool, der die Surrogate aufl"osen kann
- (z.B. zum Einf"ugen von Dokumenten) */
-)
-
-/* [Beschreibung]
-
- Diese Methode l"adt ein <SfxItemSet> aus einem Stream. Falls der
- <SfxItemPool> ohne Ref-Counts geladen wurde, werden die geladenen
- Item-Referenzen in den Items hochgez"ahlt, ansonsten wird vorausgesetzt,
- da\s sie schon beim Laden des SfxItemPools ber"ucksichtigt waren.
-
- [Querverweise]
-
- <SfxItemSet::Store(Stream&,BOOL)const>
-*/
-
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_ASSERT( _pPool, "Kein Pool");
- DBG_ASSERTWARNING( _pPool == _pPool->GetMasterPool(), "Kein Master-Pool");
-
- // kein Ref-Pool => Surrogate mit Pool des ItemSets aufl"osen
- if ( !pRefPool )
- pRefPool = _pPool;
-
- // Anzahl der zu ladenden Items laden und dann ebensoviele Items
- USHORT nCount = 0;
- rStream >> nCount;
- for ( USHORT i = 0; i < nCount; ++i )
- {
- // Surrogat/Item laden und (Surrogat) aufl"osen lassen
- const SfxPoolItem *pItem =
- _pPool->LoadItem( rStream, bDirect, pRefPool );
-
- // konnte ein Item geladen oder via Surrogat aufgel"ost werden?
- if ( pItem )
- {
- // Position f"ur Item-Pointer im Set suchen
- USHORT nWhich = pItem->Which();
- SfxItemArray ppFnd = _aItems;
- const USHORT* pPtr = _pWhichRanges;
- while ( *pPtr )
- {
- // in diesem Bereich?
- if ( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // Item-Pointer im Set merken
- ppFnd += nWhich - *pPtr;
- SFX_ASSERT( !*ppFnd, nWhich, "Item doppelt eingetragen");
- *ppFnd = pItem;
- ++_nCount;
- break;
- }
-
- // im Range-Array und Item-Array zum n"achsten Which-Range
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- }
- }
-
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxItemSet::operator==(const SfxItemSet &rCmp) const
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- DBG_CHKOBJ(&rCmp, SfxItemSet, DbgCheckItemSet);
-
- // besonders schnell zu ermittelnde Werte muessen gleich sein
- if ( _pParent != rCmp._pParent ||
- _pPool != rCmp._pPool ||
- Count() != rCmp.Count() )
- return FALSE;
-
- // Ranges durchzaehlen lassen dauert laenger, muss aber auch gleich sein
- USHORT nCount1 = TotalCount();
- USHORT nCount2 = rCmp.TotalCount();
- if ( nCount1 != nCount2 )
- return FALSE;
-
- // sind die Ranges selbst ungleich?
- for ( USHORT nRange = 0; _pWhichRanges[nRange]; nRange += 2 )
- if ( _pWhichRanges[nRange] != rCmp._pWhichRanges[nRange] ||
- _pWhichRanges[nRange+1] != rCmp._pWhichRanges[nRange+1] )
- {
- // dann m"ussen wir die langsame Methode verwenden
- SfxWhichIter aIter( *this );
- for ( USHORT nWh = aIter.FirstWhich();
- nWh;
- nWh = aIter.NextWhich() )
- {
- // wenn die Pointer von poolable Items ungleich sind,
- // muessen die Items gleich sein
- const SfxPoolItem *pItem1 = 0, *pItem2 = 0;
- if ( GetItemState( nWh, FALSE, &pItem1 ) !=
- rCmp.GetItemState( nWh, FALSE, &pItem2 ) ||
- ( pItem1 != pItem2 &&
- ( !pItem1 || IsInvalidItem(pItem1) ||
- ( _pPool->IsItemFlag(*pItem1, SFX_ITEM_POOLABLE) &&
- *pItem1 != *pItem2 ) ) ) )
- return FALSE;
- }
-
- return TRUE;
- }
-
- // Pointer alle gleich?
- if ( 0 == memcmp( _aItems, rCmp._aItems, nCount1 * sizeof(_aItems[0]) ) )
- return TRUE;
-
- // dann werden wir wohl alle einzeln vergleichen muessen
- const SfxPoolItem **ppItem1 = (const SfxPoolItem**) _aItems;
- const SfxPoolItem **ppItem2 = (const SfxPoolItem**) rCmp._aItems;
- for ( USHORT nPos = 0; nPos < nCount1; ++nPos )
- {
- // wenn die Pointer von poolable Items ungleich sind,
- // muessen die Items gleich sein
- if ( *ppItem1 != *ppItem2 &&
- ( ( !*ppItem1 || !*ppItem2 ) ||
- ( IsInvalidItem(*ppItem1) || IsInvalidItem(*ppItem2) ) ||
- ( _pPool->IsItemFlag(**ppItem1, SFX_ITEM_POOLABLE) ) ||
- **ppItem1 != **ppItem2 ) )
- return FALSE;
-
- ++ppItem1;
- ++ppItem2;
- }
-
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-SfxItemSet *SfxItemSet::Clone(BOOL bItems, SfxItemPool *pToPool ) const
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- if ( pToPool && pToPool != _pPool )
- {
- SfxItemSet *pNewSet = new SfxItemSet( *pToPool, _pWhichRanges );
- if ( bItems )
- {
- SfxWhichIter aIter(*pNewSet);
- USHORT nWhich = aIter.FirstWhich();
- while ( nWhich )
- {
- const SfxPoolItem* pItem;
- if ( SFX_ITEM_SET == GetItemState( nWhich, FALSE, &pItem ) )
- pNewSet->Put( *pItem, pItem->Which() );
- nWhich = aIter.NextWhich();
- }
- }
- return pNewSet;
- }
- else
- return bItems
- ? new SfxItemSet(*this)
- : new SfxItemSet(*_pPool, _pWhichRanges);
-}
-
-// -----------------------------------------------------------------------
-
-int SfxItemSet::PutDirect(const SfxPoolItem &rItem)
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- SfxItemArray ppFnd = _aItems;
- const USHORT* pPtr = _pWhichRanges;
- const USHORT nWhich = rItem.Which();
-#ifdef DBG_UTIL
- IsPoolDefaultItem(&rItem) || _pPool->GetSurrogate(&rItem);
- // nur Assertion in den callees provozieren
-#endif
- while( *pPtr )
- {
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // in diesem Bereich
- ppFnd += nWhich - *pPtr;
- const SfxPoolItem* pOld = *ppFnd;
- if( pOld ) // schon einer vorhanden
- {
- if( rItem == **ppFnd )
- return FALSE; // schon vorhanden !
- _pPool->Remove( *pOld );
- }
- else
- ++_nCount;
-
- // den neuen eintragen
- if( IsPoolDefaultItem(&rItem) )
- *ppFnd = &_pPool->Put( rItem );
- else
- {
- *ppFnd = &rItem;
- if( !IsStaticDefaultItem( &rItem ) )
- rItem.AddRef();
- }
-
- return TRUE;
- }
- ppFnd += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- return FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-SfxAllItemSet::SfxAllItemSet( SfxItemPool &rPool )
-: SfxItemSet(rPool, (const USHORT*) 0),
- aDefault(0),
- nFree(nInitCount)
-{
- // initial keine Items
- _aItems = 0;
-
- // nInitCount Paare an USHORTs fuer Ranges allozieren
- _pWhichRanges = new USHORT[ nInitCount + 1 ];
- memset( _pWhichRanges, 0, ( nInitCount + 1 ) * sizeof(USHORT) );
-}
-
-
-// -----------------------------------------------------------------------
-
-
-SfxAllItemSet::SfxAllItemSet(const SfxItemSet &rCopy)
-: SfxItemSet(rCopy),
- aDefault(0),
- nFree(0)
-{
-}
-
-// -----------------------------------------------------------------------
-
-
-
-SfxAllItemSet::SfxAllItemSet(const SfxAllItemSet &rCopy)
-: SfxItemSet(rCopy),
- aDefault(0),
- nFree(0)
-/* [Anmerkung]
-
- Der mu\s sein, da sonst vom Compiler einer generiert wird, er nimmt
- nicht den Ctor mit der 'const SfxItemSet&'!
-*/
-{
-}
-
-// -----------------------------------------------------------------------
-
-static USHORT *AddRanges_Impl(
- USHORT *pUS, std::ptrdiff_t nOldSize, USHORT nIncr)
-
-/* Diese interne Funktion erzeugt ein neues Which-Range-Array, welches von
- dem 'nOldSize'-USHORTs langen 'pUS' kopiert wird und hinten an Platz
- f"ur 'nIncr' neue USHORTs hat. Das terminierende USHORT mit der '0'
- wird weder in 'nOldSize' noch in 'nIncr' mitgez"ahlt, sondern implizit
- hinzugerechnet.
-
- Das neue Which-Range-Array wird als Returnwert zur"uckgegeben, das alte
- 'pUS' freigegeben.
-*/
-
-{
- // neues Which-Range-Array anlegen
- USHORT *pNew = new USHORT[ nOldSize + nIncr + 1 ];
-
- // die alten Ranges "ubernehmen
- memcpy( pNew, pUS, nOldSize * sizeof(USHORT) );
-
- // die neuen auf 0 initialisieren
- memset( pNew + nOldSize, 0, ( nIncr + 1 ) * sizeof(USHORT) );
-
- // das alte Array freigeben
- delete[] pUS;
-
- return pNew;
-}
-
-// -----------------------------------------------------------------------
-
-static SfxItemArray AddItem_Impl(SfxItemArray pItems, USHORT nOldSize, USHORT nPos)
-
-/* Diese interne Funktion erzeugt ein neues ItemArray, welches von 'pItems'
- kopiert wird, an der Position 'nPos' jedoch Platz f"ur einen neuen
- ItemPointer hat.
-
- Das neue ItemArray wird als Returnwert zur"uckgegeben, das alte 'pItems'
- wird freigegeben.
-*/
-
-{
- // neues ItemArray anlegen
- SfxItemArray pNew = new const SfxPoolItem*[nOldSize+1];
-
- // war schon vorher eins da?
- if ( pItems )
- {
- // alte Items vor nPos kopieren
- if ( nPos )
- memcpy( (void*) pNew, pItems, nPos * sizeof(SfxPoolItem **) );
-
- // alte Items hinter nPos kopieren
- if ( nPos < nOldSize )
- memcpy( (void*) (pNew + nPos + 1), pItems + nPos,
- (nOldSize-nPos) * sizeof(SfxPoolItem **) );
- }
-
- // neues Item initialisieren
- *(pNew + nPos) = 0;
-
- // altes ItemArray freigeben
- delete[] pItems;
-
- return pNew;
-}
-
-// -----------------------------------------------------------------------
-
-const SfxPoolItem* SfxAllItemSet::Put( const SfxPoolItem& rItem, USHORT nWhich )
-
-// Putten mit automatischer Erweiterung der Whichs-Ids um die ID
-// des Items.
-
-{
- USHORT nPos = 0; // Position f"ur 'rItem' in '_aItems'
- const USHORT nItemCount = TotalCount();
-
- // erstmal sehen, ob es schon einen passenden Bereich gibt
- USHORT *pPtr = _pWhichRanges;
- while ( *pPtr )
- {
- // Which-Id liegt in diesem Bereich?
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- // Einfuegen
- nPos += nWhich - *pPtr;
- break;
- }
-
- // Position des Items in _aItems mitf"uhren
- nPos += *(pPtr+1) - *pPtr + 1;
-
- // zum n"achsten Bereich
- pPtr += 2;
- }
-
- // Which-Id noch nicht vorhanden?
- if ( !*pPtr )
- {
- // suchen, ob man sie irgendwo dranpacken kann
- pPtr = _pWhichRanges;
- nPos = 0;
- while ( *pPtr )
- {
- // Which-Id liegt exakt vor diesem Bereich?
- if ( (nWhich+1) == *pPtr )
- {
- // Bereich waechst nach unten
- (*pPtr)--;
-
- // vor erstem Item dieses Bereichs Platz schaffen
- _aItems = AddItem_Impl(_aItems, nItemCount, nPos);
- break;
- }
-
- // Which-Id liegt exakt hinter diesem Bereich?
- else if ( (nWhich-1) == *(pPtr+1) )
- {
- // Bereich waechst nach oben
- (*(pPtr+1))++;
-
- // hinter letztem Item dieses Bereichs Platz schaffen
- nPos += nWhich - *pPtr;
- _aItems = AddItem_Impl(_aItems, nItemCount, nPos);
- break;
- }
-
- // Position des Items in _aItems mitf"uhren
- nPos += *(pPtr+1) - *pPtr + 1;
-
- // zum n"achsten Bereich
- pPtr += 2;
- }
- }
-
- // keinen erweiterbaren Bereich gefunden?
- if ( !*pPtr )
- {
- // kein Platz mehr in _pWhichRanges => erweitern
- std::ptrdiff_t nSize = pPtr - _pWhichRanges;
- if( !nFree )
- {
- _pWhichRanges = AddRanges_Impl(_pWhichRanges, nSize, nInitCount);
- nFree += nInitCount;
- }
-
- // neuen Which-Range anh"angen
- pPtr = _pWhichRanges + nSize;
- *pPtr++ = nWhich;
- *pPtr = nWhich;
- nFree -= 2;
-
- // Itemarray vergroessern
- nPos = nItemCount;
- _aItems = AddItem_Impl(_aItems, nItemCount, nPos);
- }
-
- // neues Item in Pool aufnehmen
- const SfxPoolItem& rNew = _pPool->Put( rItem, nWhich );
-
- // altes Item merken
- BOOL bIncrementCount = FALSE;
- const SfxPoolItem* pOld = *( _aItems + nPos );
- if ( reinterpret_cast< SfxPoolItem* >( -1 ) == pOld ) // state "dontcare"
- pOld = NULL;
- if ( !pOld )
- {
- bIncrementCount = TRUE;
- pOld = _pParent ?
- &_pParent->Get( nWhich, TRUE )
- : nWhich <= SFX_WHICH_MAX ? &_pPool->GetDefaultItem( nWhich ) : 0;
- }
-
- // neue Item in ItemSet aufnehmen
- *(_aItems + nPos) = &rNew;
-
- // Changed Notification versenden
- if ( pOld )
- {
- Changed( *pOld, rNew );
- if ( !IsDefaultItem(pOld) )
- _pPool->Remove( *pOld );
- }
-
- if ( bIncrementCount )
- ++_nCount;
-
- return &rNew;
-}
-
-// -----------------------------------------------------------------------
-
-
-/* Diese Methode wird forwarded, damit sie nicht durch die anderen
- Put-Methoden dieser SubClass gehided wird.
-*/
-
-int SfxAllItemSet::Put( const SfxItemSet& rSet, BOOL bInvalidAsDefault )
-{
- //? pruefen, ob Which-Ranges erweitert werden
- return SfxItemSet::Put( rSet, bInvalidAsDefault );
-}
-
-// -----------------------------------------------------------------------
-// Item disablen, wenn durch ein VoidItem mit dem Which-Wert 0 ausgedrueckt
-
-void SfxItemSet::DisableItem(USHORT nWhich)
-{
- DBG_CHKTHIS(SfxItemSet, 0);
- Put( SfxVoidItem(0), nWhich );
-}
-
-// -----------------------------------------------------------------------
-
-#if 0
-BOOL SfxAllItemSet::Remove(USHORT nWhich)
-{
- DBG_CHKTHIS(SfxAllItemSet, 0);
- USHORT *pPtr = _pWhichRanges;
- USHORT nPos = 0;
- while( *pPtr )
- {
- if( *pPtr <= nWhich && nWhich <= *(pPtr+1) )
- {
- USHORT *pTmp = pPtr;
- USHORT nLeft = 0;
- USHORT nRest = 0;
- while(*++pTmp){
- if( nLeft & 1 )
- nRest = *pTmp - *(pTmp-1) + 1;
- ++nLeft;
- }
-
- // in diesem Bereich
- nPos += nWhich - *pPtr;
- nRest -= nWhich - *pPtr;
- // 3,3
- if(*pPtr == nWhich && *(pPtr+1) == nWhich) {
- memmove(pPtr, pPtr + 2, nLeft * sizeof(USHORT));
- nFree += 2;
- }
- // Anfang
- else if(*pPtr == nWhich)
- (*pPtr)++;
- // Ende
- else if(*(pPtr+1) == nWhich)
- (*(pPtr+1))--;
- else {
- if(nPos + nRest + 2 > nFree) {
- USHORT nOf = pPtr - _pWhichRanges;
- _pWhichRanges = IncrSize(_pWhichRanges, nPos + nRest, nInitCount);
- nFree += nInitCount;
- pPtr = _pWhichRanges + nOf;
- }
- memmove(pPtr +2, pPtr, (nLeft+2) * sizeof(USHORT));
- *++pPtr = nWhich-1;
- *++pPtr = nWhich+1;
- nFree -= 2;
- }
- SfxPoolItem* pItem = *( _aItems + nPos );
- if( pItem )
- {
- if(_pPool)
- _pPool->Remove(*pItem );
- else
- delete pItem;
- --_nCount;
- }
- memmove(_aItems + nPos +1, _aItems + nPos,
- sizeof(SfxPoolItem *) * (nRest - 1));
- break; // dann beim Parent suchen
- }
- nPos += *(pPtr+1) - *pPtr + 1;
- pPtr += 2;
- }
- return *pPtr? TRUE: FALSE;
-}
-#endif
-
-// -----------------------------------------------------------------------
-
-SfxItemSet *SfxAllItemSet::Clone(BOOL bItems, SfxItemPool *pToPool ) const
-{
- DBG_CHKTHIS(SfxItemSet, DbgCheckItemSet);
- if ( pToPool && pToPool != _pPool )
- {
- SfxAllItemSet *pNewSet = new SfxAllItemSet( *pToPool );
- if ( bItems )
- pNewSet->Set( *this );
- return pNewSet;
- }
- else
- return bItems ? new SfxAllItemSet(*this) : new SfxAllItemSet(*_pPool);
-}
-
diff --git a/svtools/source/items1/lckbitem.cxx b/svtools/source/items1/lckbitem.cxx
deleted file mode 100644
index c848e377b257..000000000000
--- a/svtools/source/items1/lckbitem.cxx
+++ /dev/null
@@ -1,194 +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: lckbitem.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_svtools.hxx"
-
-#define _LCKBITEM_CXX
-#include <svtools/lckbitem.hxx>
-#include <svtools/poolitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <tools/cachestr.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxLockBytesItem, SfxPoolItem);
-
-// -----------------------------------------------------------------------
-
-SfxLockBytesItem::SfxLockBytesItem()
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxLockBytesItem::SfxLockBytesItem( USHORT nW, SvLockBytes *pLockBytes )
-: SfxPoolItem( nW ),
- _xVal( pLockBytes )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxLockBytesItem::SfxLockBytesItem( USHORT nW, SvStream &rStream )
-: SfxPoolItem( nW )
-{
- rStream.Seek( 0L );
- _xVal = new SvLockBytes( new SvCacheStream(), TRUE );
-
- SvStream aLockBytesStream( _xVal );
- rStream >> aLockBytesStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxLockBytesItem::SfxLockBytesItem( const SfxLockBytesItem& rItem )
-: SfxPoolItem( rItem ),
- _xVal( rItem._xVal )
-{
-}
-
-// -----------------------------------------------------------------------
-
-SfxLockBytesItem::~SfxLockBytesItem()
-{
-}
-
-// -----------------------------------------------------------------------
-
-int SfxLockBytesItem::operator==( const SfxPoolItem& rItem ) const
-{
- return ((SfxLockBytesItem&)rItem)._xVal == _xVal;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxLockBytesItem::Clone(SfxItemPool *) const
-{
- return new SfxLockBytesItem( *this );
-}
-
-// -----------------------------------------------------------------------
-
-#define MAX_BUF 32000
-
-SfxPoolItem* SfxLockBytesItem::Create( SvStream &rStream, USHORT ) const
-{
- sal_uInt32 nSize = 0;
- ULONG nActRead = 0;
- sal_Char cTmpBuf[MAX_BUF];
- SvMemoryStream aNewStream;
- rStream >> nSize;
-
- do {
- ULONG nToRead;
- if( (nSize - nActRead) > MAX_BUF )
- nToRead = MAX_BUF;
- else
- nToRead = nSize - nActRead;
- nActRead += rStream.Read( cTmpBuf, nToRead );
- aNewStream.Write( cTmpBuf, nToRead );
- } while( nSize > nActRead );
-
- return new SfxLockBytesItem( Which(), aNewStream );
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxLockBytesItem::Store(SvStream &rStream, USHORT ) const
-{
- SvStream aLockBytesStream( _xVal );
- sal_uInt32 nSize = aLockBytesStream.Seek( STREAM_SEEK_TO_END );
- aLockBytesStream.Seek( 0L );
-
- rStream << nSize;
- rStream << aLockBytesStream;
-
- return rStream;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxLockBytesItem::PutValue( const com::sun::star::uno::Any& rVal, BYTE )
-{
- com::sun::star::uno::Sequence< sal_Int8 > aSeq;
- if ( rVal >>= aSeq )
- {
- if ( aSeq.getLength() )
- {
- SvCacheStream* pStream = new SvCacheStream;
- pStream->Write( (void*)aSeq.getConstArray(), aSeq.getLength() );
- pStream->Seek(0);
-
- _xVal = new SvLockBytes( pStream, TRUE );
- }
- else
- _xVal = NULL;
-
- return TRUE;
- }
-
- DBG_ERROR( "SfxLockBytesItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxLockBytesItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const
-{
- if ( _xVal.Is() )
- {
- sal_uInt32 nLen;
- SvLockBytesStat aStat;
-
- if ( _xVal->Stat( &aStat, SVSTATFLAG_DEFAULT ) == ERRCODE_NONE )
- nLen = aStat.nSize;
- else
- return FALSE;
-
- ULONG nRead = 0;
- com::sun::star::uno::Sequence< sal_Int8 > aSeq( nLen );
-
- _xVal->ReadAt( 0, aSeq.getArray(), nLen, &nRead );
- rVal <<= aSeq;
- }
- else
- {
- com::sun::star::uno::Sequence< sal_Int8 > aSeq( 0 );
- rVal <<= aSeq;
- }
-
- return TRUE;
-}
-
diff --git a/svtools/source/items1/makefile.mk b/svtools/source/items1/makefile.mk
deleted file mode 100644
index 9a7d13ff7d0f..000000000000
--- a/svtools/source/items1/makefile.mk
+++ /dev/null
@@ -1,79 +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: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJNAME=svtools
-TARGET=items1
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES=\
- $(SLO)$/bintitem.obj \
- $(SLO)$/cenumitm.obj \
- $(SLO)$/cintitem.obj \
- $(SLO)$/cntwall.obj \
- $(SLO)$/cstitem.obj \
- $(SLO)$/ctypeitm.obj \
- $(SLO)$/custritm.obj \
- $(SLO)$/dateitem.obj \
- $(SLO)$/dtritem.obj \
- $(SLO)$/frqitem.obj \
- $(SLO)$/ilstitem.obj \
- $(SLO)$/itemiter.obj \
- $(SLO)$/itempool.obj \
- $(SLO)$/itemprop.obj \
- $(SLO)$/itemset.obj \
- $(SLO)$/lckbitem.obj \
- $(SLO)$/poolio.obj \
- $(SLO)$/stylepool.obj \
- $(SLO)$/poolitem.obj \
- $(SLO)$/sfontitm.obj \
- $(SLO)$/sitem.obj \
- $(SLO)$/slstitm.obj \
- $(SLO)$/tfrmitem.obj \
- $(SLO)$/tresitem.obj \
- $(SLO)$/whiter.obj \
- $(SLO)$/visitem.obj
-
-SRS1NAME=$(TARGET)
-SRC1FILES=\
- cstitem.src
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/items1/nranges.cxx b/svtools/source/items1/nranges.cxx
deleted file mode 100644
index e12c7428d513..000000000000
--- a/svtools/source/items1/nranges.cxx
+++ /dev/null
@@ -1,853 +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: nranges.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_svtools.hxx"
-
-// compiled via include from itemset.cxx only!
-
-//========================================================================
-
-#ifdef DBG_UTIL
-
-#define DBG_CHECK_RANGES(NUMTYPE, pArr) \
- for ( const NUMTYPE *pRange = pArr; *pRange; pRange += 2 ) \
- { \
- DBG_ASSERT( pRange[0] <= pRange[1], "ranges must be sorted" ); \
- DBG_ASSERT( !pRange[2] || ( pRange[2] - pRange[1] ) > 1, \
- "ranges must be sorted and discrete" ); \
- }
-
-#else
-
-#define DBG_CHECK_RANGES(NUMTYPE,pArr)
-
-#endif
-
-//============================================================================
-inline void Swap_Impl(const NUMTYPE *& rp1, const NUMTYPE *& rp2)
-{
- const NUMTYPE * pTemp = rp1;
- rp1 = rp2;
- rp2 = pTemp;
-}
-
-//========================================================================
-
-NUMTYPE InitializeRanges_Impl( NUMTYPE *&rpRanges, va_list pArgs,
- NUMTYPE nWh1, NUMTYPE nWh2, NUMTYPE nNull )
-
-/** <H3>Description</H3>
-
- Creates an USHORT-ranges-array in 'rpRanges' using 'nWh1' and 'nWh2' as
- first range, 'nNull' as terminator or start of 2nd range and 'pArgs' as
- remaider.
-
- It returns the number of NUMTYPEs which are contained in the described
- set of NUMTYPEs.
-*/
-
-{
- NUMTYPE nSize = 0, nIns = 0;
- USHORT nCnt = 0;
- SvNums aNumArr( 11, 8 );
- aNumArr.Insert( nWh1, nCnt++ );
- aNumArr.Insert( nWh2, nCnt++ );
- DBG_ASSERT( nWh1 <= nWh2, "Ungueltiger Bereich" );
- nSize += nWh2 - nWh1 + 1;
- aNumArr.Insert( nNull, nCnt++ );
- while ( 0 !=
- ( nIns =
- sal::static_int_cast< NUMTYPE >(
- va_arg( pArgs, NUMTYPE_ARG ) ) ) )
- {
- aNumArr.Insert( nIns, nCnt++ );
- if ( 0 == (nCnt & 1) ) // 4,6,8, usw.
- {
- DBG_ASSERT( aNumArr[ nCnt-2 ] <= nIns, "Ungueltiger Bereich" );
- nSize += nIns - aNumArr[ nCnt-2 ] + 1;
- }
- }
- va_end( pArgs );
-
- DBG_ASSERT( 0 == (nCnt & 1), "ungerade Anzahl von Which-Paaren!" );
-
- // so, jetzt sind alle Bereiche vorhanden und
- rpRanges = new NUMTYPE[ nCnt+1 ];
- memcpy( rpRanges, aNumArr.GetData(), sizeof(NUMTYPE) * nCnt );
- *(rpRanges+nCnt) = 0;
-
- return nSize;
-}
-
-//------------------------------------------------------------------------
-
-NUMTYPE Count_Impl( const NUMTYPE *pRanges )
-
-/** <H3>Description</H3>
-
- Determines the number of NUMTYPEs in an 0-terminated array of pairs of
- NUMTYPEs. The terminating 0 is not included in the count.
-*/
-
-{
- NUMTYPE nCount = 0;
- while ( *pRanges )
- {
- nCount += 2;
- pRanges += 2;
- }
- return nCount;
-}
-
-//------------------------------------------------------------------------
-
-NUMTYPE Capacity_Impl( const NUMTYPE *pRanges )
-
-/** <H3>Description</H3>
-
- Determines the total number of NUMTYPEs described in an 0-terminated
- array of pairs of NUMTYPEs, each representing an range of NUMTYPEs.
-*/
-
-{
- NUMTYPE nCount = 0;
-
- if ( pRanges )
- {
- while ( *pRanges )
- {
- nCount += pRanges[1] - pRanges[0] + 1;
- pRanges += 2;
- }
- }
- return nCount;
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges::SfxNumRanges( const SfxNumRanges &rOrig )
-
-/** <H3>Description</H3>
-
- Copy-Ctor.
-*/
-
-{
- if ( rOrig._pRanges )
- {
- NUMTYPE nCount = Count_Impl( rOrig._pRanges ) + 1;
- _pRanges = new NUMTYPE[nCount];
- memcpy( _pRanges, rOrig._pRanges, sizeof(NUMTYPE) * nCount );
- }
- else
- _pRanges = 0;
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges::SfxNumRanges( NUMTYPE nWhich1, NUMTYPE nWhich2 )
-
-/** <H3>Description</H3>
-
- Constructs an SfxNumRanges-instance from one range of NUMTYPEs.
-
- precondition:
- nWhich1 <= nWhich2
-*/
-
-: _pRanges( new NUMTYPE[3] )
-{
- _pRanges[0] = nWhich1;
- _pRanges[1] = nWhich2;
- _pRanges[2] = 0;
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges::SfxNumRanges( NUMTYPE_ARG nWh0, NUMTYPE_ARG nWh1, NUMTYPE_ARG nNull, ... )
-
-/** <H3>Description</H3>
-
- Constructs an SfxNumRanges-instance from more than one sorted ranges of
- NUMTYPEs terminated with one 0.
-
- precondition: for each n >= 0 && n < nArgs
- nWh(2n) <= nWh(2n+1) && ( nWh(2n+2)-nWh(2n+1) ) > 1
-*/
-
-{
- va_list pArgs;
- va_start( pArgs, nNull );
- InitializeRanges_Impl(
- _pRanges, pArgs, sal::static_int_cast< NUMTYPE >(nWh0),
- sal::static_int_cast< NUMTYPE >(nWh1),
- sal::static_int_cast< NUMTYPE >(nNull));
- DBG_CHECK_RANGES(NUMTYPE, _pRanges);
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges::SfxNumRanges( const NUMTYPE* pArr )
-
-/** <H3>Description</H3>
-
- Constcurts an SfxNumRanges-instance from an sorted ranges of NUMTYPEs,
- terminates with on 0.
-
- precondition: for each n >= 0 && n < (sizeof(pArr)-1)
- pArr[2n] <= pArr[2n+1] && ( pArr[2n+2]-pArr[2n+1] ) > 1
-*/
-
-{
- DBG_CHECK_RANGES(NUMTYPE, pArr);
- NUMTYPE nCount = Count_Impl(pArr) + 1;
- _pRanges = new NUMTYPE[ nCount ];
- memcpy( _pRanges, pArr, sizeof(NUMTYPE) * nCount );
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxNumRanges::operator==( const SfxNumRanges &rOther ) const
-{
- // Object pointers equal?
- if ( this == &rOther )
- return TRUE;
-
- // Ranges pointers equal?
- if ( _pRanges == rOther._pRanges )
- return TRUE;
-
- // Counts equal?
- NUMTYPE nCount = Count();
- if ( nCount != rOther.Count() )
- return FALSE;
-
- // Check arrays.
- NUMTYPE n = 0;
- while( _pRanges[ n ] != 0 )
- {
- // Elements at current position equal?
- if ( _pRanges[ n ] != rOther._pRanges[ n ] )
- return FALSE;
-
- ++n;
- }
-
- return TRUE;
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges& SfxNumRanges::operator =
-(
- const SfxNumRanges &rRanges
-)
-
-/** <H3>Description</H3>
-
- Assigns ranges from 'rRanges' to '*this'.
-*/
-
-{
- // special case: assign itself
- if ( &rRanges == this )
- return *this;
-
- delete[] _pRanges;
-
- // special case: 'rRanges' is empty
- if ( rRanges.IsEmpty() )
- _pRanges = 0;
- else
- {
- // copy ranges
- NUMTYPE nCount = Count_Impl( rRanges._pRanges ) + 1;
- _pRanges = new NUMTYPE[ nCount ];
- memcpy( _pRanges, rRanges._pRanges, sizeof(NUMTYPE) * nCount );
- }
- return *this;
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges& SfxNumRanges::operator +=
-(
- const SfxNumRanges &rRanges
-)
-
-/** <H3>Description</H3>
-
- Merges *this with 'rRanges'.
-
- for each NUMTYPE n:
- this->Contains( n ) || rRanges.Contains( n ) => this'->Contains( n )
- !this->Contains( n ) && !rRanges.Contains( n ) => !this'->Contains( n )
-*/
-
-{
- // special cases: one is empty
- if ( rRanges.IsEmpty() )
- return *this;
- if ( IsEmpty() )
- return *this = rRanges;
-
- // First, run thru _pRanges and rRanges._pRanges and determine the size of
- // the new, merged ranges:
- NUMTYPE nCount = 0;
- const NUMTYPE * pRA = _pRanges;
- const NUMTYPE * pRB = rRanges._pRanges;
-
- for (;;)
- {
- // The first pair of pRA has a lower lower bound than the first pair
- // of pRB:
- if (pRA[0] > pRB[0])
- Swap_Impl(pRA, pRB);
-
- // We are done with the merging if at least pRA is exhausted:
- if (!pRA[0])
- break;
-
- for (;;)
- {
- // Skip those pairs in pRB that completely lie in the first pair
- // of pRA:
- while (pRB[1] <= pRA[1])
- {
- pRB += 2;
-
- // Watch out for exhaustion of pRB:
- if (!pRB[0])
- {
- Swap_Impl(pRA, pRB);
- goto count_rest;
- }
- }
-
- // If the next pair of pRA does not at least touch the current new
- // pair, we are done with the current new pair:
- if (pRB[0] > pRA[1] + 1)
- break;
-
- // The next pair of pRB extends the current new pair; first,
- // extend the current new pair (we are done if pRB is then
- // exhausted); second, switch the roles of pRA and pRB in order to
- // merge in those following pairs of the original pRA that will
- // lie in the (now larger) current new pair or will even extend it
- // further:
- pRA += 2;
- if (!pRA[0])
- goto count_rest;
- Swap_Impl(pRA, pRB);
- }
-
- // Done with the current new pair:
- pRA += 2;
- nCount += 2;
- }
-
- // Only pRB has more pairs available, pRA is already exhausted:
-count_rest:
- for (; pRB[0]; pRB += 2)
- nCount += 2;
-
- // Now, create new ranges of the correct size and, on a second run thru
- // _pRanges and rRanges._pRanges, copy the merged pairs into the new
- // ranges:
- NUMTYPE * pNew = new NUMTYPE[nCount + 1];
- pRA = _pRanges;
- pRB = rRanges._pRanges;
- NUMTYPE * pRN = pNew;
-
- for (;;)
- {
- // The first pair of pRA has a lower lower bound than the first pair
- // of pRB:
- if (pRA[0] > pRB[0])
- Swap_Impl(pRA, pRB);
-
- // We are done with the merging if at least pRA is exhausted:
- if (!pRA[0])
- break;
-
- // Lower bound of current new pair is already known:
- *pRN++ = pRA[0];
-
- for (;;)
- {
- // Skip those pairs in pRB that completely lie in the first pair
- // of pRA:
- while (pRB[1] <= pRA[1])
- {
- pRB += 2;
-
- // Watch out for exhaustion of pRB:
- if (!pRB[0])
- {
- Swap_Impl(pRA, pRB);
- ++pRB;
- goto copy_rest;
- }
- }
-
- // If the next pair of pRA does not at least touch the current new
- // pair, we are done with the current new pair:
- if (pRB[0] > pRA[1] + 1)
- break;
-
- // The next pair of pRB extends the current new pair; first,
- // extend the current new pair (we are done if pRB is then
- // exhausted); second, switch the roles of pRA and pRB in order to
- // merge in those following pairs of the original pRA that will
- // lie in the (now larger) current new pair or will even extend it
- // further:
- pRA += 2;
- if (!pRA[0])
- {
- ++pRB;
- goto copy_rest;
- }
- Swap_Impl(pRA, pRB);
- }
-
- // Done with the current new pair, now upper bound is also known:
- *pRN++ = pRA[1];
- pRA += 2;
- }
-
- // Only pRB has more pairs available (which are copied to the new ranges
- // unchanged), pRA is already exhausted:
-copy_rest:
- for (; *pRB;)
- *pRN++ = *pRB++;
- *pRN = 0;
-
- delete[] _pRanges;
- _pRanges = pNew;
-
- return *this;
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges& SfxNumRanges::operator -=
-(
- const SfxNumRanges &rRanges
-)
-
-/** <H3>Description</H3>
-
- Removes 'rRanges' from '*this'.
-
- for each NUMTYPE n:
- this->Contains( n ) && rRanges.Contains( n ) => !this'->Contains( n )
- this->Contains( n ) && !rRanges.Contains( n ) => this'->Contains( n )
- !this->Contains( n ) => !this'->Contains( n )
-*/
-
-{
- // special cases: one is empty
- if ( rRanges.IsEmpty() || IsEmpty() )
- return *this;
-
- // differentiate 'rRanges' in a temporary copy of '*this'
- // (size is computed for maximal possibly split-count plus terminating 0)
- NUMTYPE nThisSize = Count_Impl(_pRanges);
- NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) );
- NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
- memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
- memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
-
- NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
- while( _pRanges[ nPos1 ] )
- {
- NUMTYPE l1 = _pRanges[ nPos1 ]; // lower bound of interval 1
- NUMTYPE u1 = _pRanges[ nPos1+1 ]; // upper bound of interval 1
- NUMTYPE l2 = rRanges._pRanges[ nPos2 ]; // lower bound of interval 2
- NUMTYPE u2 = rRanges._pRanges[ nPos2+1 ]; // upper bound of interval 2
-
- // boundary cases
- // * subtrahend is empty -> copy the minuend
- if( !l2 )
- {
- pTarget[ nTargetPos ] = l1;
- pTarget[ nTargetPos+1 ] = u1;
- nTargetPos += 2;
- nPos1 += 2;
- continue;
- }
- // * next subtrahend interval is completely higher -> copy the minuend
- if( u1 < l2 )
- {
- pTarget[ nTargetPos ] = l1;
- pTarget[ nTargetPos+1 ] = u1;
- nTargetPos += 2;
- nPos1 += 2;
- continue;
- }
-
- // * next subtrahend interval is completely lower -> try next
- if( u2 < l1 )
- {
- nPos2 += 2;
- continue;
- }
-
- // intersecting cases
- // * subtrahend cuts out from the beginning of the minuend
- if( l2 <= l1 && u2 <= u1 )
- {
- // reduce minuend interval, try again (minuend might be affected by other subtrahend intervals)
- _pRanges[ nPos1 ] = u2 + 1;
- nPos2 += 2; // this cannot hurt any longer
- continue;
- }
-
- // * subtrahend cuts out from the end of the minuend
- if( l1 <= l2 && u1 <= u2 )
- {
- // copy remaining part of minuend (cannot be affected by other intervals)
- if( l1 < l2 ) // anything left at all?
- {
- pTarget[ nTargetPos ] = l1;
- pTarget[ nTargetPos+1 ] = l2 - 1;
- nTargetPos += 2;
- // do not increment nPos2, might affect next minuend interval, too
- }
- nPos1 += 2; // nothing left at all
- continue;
- }
-
- // * subtrahend completely deletes minuend (larger or same at both ends)
- if( l1 >= l2 && u1 <= u2 )
- {
- nPos1 += 2; // minuend deleted
- // do not increment nPos2, might affect next minuend interval, too
- continue;
- }
-
- // * subtrahend divides minuend into two pieces
- if( l1 <= l2 && u1 >= u2 ) // >= and <= since they may be something left only at one side
- {
- // left side
- if( l1 < l2 ) // anything left at all
- {
- pTarget[ nTargetPos ] = l1;
- pTarget[ nTargetPos+1 ] = l2 - 1;
- nTargetPos += 2;
- }
-
- // right side
- if( u1 > u2 ) // anything left at all
- {
- // reduce minuend interval, try again (minuend might be affected by other subtrahend itnervals )
- _pRanges[ nPos1 ] = u2 + 1;
- }
-
- // subtrahend is completely used
- nPos2 += 2;
- continue;
- }
-
- // we should never be here
- DBG_ERROR( "SfxNumRanges::operator-=: internal error" );
- } // while
-
- pTarget[ nTargetPos ] = 0;
-
- // assign the differentiated ranges
- delete[] _pRanges;
-
- NUMTYPE nUShorts = Count_Impl(pTarget) + 1;
- if ( 1 != nUShorts )
- {
- _pRanges = new NUMTYPE[ nUShorts ];
- memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) );
- }
- else
- _pRanges = 0;
-
- delete [] pTarget;
- return *this;
-
- /* untested code from MI commented out (MDA, 28.01.97)
- do
- {
- // 1st range is smaller than 2nd range?
- if ( pRange1[1] < pRange2[0] )
- // => keep 1st range
- pRange1 += 2;
-
- // 2nd range is smaller than 1st range?
- else if ( pRange2[1] < pRange1[0] )
- // => skip 2nd range
- pRange2 += 2;
-
- // 2nd range totally overlaps the 1st range?
- else if ( pRange2[0] <= pRange1[0] && pRange2[1] >= pRange1[1] )
- // => remove 1st range
- memmove( pRange1, pRange1+2, sizeof(NUMTYPE) * (pEndOfTarget-pRange1+2) );
-
- // 2nd range overlaps only the beginning of 1st range?
- else if ( pRange2[0] <= pRange1[0] && pRange2[1] < pRange1[1] )
- {
- // => cut the beginning of 1st range and goto next 2nd range
- pRange1[0] = pRange2[1] + 1;
- pRange2 += 2;
- }
-
- // 2nd range overlaps only the end of 1st range?
- else if ( pRange2[0] > pRange1[0] && pRange2[1] >= pRange1[0] )
- // => cut the beginning of 1st range
- pRange1[0] = pRange2[1]+1;
-
- // 2nd range is a real subset of 1st range
- else
- {
- // => split 1st range and goto next 2nd range
- memmove( pRange1+3, pRange1+1, sizeof(NUMTYPE) * (pEndOfTarget-pRange1-1) );
- pRange1[1] = pRange2[0] - 1;
- pRange1[2] = pRange2[1] + 1;
- pRange1 += 2;
- pRange2 += 2;
- }
- }
- while ( *pRange1 && *pRange2 );
-
- // assign the differentiated ranges
- delete[] _pRanges;
- NUMTYPE nUShorts = Count_Impl(pTarget) + 1;
- if ( 1 != nUShorts )
- {
- _pRanges = new NUMTYPE[ nUShorts ];
- memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) );
- _pRanges[ nUShorts-1 ] = 0;
- }
- else
- _pRanges = 0;
- return *this;
- */
-}
-
-//------------------------------------------------------------------------
-
-SfxNumRanges& SfxNumRanges::operator /=
-(
- const SfxNumRanges &rRanges
-)
-
-/** <H3>Description</H3>
-
- Determines intersection of '*this' with 'rRanges'.
-
- for each NUMTYPE n:
- this->Contains( n ) && rRanges.Contains( n ) => this'->Contains( n )
- !this->Contains( n ) => !this'->Contains( n )
- !rRanges.Contains( n ) => !this'->Contains( n )
-*/
-
-{
- // boundary cases
- // * first set is empty -> nothing to be done
- // * second set is empty -> delete first set
- if( rRanges.IsEmpty() )
- {
- delete[] _pRanges;
-
- _pRanges = new NUMTYPE[1];
- _pRanges[0] = 0;
-
- return *this;
- }
-
- // intersect 'rRanges' in a temporary copy of '*this'
- // (size is computed for maximal possibly split-count plus terminating 0)
- NUMTYPE nThisSize = Count_Impl(_pRanges);
- NUMTYPE nTargetSize = 1 + ( nThisSize + Count_Impl(rRanges._pRanges) );
- NUMTYPE *pTarget = new NUMTYPE[ nTargetSize ];
- memset( pTarget, sizeof(NUMTYPE)*nTargetSize, 0 );
- memcpy( pTarget, _pRanges, sizeof(NUMTYPE)*nThisSize );
-
- NUMTYPE nPos1 = 0, nPos2 = 0, nTargetPos = 0;
- while( _pRanges[ nPos1 ] != 0 && rRanges._pRanges[ nPos2 ] != 0 )
- {
- NUMTYPE l1 = _pRanges[ nPos1 ]; // lower bound of interval 1
- NUMTYPE u1 = _pRanges[ nPos1+1 ]; // upper bound of interval 1
- NUMTYPE l2 = rRanges._pRanges[ nPos2 ]; // lower bound of interval 2
- NUMTYPE u2 = rRanges._pRanges[ nPos2+1 ]; // upper bound of interval 2
-
- if( u1 < l2 )
- {
- // current interval in s1 is completely before ci in s2
- nPos1 += 2;
- continue;
- }
- if( u2 < l1 )
- {
- // ci in s2 is completely before ci in s1
- nPos2 += 2;
- continue;
- }
-
- // assert: there exists an intersection between ci1 and ci2
-
- if( l1 <= l2 )
- {
- // c1 "is more to the left" than c2
-
- if( u1 <= u2 )
- {
- pTarget[ nTargetPos ] = l2;
- pTarget[ nTargetPos+1 ] = u1;
- nTargetPos += 2;
- nPos1 += 2;
- continue;
- }
- else
- {
- pTarget[ nTargetPos ] = l2;
- pTarget[ nTargetPos+1 ] = u2;
- nTargetPos += 2;
- nPos2 += 2;
- }
- }
- else
- {
- // c2 "is more to the left" than c1"
-
- if( u1 > u2 )
- {
- pTarget[ nTargetPos ] = l1;
- pTarget[ nTargetPos+1 ] = u2;
- nTargetPos += 2;
- nPos2 += 2;
- }
- else
- {
- pTarget[ nTargetPos ] = l1;
- pTarget[ nTargetPos+1 ] = u1;
- nTargetPos += 2;
- nPos1 += 2;
- }
- }
- }; // while
- pTarget[ nTargetPos ] = 0;
-
- // assign the intersected ranges
- delete[] _pRanges;
-
- NUMTYPE nUShorts = Count_Impl(pTarget) + 1;
- if ( 1 != nUShorts )
- {
- _pRanges = new NUMTYPE[ nUShorts ];
- memcpy( _pRanges, pTarget, nUShorts * sizeof(NUMTYPE) );
- }
- else
- _pRanges = 0;
-
- delete [] pTarget;
- return *this;
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxNumRanges::Intersects( const SfxNumRanges &rRanges ) const
-
-/** <H3>Description</H3>
-
- Determines if at least one range in 'rRanges' intersects with one
- range in '*this'.
-
- TRUE, if there is at least one with:
- this->Contains( n ) && rRanges.Contains( n )
-*/
-
-{
- // special cases: one is empty
- if ( rRanges.IsEmpty() || IsEmpty() )
- return FALSE;
-
- // find at least one intersecting range
- const NUMTYPE *pRange1 = _pRanges;
- const NUMTYPE *pRange2 = rRanges._pRanges;
-
- do
- {
- // 1st range is smaller than 2nd range?
- if ( pRange1[1] < pRange2[0] )
- // => keep 1st range
- pRange1 += 2;
-
- // 2nd range is smaller than 1st range?
- else if ( pRange2[1] < pRange1[0] )
- // => skip 2nd range
- pRange2 += 2;
-
- // the ranges are overlappung
- else
- return TRUE;
- }
- while ( *pRange2 );
-
- // no intersection found
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-
-NUMTYPE SfxNumRanges::Count() const
-
-/** <H3>Description</H3>
-
- Determines the number of USHORTs in the set described by the ranges
- of USHORTs in '*this'.
-*/
-
-{
- return Capacity_Impl( _pRanges );
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxNumRanges::Contains( NUMTYPE n ) const
-
-/** <H3>Description</H3>
-
- Determines if '*this' contains 'n'.
-*/
-
-{
- for ( NUMTYPE *pRange = _pRanges; *pRange && *pRange <= n; pRange += 2 )
- if ( pRange[0] <= n && n <= pRange[1] )
- return TRUE;
- return FALSE;
-
-}
diff --git a/svtools/source/items1/poolio.cxx b/svtools/source/items1/poolio.cxx
deleted file mode 100644
index f2eb94ef7f67..000000000000
--- a/svtools/source/items1/poolio.cxx
+++ /dev/null
@@ -1,1715 +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: poolio.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <string.h>
-#include <stdio.h>
-
-#ifndef GCC
-#endif
-
-#include <tools/solar.h>
-#include <svtools/itempool.hxx>
-#include "whassert.hxx"
-#include <svtools/brdcst.hxx>
-#include <svtools/filerec.hxx>
-#include <svtools/svtdata.hxx>
-#include "poolio.hxx"
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxItemPool);
-
-//========================================================================
-
-void SfxItemPool::SetStoringPool( const SfxItemPool *pStoringPool )
-
-/* [Beschreibung]
-
- Diese Methode setzt den <SfxItemPool>, der gerade gespeichert wird.
- Sie sollte nur in Notf"allen verwendet werden, um z.B. File-Format-
- Kompatibilit"at zu gew"ahrleisten o."o. - z.B. in der "uberladung eines
- <SfxPoolItem::Store()> zus"atzliche Daten aus dem dazuge"horigen
- Pool mit <SfxItemPool::GetStoringPool()> zu besorgen.
-
- Sie wird von <SfxItemPool::Store()> bedient, kann jedoch f"ur nicht
- poolable Items auch direkt gerufen werden. Bitte m"oglichst nicht
- f"ur jedes Item einzeln, da 2 Calls!
-*/
-
-{
- ImpSvtData::GetSvtData().pStoringPool = pStoringPool;
-}
-
-//-------------------------------------------------------------------------
-
-const SfxItemPool* SfxItemPool::GetStoringPool()
-
-/* [Beschreibung]
-
- Diese Methode liefert den <SfxItemPool>, der gerade gespeichert wird.
- Sie sollte nur in Notf"allen verwendet werden, um z.B. File-Format-
- Kompatibilit"at zu gew"ahrleisten o."o. - z.B. in der "uberladung eines
- <SfxPoolItem::Store()> zus"atzliche Daten aus dem dazuge"horigen
- Pool zu besorgen.
-*/
-
-{
- return ImpSvtData::GetSvtData().pStoringPool;
-}
-
-//-------------------------------------------------------------------------
-
-SvStream &SfxItemPool::Store(SvStream &rStream) const
-
-/* [Beschreibung]
-
- Der SfxItemPool wird inklusive aller seiner Sekund"arpools mit
- Pool-Defaults und gepoolten Items in dem angegebenen Stream gespeichert.
- Die statischen Defaults werden nicht gespeichert.
-
-
- [Fileformat]
-
- ;zun"achst ein Kompatiblit"ats-Header-Block
- Start: 0x1111 SFX_ITEMPOOL_TAG_STARTPOOLS(_4/_5)
- BYTE MAJOR_VER ;SfxItemPool-Version
- BYTE MINOR_VER ;"
- 0xFFFF SFX_ITEMPOOL_TAG_TRICK4OLD ;ex. GetVersion()
- USHORT 0x0000 ;Pseudo-StyleSheetPool
- USHORT 0x0000 ;Pseudo-StyleSheetPool
-
- ;den ganzen Pool in einen Record
- record SfxMiniRecod(SFX_ITEMPOOL_REC)
-
- ;je ein Header vorweg
- Header: record SfxMiniRecord(SFX_ITEMPOOL_REC_HEADER)
- USHORT GetVersion() ;Which-Ranges etc.
- String GetName() ;Pool-Name
-
- ;die Versions-Map, um WhichIds neuer File-Versionen mappen zu k"onnen
- Versions: record SfxMultiRecord(SFX_ITEMPOOL_REC_VERSIONS, 0)
- USHORT OldVersion
- USHORT OldStartWhich
- USHORT OldEndWhich
- USHORT[] NewWhich (OldEndWhich-OldStartWhich+1)
-
- ;jetzt die gepoolten Items (zuerst nicht-SfxSetItems)
- Items: record SfxMultiRecord(SFX_ITEMPOOL_REC_WHICHIDS, 0)
- content SlotId, 0
- USHORT WhichId
- USHORT pItem->GetVersion()
- USHORT Array-Size
- record SfxMultiRecord(SFX_, 0)
- content Surrogate
- USHORT RefCount
- unknown pItem->Store()
-
- ;jetzt die gesetzten Pool-Defaults
- Defaults: record SfxMultiRecord(SFX_ITEMPOOL_REC_DEFAULTS, 0)
- content SlotId, 0
- USHORT WhichId
- USHORT pPoolDef->GetVersion()
- unknown pPoolDef->Store();
-
- ;dahinter folgt ggf. der Secondary ohne Kompatiblit"ats-Header-Block
-*/
-
-{
- DBG_CHKTHIS(SfxItemPool, 0);
-
- // Store-Master finden
- SfxItemPool *pStoreMaster = pMaster != this ? pMaster : 0;
- while ( pStoreMaster && !pStoreMaster->pImp->bStreaming )
- pStoreMaster = pStoreMaster->pSecondary;
-
- // Alter-Header (Version des Pools an sich und Inhalts-Version 0xffff)
- pImp->bStreaming = TRUE;
- if ( !pStoreMaster )
- {
- rStream << ( rStream.GetVersion() >= SOFFICE_FILEFORMAT_50
- ? SFX_ITEMPOOL_TAG_STARTPOOL_5
- : SFX_ITEMPOOL_TAG_STARTPOOL_4 );
- rStream << SFX_ITEMPOOL_VER_MAJOR << SFX_ITEMPOOL_VER_MINOR;
- rStream << SFX_ITEMPOOL_TAG_TRICK4OLD;
-
- // SfxStyleSheet-Bug umgehen
- rStream << UINT16(0); // Version
- rStream << UINT16(0); // Count (2. Schleife f"allt sonst auf die Fresse)
- }
-
- // jeder Pool ist als ganzes ein Record
- SfxMiniRecordWriter aPoolRec( &rStream, SFX_ITEMPOOL_REC );
- ImpSvtData::GetSvtData().pStoringPool = this;
-
- // Einzel-Header (Version des Inhalts und Name)
- {
- SfxMiniRecordWriter aPoolHeaderRec( &rStream, SFX_ITEMPOOL_REC_HEADER);
- rStream << pImp->nVersion;
- SfxPoolItem::writeByteString(rStream, aName);
- }
-
- // Version-Maps
- {
- SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP, 0 );
- for ( USHORT nVerNo = 0; nVerNo < pImp->aVersions.Count(); ++nVerNo )
- {
- aVerRec.NewContent();
- SfxPoolVersion_Impl *pVer = pImp->aVersions[nVerNo];
- rStream << pVer->_nVer << pVer->_nStart << pVer->_nEnd;
- USHORT nCount = pVer->_nEnd - pVer->_nStart + 1;
- USHORT nNewWhich = 0;
- for ( USHORT n = 0; n < nCount; ++n )
- {
- nNewWhich = pVer->_pMap[n];
- rStream << nNewWhich;
- }
-
- // Workaround gegen Bug in SetVersionMap der 312
- if ( SOFFICE_FILEFORMAT_31 == _nFileFormatVersion )
- rStream << USHORT(nNewWhich+1);
- }
- }
-
- // gepoolte Items
- {
- SfxMultiMixRecordWriter aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS, 0 );
-
- // erst Atomaren-Items und dann die Sets schreiben (wichtig beim Laden)
- for ( pImp->bInSetItem = FALSE; pImp->bInSetItem <= TRUE && !rStream.GetError(); ++pImp->bInSetItem )
- {
- SfxPoolItemArray_Impl **pArr = pImp->ppPoolItems;
- SfxPoolItem **ppDefItem = ppStaticDefaults;
- const USHORT nSize = GetSize_Impl();
- for ( USHORT i = 0; i < nSize && !rStream.GetError(); ++i, ++pArr, ++ppDefItem )
- {
- // Version des Items feststellen
- USHORT nItemVersion = (*ppDefItem)->GetVersion( _nFileFormatVersion );
- if ( USHRT_MAX == nItemVersion )
- // => kam in zu exportierender Version gar nicht vor
- continue;
-
- // !poolable wird gar nicht im Pool gespeichert
- // und itemsets/plain-items je nach Runde
-#ifdef TF_POOLABLE
- if ( *pArr && IsItemFlag(**ppDefItem, SFX_ITEM_POOLABLE) &&
-#else
- if ( *pArr && (*ppDefItem)->IsPoolable() &&
-#endif
- pImp->bInSetItem == (*ppDefItem)->ISA(SfxSetItem) )
- {
- // eigene Kennung, globale Which-Id und Item-Version
- USHORT nSlotId = GetSlotId( (*ppDefItem)->Which(), FALSE );
- aWhichIdsRec.NewContent(nSlotId, 0);
- rStream << (*ppDefItem)->Which();
- rStream << nItemVersion;
- const USHORT nCount = (*pArr)->Count();
- DBG_ASSERT(nCount, "ItemArr ist leer");
- rStream << nCount;
-
- // Items an sich schreiben
- SfxMultiMixRecordWriter aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS, 0 );
- for ( USHORT j = 0; j < nCount; ++j )
- {
- // Item selbst besorgen
- const SfxPoolItem *pItem = (*pArr)->GetObject(j);
- if ( pItem && pItem->GetRefCount() ) //! siehe anderes MI-REF
- {
- aItemsRec.NewContent(j, 'X' );
-
- if ( pItem->GetRefCount() == SFX_ITEMS_SPECIAL )
- rStream << (USHORT) pItem->GetKind();
- else
- {
- rStream << (USHORT) pItem->GetRefCount();
- if( pItem->GetRefCount() > SFX_ITEMS_OLD_MAXREF )
- rStream.SetError( ERRCODE_IO_NOTSTORABLEINBINARYFORMAT );
- }
-
- if ( !rStream.GetError() )
- pItem->Store(rStream, nItemVersion);
- else
- break;
-#ifdef DBG_UTIL_MI
- if ( !pItem->ISA(SfxSetItem) )
- {
- ULONG nMark = rStream.Tell();
- rStream.Seek( nItemStartPos + sizeof(USHORT) );
- SfxPoolItem *pClone = pItem->Create(rStream, nItemVersion );
- USHORT nWh = pItem->Which();
- SFX_ASSERT( rStream.Tell() == nMark, nWh,"asymmetric store/create" );
- SFX_ASSERT( *pClone == *pItem, nWh, "unequal after store/create" );
- delete pClone;
- }
-#endif
- }
- }
- }
- }
- }
-
- pImp->bInSetItem = FALSE;
- }
-
- // die gesetzten Defaults speichern (Pool-Defaults)
- if ( !rStream.GetError() )
- {
- SfxMultiMixRecordWriter aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS, 0 );
- USHORT nCount = GetSize_Impl();
- for ( USHORT n = 0; n < nCount; ++n )
- {
- const SfxPoolItem* pDefaultItem = ppPoolDefaults[n];
- if ( pDefaultItem )
- {
- // Version ermitteln
- USHORT nItemVersion = pDefaultItem->GetVersion( _nFileFormatVersion );
- if ( USHRT_MAX == nItemVersion )
- // => gab es in der Version noch nicht
- continue;
-
- // eigene Kennung, globale Kennung, Version
- USHORT nSlotId = GetSlotId( pDefaultItem->Which(), FALSE );
- aDefsRec.NewContent( nSlotId, 0 );
- rStream << pDefaultItem->Which();
- rStream << nItemVersion;
-
- // Item an sich
- pDefaultItem->Store( rStream, nItemVersion );
- }
- }
- }
-
- // weitere Pools rausschreiben
- ImpSvtData::GetSvtData().pStoringPool = 0;
- aPoolRec.Close();
- if ( !rStream.GetError() && pSecondary )
- pSecondary->Store( rStream );
-
- pImp->bStreaming = FALSE;
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::LoadCompleted()
-
-/* [Beschreibung]
-
- Wurde der SfxItemPool mit 'bRefCounts' == FALSE geladen, mu\s das
- Laden der Dokumentinhalte mit einem Aufruf dieser Methode beendet
- werden. Ansonsten hat der Aufruf dieser Methode keine Funktion.
-
-
- [Anmerkung]
-
- Beim Laden ohne Ref-Counts werden diese tats"achlich auf 1 gesetzt,
- damit nicht w"ahrend des Ladevorgangs SfxPoolItems gel"oscht werden,
- die danach, aber auch noch beim Ladevorgang, ben"otigt werden. Diese
- Methode setzt den Ref-Count wieder zur"uck und entfernt dabei
- gleichzeitig alle nicht mehr ben"otigten Items.
-
-
- [Querverweise]
-
- <SfxItemPool::Load()>
-*/
-
-{
- // wurden keine Ref-Counts mitgeladen?
- if ( pImp->nInitRefCount > 1 )
- {
-
- // "uber alle Which-Werte iterieren
- SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems;
- for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr )
- {
- // ist "uberhaupt ein Item mit dem Which-Wert da?
- if ( *ppItemArr )
- {
- // "uber alle Items mit dieser Which-Id iterieren
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
- if (*ppHtArr)
- {
- #ifdef DBG_UTIL
- const SfxPoolItem &rItem = **ppHtArr;
- DBG_ASSERT( !rItem.ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem&)rItem).GetItemSet(),
- "SetItem without ItemSet" );
- #endif
-
- if ( !ReleaseRef( **ppHtArr, 1 ) )
- DELETEZ( *ppHtArr );
- }
- }
- }
-
- // from now on normal initial ref count
- pImp->nInitRefCount = 1;
- }
-
- // notify secondary pool
- if ( pSecondary )
- pSecondary->LoadCompleted();
-}
-
-//============================================================================
-// This had to be moved to a method of its own to keep Solaris GCC happy:
-void SfxItemPool::readTheItems (
- SvStream & rStream, USHORT nItemCount, USHORT nVersion,
- SfxPoolItem * pDefItem, SfxPoolItemArray_Impl ** ppArr)
-{
- SfxMultiRecordReader aItemsRec( &rStream, SFX_ITEMPOOL_REC_ITEMS );
-
- SfxPoolItemArray_Impl *pNewArr = new SfxPoolItemArray_Impl( nItemCount );
- SfxPoolItem *pItem = 0;
-
- USHORT n, nLastSurrogate = USHORT(-1);
- while (aItemsRec.GetContent())
- {
- // n"achstes Surrogat holen
- USHORT nSurrogate = aItemsRec.GetContentTag();
- DBG_ASSERT( aItemsRec.GetContentVersion() == 'X',
- "not an item content" );
-
- // fehlende auff"ullen
- for ( pItem = 0, n = nLastSurrogate+1; n < nSurrogate; ++n )
- pNewArr->C40_INSERT(SfxPoolItem, pItem, n);
- nLastSurrogate = nSurrogate;
-
- // Ref-Count und Item laden
- USHORT nRef;
- rStream >> nRef;
-
- pItem = pDefItem->Create(rStream, nVersion);
- pNewArr->C40_INSERT(SfxPoolItem, pItem, nSurrogate);
-
- if ( !bPersistentRefCounts )
- // bis <SfxItemPool::LoadCompleted()> festhalten
- AddRef(*pItem, 1);
- else
- {
- if ( nRef > SFX_ITEMS_OLD_MAXREF )
- pItem->SetKind( nRef );
- else
- AddRef(*pItem, nRef);
- }
- }
-
- // fehlende auff"ullen
- for ( pItem = 0, n = nLastSurrogate+1; n < nItemCount; ++n )
- pNewArr->C40_INSERT(SfxPoolItem, pItem, n);
-
- SfxPoolItemArray_Impl *pOldArr = *ppArr;
- *ppArr = pNewArr;
-
- // die Items merken, die schon im Pool sind
- int bEmpty = TRUE;
- if ( 0 != pOldArr )
- for ( n = 0; bEmpty && n < pOldArr->Count(); ++n )
- bEmpty = pOldArr->GetObject(n) == 0;
- DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" );
- if ( !bEmpty )
- {
- // f"ur alle alten suchen, ob ein gleiches neues existiert
- for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld )
- {
- SfxPoolItem *pOldItem = (*pOldArr)[nOld];
- if ( pOldItem )
- {
- USHORT nFree = USHRT_MAX;
- int bFound = FALSE;
- USHORT nCount = (*ppArr)->Count();
- for ( USHORT nNew = nCount; !bFound && nNew--; )
- {
- // geladenes Item
- SfxPoolItem *&rpNewItem =
- (SfxPoolItem*&)(*ppArr)->GetData()[nNew];
-
- // surrogat unbenutzt?
- if ( !rpNewItem )
- nFree = nNew;
-
- // gefunden?
- else if ( *rpNewItem == *pOldItem )
- {
- // wiederverwenden
- AddRef( *pOldItem, rpNewItem->GetRefCount() );
- SetRefCount( *rpNewItem, 0 );
- delete rpNewItem;
- rpNewItem = pOldItem;
- bFound = TRUE;
- }
- }
-
- // vorhervorhandene, nicht geladene uebernehmen
- if ( !bFound )
- {
- if ( nFree != USHRT_MAX )
- (SfxPoolItem*&)(*ppArr)->GetData()[nFree] = pOldItem;
- else
- (*ppArr)->C40_INSERT( SfxPoolItem, pOldItem, nCount );
- }
- }
- }
- }
- delete pOldArr;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream &SfxItemPool::Load(SvStream &rStream)
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- DBG_ASSERT(ppStaticDefaults, "kein DefaultArray");
-
- // protect items by increasing ref count
- if ( !bPersistentRefCounts )
- {
-
- // "uber alle Which-Werte iterieren
- SfxPoolItemArray_Impl** ppItemArr = pImp->ppPoolItems;
- for( USHORT nArrCnt = GetSize_Impl(); nArrCnt; --nArrCnt, ++ppItemArr )
- {
- // ist "uberhaupt ein Item mit dem Which-Wert da?
- if ( *ppItemArr )
- {
- // "uber alle Items mit dieser Which-Id iterieren
- SfxPoolItem** ppHtArr = (SfxPoolItem**)(*ppItemArr)->GetData();
- for( USHORT n = (*ppItemArr)->Count(); n; --n, ++ppHtArr )
- if (*ppHtArr)
- {
- #ifdef DBG_UTIL
- const SfxPoolItem &rItem = **ppHtArr;
- DBG_ASSERT( !rItem.ISA(SfxSetItem) ||
- 0 != &((const SfxSetItem&)rItem).GetItemSet(),
- "SetItem without ItemSet" );
- DBG_WARNING( "loading non-empty ItemPool" );
- #endif
-
- AddRef( **ppHtArr, 1 );
- }
- }
- }
-
- // during loading (until LoadCompleted()) protect all items
- pImp->nInitRefCount = 2;
- }
-
- // Load-Master finden
- SfxItemPool *pLoadMaster = pMaster != this ? pMaster : 0;
- while ( pLoadMaster && !pLoadMaster->pImp->bStreaming )
- pLoadMaster = pLoadMaster->pSecondary;
-
- // Gesamt Header einlesen
- pImp->bStreaming = TRUE;
- if ( !pLoadMaster )
- {
- // Format-Version laden
- CHECK_FILEFORMAT2( rStream,
- SFX_ITEMPOOL_TAG_STARTPOOL_5, SFX_ITEMPOOL_TAG_STARTPOOL_4 );
- rStream >> pImp->nMajorVer >> pImp->nMinorVer;
-
- // Format-Version in Master-Pool "ubertragen
- pMaster->pImp->nMajorVer = pImp->nMajorVer;
- pMaster->pImp->nMinorVer = pImp->nMinorVer;
-
- // altes Format?
- if ( pImp->nMajorVer < 2 )
- // pImp->bStreaming wird von Load1_Impl() zur"uckgesetzt
- return Load1_Impl( rStream );
-
- // zu neues Format?
- if ( pImp->nMajorVer > SFX_ITEMPOOL_VER_MAJOR )
- {
- rStream.SetError(SVSTREAM_FILEFORMAT_ERROR);
- pImp->bStreaming = FALSE;
- return rStream;
- }
-
- // Version 1.2-Trick-Daten "uberspringen
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_TRICK4OLD );
- rStream.SeekRel( 4 ); // Hack-Daten wegen SfxStyleSheetPool-Bug skippen
- }
-
- // neues Record-orientiertes Format
- SfxMiniRecordReader aPoolRec( &rStream, SFX_ITEMPOOL_REC );
- if ( rStream.GetError() )
- {
- pImp->bStreaming = FALSE;
- return rStream;
- }
-
- // Einzel-Header
- int bOwnPool = TRUE;
- UniString aExternName;
- {
- // Header-Record suchen
- SfxMiniRecordReader aPoolHeaderRec( &rStream, SFX_ITEMPOOL_REC_HEADER );
- if ( rStream.GetError() )
- {
- pImp->bStreaming = FALSE;
- return rStream;
- }
-
- // Header-lesen
- rStream >> pImp->nLoadingVersion;
- SfxPoolItem::readByteString(rStream, aExternName);
- bOwnPool = aExternName == aName;
-
- //! solange wir keine fremden Pools laden k"onnen
- if ( !bOwnPool )
- {
- rStream.SetError(SVSTREAM_FILEFORMAT_ERROR);
- aPoolRec.Skip();
- pImp->bStreaming = FALSE;
- return rStream;
- }
- }
-
- // Version-Maps
- {
- SfxMultiRecordReader aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP );
- if ( rStream.GetError() )
- {
- pImp->bStreaming = FALSE;
- return rStream;
- }
-
- // Versions-Maps einlesen
- USHORT nOwnVersion = pImp->nVersion;
- for ( USHORT nVerNo = 0; aVerRec.GetContent(); ++nVerNo )
- {
- // Header f"ur einzelne Version einlesen
- USHORT nVersion, nHStart, nHEnd;
- rStream >> nVersion >> nHStart >> nHEnd;
- USHORT nCount = nHEnd - nHStart + 1;
-
- // Version neuer als bekannt?
- if ( nVerNo >= pImp->aVersions.Count() )
- {
- // neue Version hinzufuegen
- USHORT *pMap = new USHORT[nCount];
- for ( USHORT n = 0; n < nCount; ++n )
- rStream >> pMap[n];
- SetVersionMap( nVersion, nHStart, nHEnd, pMap );
- }
- }
- pImp->nVersion = nOwnVersion;
- }
-
- // Items laden
- FASTBOOL bSecondaryLoaded = FALSE;
- long nSecondaryEnd = 0;
- {
- SfxMultiRecordReader aWhichIdsRec( &rStream, SFX_ITEMPOOL_REC_WHICHIDS);
- while ( aWhichIdsRec.GetContent() )
- {
- // SlotId, Which-Id und Item-Version besorgen
- USHORT nCount, nVersion, nWhich;
- //!USHORT nSlotId = aWhichIdsRec.GetContentTag();
- rStream >> nWhich;
- if ( pImp->nLoadingVersion != pImp->nVersion )
- // Which-Id aus File-Version in Pool-Version verschieben
- nWhich = GetNewWhich( nWhich );
-
- // unbekanntes Item aus neuerer Version
- if ( !IsInRange(nWhich) )
- continue;
-
- rStream >> nVersion;
- rStream >> nCount;
- //!SFX_ASSERTWARNING( !nSlotId || !HasMap() ||
- //! ( nSlotId == GetSlotId( nWhich, FALSE ) ) ||
- //! !GetSlotId( nWhich, FALSE ),
- //! nWhich, "Slot/Which mismatch" );
-
- USHORT nIndex = GetIndex_Impl(nWhich);
- SfxPoolItemArray_Impl **ppArr = pImp->ppPoolItems + nIndex;
-
- // SfxSetItems k"onnten Items aus Sekund"arpools beinhalten
- SfxPoolItem *pDefItem = *(ppStaticDefaults + nIndex);
- pImp->bInSetItem = pDefItem->ISA(SfxSetItem);
- if ( !bSecondaryLoaded && pSecondary && pImp->bInSetItem )
- {
- // an das Ende des eigenen Pools seeken
- ULONG nLastPos = rStream.Tell();
- aPoolRec.Skip();
-
- // Sekund"arpool einlesen
- pSecondary->Load( rStream );
- bSecondaryLoaded = TRUE;
- nSecondaryEnd = rStream.Tell();
-
- // zur"uck zu unseren eigenen Items
- rStream.Seek(nLastPos);
- }
-
- // Items an sich lesen
- readTheItems(rStream, nCount, nVersion, pDefItem, ppArr);
-
- pImp->bInSetItem = FALSE;
- }
- }
-
- // Pool-Defaults lesen
- {
- SfxMultiRecordReader aDefsRec( &rStream, SFX_ITEMPOOL_REC_DEFAULTS );
-
- while ( aDefsRec.GetContent() )
- {
- // SlotId, Which-Id und Item-Version besorgen
- USHORT nVersion, nWhich;
- //!USHORT nSlotId = aDefsRec.GetContentTag();
- rStream >> nWhich;
- if ( pImp->nLoadingVersion != pImp->nVersion )
- // Which-Id aus File-Version in Pool-Version verschieben
- nWhich = GetNewWhich( nWhich );
-
- // unbekanntes Item aus neuerer Version
- if ( !IsInRange(nWhich) )
- continue;
-
- rStream >> nVersion;
- //!SFX_ASSERTWARNING( !HasMap() || ( nSlotId == GetSlotId( nWhich, FALSE ) ),
- //! nWhich, "Slot/Which mismatch" );
-
- // Pool-Default-Item selbst laden
- SfxPoolItem *pItem =
- ( *( ppStaticDefaults + GetIndex_Impl(nWhich) ) )
- ->Create( rStream, nVersion );
- pItem->SetKind( SFX_ITEMS_POOLDEFAULT );
- *( ppPoolDefaults + GetIndex_Impl(nWhich) ) = pItem;
- }
- }
-
- // ggf. Secondary-Pool laden
- aPoolRec.Skip();
- if ( pSecondary )
- {
- if ( !bSecondaryLoaded )
- pSecondary->Load( rStream );
- else
- rStream.Seek( nSecondaryEnd );
- }
-
- // wenn nicht own-Pool, dann kein Name
- if ( aExternName != aName )
- aName.Erase();
-
- pImp->bStreaming = FALSE;
- return rStream;
-};
-
-// -----------------------------------------------------------------------
-
-SvStream &SfxItemPool::Load1_Impl(SvStream &rStream)
-{
- // beim Master ist der Header schon von <Load()> geladen worden
- if ( !pImp->bStreaming )
- {
- // Header des Secondary lesen
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_STARTPOOL_4 );
- rStream >> pImp->nMajorVer >> pImp->nMinorVer;
- }
- sal_uInt32 nAttribSize;
- int bOwnPool = TRUE;
- UniString aExternName;
- if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 2 )
- rStream >> pImp->nLoadingVersion;
- SfxPoolItem::readByteString(rStream, aExternName);
- bOwnPool = aExternName == aName;
- pImp->bStreaming = TRUE;
-
- //! solange wir keine fremden laden k"onnen
- if ( !bOwnPool )
- {
- rStream.SetError(SVSTREAM_FILEFORMAT_ERROR);
- pImp->bStreaming = FALSE;
- return rStream;
- }
-
- // Versionen bis 1.3 k"onnen noch keine Which-Verschiebungen lesen
- if ( pImp->nMajorVer == 1 && pImp->nMinorVer <= 2 &&
- pImp->nVersion < pImp->nLoadingVersion )
- {
- rStream.SetError(ERRCODE_IO_WRONGVERSION);
- pImp->bStreaming = FALSE;
- return rStream;
- }
-
- // Size-Table liegt hinter den eigentlichen Attributen
- rStream >> nAttribSize;
-
- // Size-Table einlesen
- ULONG nStartPos = rStream.Tell();
- rStream.SeekRel( nAttribSize );
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_SIZES );
- sal_uInt32 nSizeTableLen;
- rStream >> nSizeTableLen;
- sal_Char *pBuf = new sal_Char[nSizeTableLen];
- rStream.Read( pBuf, nSizeTableLen );
- ULONG nEndOfSizes = rStream.Tell();
- SvMemoryStream aSizeTable( pBuf, nSizeTableLen, STREAM_READ );
-
- // ab Version 1.3 steht in der Size-Table eine Versions-Map
- if ( pImp->nMajorVer > 1 || pImp->nMinorVer >= 3 )
- {
- // Version-Map finden (letztes ULONG der Size-Table gibt Pos an)
- rStream.Seek( nEndOfSizes - sizeof(sal_uInt32) );
- sal_uInt32 nVersionMapPos;
- rStream >> nVersionMapPos;
- rStream.Seek( nVersionMapPos );
-
- // Versions-Maps einlesen
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_VERSIONMAP );
- USHORT nVerCount;
- rStream >> nVerCount;
- for ( USHORT nVerNo = 0; nVerNo < nVerCount; ++nVerNo )
- {
- // Header f"ur einzelne Version einlesen
- USHORT nVersion, nHStart, nHEnd;
- rStream >> nVersion >> nHStart >> nHEnd;
- USHORT nCount = nHEnd - nHStart + 1;
- USHORT nBytes = (nCount)*sizeof(USHORT);
-
- // Version neuer als bekannt?
- if ( nVerNo >= pImp->aVersions.Count() )
- {
- // neue Version hinzufuegen
- USHORT *pMap = new USHORT[nCount];
- for ( USHORT n = 0; n < nCount; ++n )
- rStream >> pMap[n];
- SetVersionMap( nVersion, nHStart, nHEnd, pMap );
- }
- else
- // Version schon bekannt => "uberspringen
- rStream.SeekRel( nBytes );
- }
- }
-
- // Items laden
- rStream.Seek( nStartPos );
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ITEMS );
- FASTBOOL bSecondaryLoaded = FALSE;
- long nSecondaryEnd = 0;
- USHORT nWhich, nSlot;
- while ( rStream >> nWhich, nWhich )
- {
- // ggf. Which-Id aus alter Version verschieben?
- if ( pImp->nLoadingVersion != pImp->nVersion )
- nWhich = GetNewWhich( nWhich );
-
- rStream >> nSlot;
- USHORT nMappedWhich = GetWhich(nSlot, FALSE);
- int bKnownItem = bOwnPool || IsWhich(nMappedWhich);
-
- USHORT nRef, nCount, nVersion;
- sal_uInt32 nAttrSize;
- rStream >> nVersion >> nCount;
-
- SfxPoolItemArray_Impl **ppArr = 0;
- SfxPoolItemArray_Impl *pNewArr = 0;
- SfxPoolItem *pDefItem = 0;
- if ( bKnownItem )
- {
- if ( !bOwnPool )
- nWhich = nMappedWhich;
-
- //!SFX_ASSERTWARNING( !nSlot || !HasMap() ||
- //! ( nSlot == GetSlotId( nWhich, FALSE ) ) ||
- //! !GetSlotId( nWhich, FALSE ),
- //! nWhich, "Slot/Which mismatch" );
-
- USHORT nIndex = GetIndex_Impl(nWhich);
- ppArr = pImp->ppPoolItems + nIndex;
- pNewArr = new SfxPoolItemArray_Impl( nCount );
- pDefItem = *(ppStaticDefaults + nIndex);
- }
-
- // Position vor ersten Item merken
- ULONG nLastPos = rStream.Tell();
-
- // SfxSetItems k"onnten Items aus Sekund"arpools beinhalten
- if ( !bSecondaryLoaded && pSecondary && pDefItem->ISA(SfxSetItem) )
- {
- // an das Ende des eigenen Pools seeken
- rStream.Seek(nEndOfSizes);
- CHECK_FILEFORMAT_RELEASE( rStream, SFX_ITEMPOOL_TAG_ENDPOOL, pNewArr );
- CHECK_FILEFORMAT_RELEASE( rStream, SFX_ITEMPOOL_TAG_ENDPOOL, pNewArr );
-
- // Sekund"arpool einlesen
- pSecondary->Load1_Impl( rStream );
- bSecondaryLoaded = TRUE;
- nSecondaryEnd = rStream.Tell();
-
- // zur"uck zu unseren eigenen Items
- rStream.Seek(nLastPos);
- }
-
- // Items an sich lesen
- for ( USHORT j = 0; j < nCount; ++j )
- {
- ULONG nPos = nLastPos;
- rStream >> nRef;
-
- if ( bKnownItem )
- {
- SfxPoolItem *pItem = 0;
- if ( nRef )
- {
- pItem = pDefItem->Create(rStream, nVersion);
-
- if ( !bPersistentRefCounts )
- // bis <SfxItemPool::LoadCompleted()> festhalten
- AddRef(*pItem, 1);
- else
- {
- if ( nRef > SFX_ITEMS_OLD_MAXREF )
- pItem->SetKind( nRef );
- else
- AddRef(*pItem, nRef);
- }
- }
-
- pNewArr->C40_INSERT( SfxPoolItem, pItem, j);
-
- // restliche gespeicherte Laenge skippen (neueres Format)
- nLastPos = rStream.Tell();
- }
-
- aSizeTable >> nAttrSize;
- SFX_ASSERT( !bKnownItem || ( nPos + nAttrSize) >= nLastPos,
- nPos,
- "too many bytes read - version mismatch?" );
-
- if ( !bKnownItem || ( nLastPos < (nPos + nAttrSize) ) )
- {
- nLastPos = nPos + nAttrSize;
- rStream.Seek( nLastPos );
- }
- }
-
- if ( bKnownItem )
- {
- SfxPoolItemArray_Impl *pOldArr = *ppArr;
- *ppArr = pNewArr;
-
- // die Items merken, die schon im Pool sind
- int bEmpty = TRUE;
- if ( 0 != pOldArr )
- for ( USHORT n = 0; bEmpty && n < pOldArr->Count(); ++n )
- bEmpty = pOldArr->GetObject(n) == 0;
- DBG_ASSERTWARNING( bEmpty, "loading non-empty pool" );
- if ( !bEmpty )
- {
- // f"ur alle alten suchen, ob ein gleiches neues existiert
- for ( USHORT nOld = 0; nOld < pOldArr->Count(); ++nOld )
- {
- SfxPoolItem *pOldItem = (*pOldArr)[nOld];
- if ( pOldItem )
- {
- int bFound = FALSE;
- for ( USHORT nNew = 0;
- !bFound && nNew < (*ppArr)->Count();
- ++nNew )
- {
- SfxPoolItem *&rpNewItem =
- (SfxPoolItem*&)(*ppArr)->GetData()[nNew];
-
- if ( rpNewItem && *rpNewItem == *pOldItem )
- {
- AddRef( *pOldItem, rpNewItem->GetRefCount() );
- SetRefCount( *rpNewItem, 0 );
- delete rpNewItem;
- rpNewItem = pOldItem;
- bFound = TRUE;
- SFX_TRACE( "reusing item", pOldItem );
- }
- }
- //! DBG_ASSERT( bFound, "old-item not found in file" );
- if ( !bFound )
- {
- SFX_TRACE( "item not found: ", pOldItem );
- }
- }
- }
- }
- delete pOldArr; /* @@@ */
- }
- }
-
- // Pool-Defaults lesen
- if ( pImp->nMajorVer > 1 || pImp->nMinorVer > 0 )
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_DEFAULTS );
-
- ULONG nLastPos = rStream.Tell();
- while ( rStream >> nWhich, nWhich )
- {
- // ggf. Which-Id aus alter Version verschieben?
- if ( pImp->nLoadingVersion != pImp->nVersion )
- nWhich = GetNewWhich( nWhich );
-
- rStream >> nSlot;
- USHORT nMappedWhich = GetWhich(nSlot, FALSE);
- int bKnownItem = bOwnPool || IsWhich(nMappedWhich);
-
- ULONG nPos = nLastPos;
- sal_uInt32 nSize;
- USHORT nVersion;
- rStream >> nVersion;
-
- if ( bKnownItem )
- {
- if ( !bOwnPool )
- nWhich = nMappedWhich;
- SfxPoolItem *pItem =
- ( *( ppStaticDefaults + GetIndex_Impl(nWhich) ) )
- ->Create( rStream, nVersion );
- pItem->SetKind( SFX_ITEMS_POOLDEFAULT );
- *( ppPoolDefaults + GetIndex_Impl(nWhich) ) = pItem;
- }
-
- nLastPos = rStream.Tell();
- aSizeTable >> nSize;
- SFX_ASSERT( ( nPos + nSize) >= nLastPos, nPos,
- "too many bytes read - version mismatch?" );
- if ( nLastPos < (nPos + nSize) )
- rStream.Seek( nPos + nSize );
- }
-
- delete[] pBuf;
- rStream.Seek(nEndOfSizes);
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL );
- CHECK_FILEFORMAT( rStream, SFX_ITEMPOOL_TAG_ENDPOOL );
-
- if ( pSecondary )
- {
- if ( !bSecondaryLoaded )
- pSecondary->Load1_Impl( rStream );
- else
- rStream.Seek( nSecondaryEnd );
- }
-
- if ( aExternName != aName )
- aName.Erase();
-
- pImp->bStreaming = FALSE;
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-const SfxPoolItem* SfxItemPool::LoadSurrogate
-(
- SvStream& rStream, // vor einem Surrogat positionierter Stream
- USHORT& rWhich, // Which-Id des zu ladenden <SfxPoolItem>s
- USHORT nSlotId, // Slot-Id des zu ladenden <SfxPoolItem>s
- const SfxItemPool* pRefPool // <SfxItemPool> in dem das Surrogat gilt
-)
-
-/* [Beschreibung]
-
- L"adt Surrogat aus 'rStream' und liefert das dadurch in 'rRefPool'
- repr"asentierte SfxPoolItem zu"ruck. Ist das im Stream befindliche
- Surrogat == SFX_ITEMS_DIRECT (!SFX_ITEM_POOLABLE) wird 0 zur"uckgegeben,
- das Item ist direkt aus dem Stream zu laden. Bei 0xfff0 (SFX_ITEMS_NULL)
- wird auch 0 zurueckgegeben und rWhich auf 0 gesetzt, das Item ist nicht
- verfuegbar.
-
- Ansonsten wird ber"ucksichtigt, ob der betroffene Pool ohne Ref-Counts
- geladen wird, ob aus einem neuen Pool nachgeladen wird (&rRefPool != this)
- oder ob aus einem g"anzlich anders aufgebauten Pool geladen wird.
-
- Wird aus einem anders aufgebauten Pool geladen und die 'nSlotId' kann
- nicht in eine Which-Id dieses Pools gemappt werden, wird ebenfalls 0
- zur"uckgeliefert.
-
- Preconditions: - Pool mu\s geladen sein
- - LoadCompleted darf noch nicht gerufen worden sein
- - 'rStream' steht genau an der Position, an der ein
- Surrogat f"ur ein Item mit der SlotId 'nSlotId' und
- der WhichId 'rWhichId' mit StoreSurrogate gepeichert
- wurde
-
- Postconditions: - 'rStream' ist so positioniert, wie auch StoreSurrogate
- sein speichern beendet hatte
- - konnte ein Item geladen werden, befindet es sich
- in diesem SfxItemPool
- - 'rWhichId' enth"alt die ggf. gemappte Which-Id
- Laufzeit: Tiefe des Ziel Sekund"arpools * 10 + 10
-
- [Querverweise]
-
- <SfxItemPool::StoreSurrogate(SvStream&,const SfxPoolItem &)const>
-*/
-
-{
- // erstmal das Surrogat lesen
- USHORT nSurrogat;
- rStream >> nSurrogat;
-
- // direkt gespeichertes Item?
- if ( SFX_ITEMS_DIRECT == nSurrogat )
- return 0;
-
- // nicht vorhandenes Item?
- if ( SFX_ITEMS_NULL == nSurrogat )
- {
- rWhich = 0;
- return 0;
- }
-
- // Bei einem identisch aufgebauten Pool (im Stream) kann das Surrogat
- // auf jeden Fall aufgel"ost werden.
- if ( !pRefPool )
- pRefPool = this;
- FASTBOOL bResolvable = pRefPool->GetName().Len() > 0;
- if ( !bResolvable )
- {
- // Bei einem anders aufgebauten Pool im Stream, mu\s die SlotId
- // aus dem Stream in eine Which-Id gemappt werden k"onnen.
- USHORT nMappedWhich = nSlotId ? GetWhich(nSlotId, TRUE) : 0;
- if ( IsWhich(nMappedWhich) )
- {
- // gemappte SlotId kann "ubernommen werden
- rWhich = nMappedWhich;
- bResolvable = TRUE;
- }
- }
-
- // kann Surrogat aufgel"ost werden?
- const SfxPoolItem *pItem = 0;
- if ( bResolvable )
- {
- for ( SfxItemPool *pTarget = this; pTarget; pTarget = pTarget->pSecondary )
- {
- // richtigen (Folge-) Pool gefunden?
- if ( pTarget->IsInRange(rWhich) )
- {
- // dflt-Attribut?
- if ( SFX_ITEMS_STATICDEFAULT == nSurrogat )
- return *(pTarget->ppStaticDefaults +
- pTarget->GetIndex_Impl(rWhich));
-
- SfxPoolItemArray_Impl* pItemArr = *(pTarget->pImp->ppPoolItems +
- pTarget->GetIndex_Impl(rWhich));
- pItem = pItemArr && nSurrogat < pItemArr->Count()
- ? (*pItemArr)[nSurrogat]
- : 0;
- if ( !pItem )
- {
- DBG_ERROR( "can't resolve surrogate" );
- rWhich = 0; // nur zur Sicherheit fuer richtige Stream-Pos
- return 0;
- }
-
- // Nachladen aus Ref-Pool?
- if ( pRefPool != pMaster )
- return &pTarget->Put( *pItem );
-
- // Referenzen sind NICHT schon mit Pool geladen worden?
- if ( !pTarget->HasPersistentRefCounts() )
- AddRef( *pItem, 1 );
- else
- return pItem;
-
- return pItem;
- }
- }
-
- SFX_ASSERT( FALSE, rWhich, "can't resolve Which-Id in LoadSurrogate" );
- }
-
- return 0;
-}
-
-//-------------------------------------------------------------------------
-
-
-FASTBOOL SfxItemPool::StoreSurrogate
-(
- SvStream& rStream,
- const SfxPoolItem* pItem
-) const
-
-/* [Beschreibung]
-
- Speichert ein Surrogat f"ur '*pItem' in 'rStream'.
-
-
- [R"uckgabewert]
-
- FASTBOOL TRUE
- es wurde ein echtes Surrogat gespeichert, auch
- SFX_ITEMS_NULL bei 'pItem==0',
- SFX_ITEMS_STATICDEFAULT und SFX_ITEMS_POOLDEFAULT
- gelten als 'echte' Surrogate
-
- FALSE
- es wurde ein Dummy-Surrogat (SFX_ITEMS_DIRECT)
- gespeichert, das eigentliche Item mu\s direkt
- hinterher selbst gespeichert werden
-*/
-
-{
- if ( pItem )
- {
- FASTBOOL bRealSurrogate = IsItemFlag(*pItem, SFX_ITEM_POOLABLE);
- rStream << ( bRealSurrogate
- ? GetSurrogate( pItem )
- : (UINT16) SFX_ITEMS_DIRECT );
- return bRealSurrogate;
- }
-
- rStream << (UINT16) SFX_ITEMS_NULL;
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetSurrogate(const SfxPoolItem *pItem) const
-{
- DBG_CHKTHIS(SfxItemPool, 0);
- DBG_ASSERT( pItem, "no 0-Pointer Surrogate" );
- DBG_ASSERT( !IsInvalidItem(pItem), "no Invalid-Item Surrogate" );
- DBG_ASSERT( !IsPoolDefaultItem(pItem), "no Pool-Default-Item Surrogate" );
-
- if ( !IsInRange(pItem->Which()) )
- {
- if ( pSecondary )
- return pSecondary->GetSurrogate( pItem );
- SFX_ASSERT( 0, pItem->Which(), "unknown Which-Id - dont ask me for surrogates" );
- }
-
- // Pointer auf static- oder pool-dflt-Attribut?
- if( IsStaticDefaultItem(pItem) || IsPoolDefaultItem(pItem) )
- return SFX_ITEMS_STATICDEFAULT;
-
- SfxPoolItemArray_Impl* pItemArr = *(pImp->ppPoolItems + GetIndex_Impl(pItem->Which()));
- DBG_ASSERT(pItemArr, "ItemArr nicht vorhanden");
- const USHORT nCount = pItemArr->Count();
- for ( USHORT i = 0; i < nCount; ++i )
- {
- const SfxPoolItem *p = (*pItemArr)[i];
- if ( p == pItem )
- return i;
- }
- SFX_ASSERT( 0, pItem->Which(), "Item nicht im Pool");
- return SFX_ITEMS_NULL;
-}
-
-// -----------------------------------------------------------------------
-
-FASTBOOL SfxItemPool::IsInStoringRange( USHORT nWhich ) const
-{
- return nWhich >= pImp->nStoringStart &&
- nWhich <= pImp->nStoringEnd;
-}
-
-//------------------------------------------------------------------------
-
-void SfxItemPool::SetStoringRange( USHORT nFrom, USHORT nTo )
-
-/* [Beschreibung]
-
- Mit dieser Methode kann der Which-Bereich eingeengt werden, der
- von ItemSets dieses Pool (und dem Pool selbst) gespeichert wird.
- Die Methode muss dazu vor <SfxItemPool::Store()> gerufen werden
- und die Werte muessen auch noch gesetzt sein, wenn das eigentliche
- Dokument (also die ItemSets gespeicher werden).
-
- Ein Zuruecksetzen ist dann nicht noetig, wenn dieser Range vor
- JEDEM Speichern richtig gesetzt wird, da er nur beim Speichern
- beruecksichtigt wird.
-
- Dieses muss fuer das 3.1-Format gemacht werden, da dort eine
- Bug in der Pool-Lade-Methode vorliegt.
-*/
-
-{
- pImp->nStoringStart = nFrom;
- pImp->nStoringEnd = nTo;
-}
-
-// -----------------------------------------------------------------------
-
-void SfxItemPool::SetVersionMap
-(
- USHORT nVer, /* neue Versionsnummer */
- USHORT nOldStart, /* alte erste Which-Id */
- USHORT nOldEnd, /* alte letzte Which-Id */
- USHORT* pOldWhichIdTab /* Array mit genau dem Aufbau der Which-Ids
- der vorhergehenden Version, in denen
- die jeweils neue Which-Id steht. */
-)
-
-/* [Beschreibung]
-
- Mit dieser Methode k"onnen neue, inkompatible Which-Id-Folgen oder
- Verteilungen realisiert werden. Pools, die noch mit alten Versionen
- gespeichert wurden, werden dann "uber die angegebene Tabelle solange
- gemappt, bis die aktuelle Version erreicht ist. Neuere Pools k"onnen
- unter Verlust neuer Attribute geladen werden, da die Map mit dem Pool
- gespeichert wird.
-
- Precondition: Pool darf noch nicht geladen sein
- Postcondition: Which-Ids aus fr"uheren Versionen k"onnen bei Laden auf
- Version 'nVer' gemappt werden
- Laufzeit: 1.5 * new + 10
-
- [Anmerkung]
-
- F"ur neue Which-Ranges (nStart,nEnd) m"ssen im Vergleich zur Vorg"anger-
- Version (nOldStart,nOldEnd) immer gelten, da\s (nOldStart,nOldEnd)
- vollst"andig in (nStart,nEnd) enthalten ist. Es ist also zul"assig, den
- Which-Range in beide Richtungen zu erweitern, auch durch Einf"ugung
- von Which-Ids, nicht aber ihn zu beschneiden.
-
- Diese Methode sollte nur im oder direkt nach Aufruf des Konstruktors
- gerufen werden.
-
- Das Array mu\s statisch sein, da es nicht kopiert wird und au\serdem
- im Copy-Ctor des SfxItemPool wiederverwendet wird.
-
-
- [Beispiel]
-
- Urspr"unglich (Version 0) hatte der Pool folgende Which-Ids:
-
- 1:A, 2:B, 3:C, 4:D
-
- Nun soll eine neue Version (Version 1) zwei zus"atzliche Ids X und Y
- zwischen B und C erhalten, also wie folgt aussehen:
-
- 1:A, 2:B, 3:X, 4:Y, 5:C, 6:D
-
- Dabei haben sich also die Ids 3 und 4 ge"andert. F"ur die neue Version
- m"u\ste am Pool folgendes gesetzt werden:
-
- static USHORT nVersion1Map = { 1, 2, 5, 6 };
- pPool->SetVersionMap( 1, 1, 4, &nVersion1Map );
-
-
- [Querverweise]
-
- <SfxItemPool::IsLoadingVersionCurrent()const>
- <SfxItemPool::GetNewWhich(USHORT)>
- <SfxItemPool::GetVersion()const>
- <SfxItemPool::GetLoadingVersion()const>
-*/
-
-{
- // neuen Map-Eintrag erzeugen und einf"ugen
- const SfxPoolVersion_Impl *pVerMap = new SfxPoolVersion_Impl(
- nVer, nOldStart, nOldEnd, pOldWhichIdTab );
- pImp->aVersions.Insert( pVerMap, pImp->aVersions.Count() );
-
- DBG_ASSERT( nVer > pImp->nVersion, "Versions not sorted" );
- pImp->nVersion = nVer;
-
- // Versions-Range anpassen
- for ( USHORT n = 0; n < nOldEnd-nOldStart+1; ++n )
- {
- USHORT nWhich = pOldWhichIdTab[n];
- if ( nWhich < pImp->nVerStart )
- {
- if ( !nWhich )
- nWhich = 0;
- pImp->nVerStart = nWhich;
- }
- else if ( nWhich > pImp->nVerEnd )
- pImp->nVerEnd = nWhich;
- }
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetNewWhich
-(
- USHORT nFileWhich // die aus dem Stream geladene Which-Id
-) const
-
-/* [Beschreibung]
-
- Diese Methoden rechnet Which-Ids aus einem File-Format in die der
- aktuellen Pool-Version um. Ist das File-Format "alter, werden die vom
- Pool-Entwickler mit SetVersion() gesetzten Tabellen verwendet,
- ist das File-Format neuer, dann die aus dem File geladenen Tabellen.
- Im letzteren Fall kann ggf. nicht jede Which-Id gemappt werden,
- so da\s 0 zur"uckgeliefert wird.
-
- Die Berechnung ist nur f"ur Which-Ids definiert, die in der betreffenden
- File-Version unterst"utzt wurden. Dies ist per Assertion abgesichert.
-
- Precondition: Pool mu\s geladen sein
- Postcondition: unver"andert
- Laufzeit: linear(Anzahl der Sekund"arpools) +
- linear(Differenz zwischen alter und neuer Version)
-
-
- [Querverweise]
-
- <SfxItemPool::IsLoadingVersionCurrent()const>
- <SfxItemPool::SetVersionMap(USHORT,USHORT,USHORT,USHORT*)>
- <SfxItemPool::GetVersion()const>
- <SfxItemPool::GetLoadingVersion()const>
-*/
-
-{
- // (Sekund"ar-) Pool bestimmen
- if ( !IsInVersionsRange(nFileWhich) )
- {
- if ( pSecondary )
- return pSecondary->GetNewWhich( nFileWhich );
- SFX_ASSERT( 0, nFileWhich, "unknown which in GetNewWhich()" );
- }
-
- // Version neuer/gleich/"alter?
- short nDiff = (short)pImp->nLoadingVersion - (short)pImp->nVersion;
-
- // Which-Id einer neueren Version?
- if ( nDiff > 0 )
- {
- // von der Top-Version bis runter zur File-Version stufenweise mappen
- for ( USHORT nMap = pImp->aVersions.Count(); nMap > 0; --nMap )
- {
- SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap-1];
- if ( pVerInfo->_nVer > pImp->nVersion )
- { USHORT nOfs;
- USHORT nCount = pVerInfo->_nEnd - pVerInfo->_nStart + 1;
- for ( nOfs = 0;
- nOfs <= nCount &&
- pVerInfo->_pMap[nOfs] != nFileWhich;
- ++nOfs )
- continue;
-
- if ( pVerInfo->_pMap[nOfs] == nFileWhich )
- nFileWhich = pVerInfo->_nStart + nOfs;
- else
- return 0;
- }
- else
- break;
- }
- }
-
- // Which-Id einer neueren Version?
- else if ( nDiff < 0 )
- {
- // von der File-Version bis zur aktuellen Version stufenweise mappen
- for ( USHORT nMap = 0; nMap < pImp->aVersions.Count(); ++nMap )
- {
- SfxPoolVersion_Impl *pVerInfo = pImp->aVersions[nMap];
- if ( pVerInfo->_nVer > pImp->nLoadingVersion )
- {
- DBG_ASSERT( nFileWhich >= pVerInfo->_nStart &&
- nFileWhich <= pVerInfo->_nEnd,
- "which-id unknown in version" );
- nFileWhich = pVerInfo->_pMap[nFileWhich - pVerInfo->_nStart];
- }
- }
- }
-
- // originale (nDiff==0) bzw. gemappte (nDiff!=0) Id zur"uckliefern
- return nFileWhich;
-}
-
-// -----------------------------------------------------------------------
-
-
-FASTBOOL SfxItemPool::IsInVersionsRange( USHORT nWhich ) const
-{
- return nWhich >= pImp->nVerStart && nWhich <= pImp->nVerEnd;
-}
-
-// -----------------------------------------------------------------------
-
-FASTBOOL SfxItemPool::IsCurrentVersionLoading() const
-
-/* [Beschreibung]
-
- Mit dieser Methode kann festgestellt werden, ob die geladene Pool-Version
- dem aktuellen Pool-Aufbau entspricht.
-
- Precondition: Pool mu\s geladen sein
- Postcondition: unver"andert
- Laufzeit: linear(Anzahl der Sekund"arpools)
-
-
- [Querverweise]
-
- <SfxItemPool::SetVersionMap(USHORT,USHORT,USHORT,USHORT*)>
- <SfxItemPool::GetNewWhich(USHORT)const>
- <SfxItemPool::GetVersion()const>
- <SfxItemPool::GetLoadingVersion()const>
-*/
-
-{
- return ( pImp->nVersion == pImp->nLoadingVersion ) &&
- ( !pSecondary || pSecondary->IsCurrentVersionLoading() );
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetVersion() const
-
-/* [Beschreibung]
-
- Diese Methode liefert die aktuelle Versionsnummer des SfxItemPool-Aufbaus
- (also des Which-Bereichs).
-
- Precondition: keine
- Postcondition: unver"andert
- Laufzeit: 2
-
-
- [Anmerkung]
-
- Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools
- ber"ucksichtigt werden.
-
-
- [Querverweise]
-
- <SfxItemPool::IsLoadingVersionCurrent()const>
- <SfxItemPool::SetVersionMap(USHORT,USHORT,USHORT,USHORT*)>
- <SfxItemPool::GetNewWhich(USHORT)const>
- <SfxItemPool::GetLoadingVersion()const>
-*/
-
-{
- return pImp->nVersion;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxItemPool::GetLoadingVersion() const
-
-/* [Beschreibung]
-
- Diese Methode liefert die Versionsnummer des SfxItemPool-Aufbaus
- (also des Which-Bereichs), die bei Laden vorgefunden wurde.
-
- Precondition: Pool mu\s geladen sein
- Postcondition: unver"andert
- Laufzeit: 2
-
-
- [Anmerkung]
-
- Achtung: Es mu\s ggf. die Versionsnummer von Sekund"arpools
- ber"ucksichtigt werden.
-
-
- [Querverweise]
-
- <SfxItemPool::IsLoadingVersionCurrent()const>
- <SfxItemPool::SetVersionMap(USHORT,USHORT,USHORT,USHORT*)>
- <SfxItemPool::GetNewWhich(USHORT)const>
- <SfxItemPool::GetVersion()const>
-*/
-
-{
- return pImp->nLoadingVersion;
-}
-
-//-------------------------------------------------------------------------
-
-FASTBOOL SfxItemPool::IsVer2_Impl() const
-{
- return pMaster->pImp->nMajorVer >= 2;
-}
-
-//-------------------------------------------------------------------------
-
-
-FASTBOOL SfxItemPool::StoreItem( SvStream &rStream, const SfxPoolItem &rItem,
- FASTBOOL bDirect ) const
-
-/* [Beschreibung]
-
- Speichert das <SfxPoolItem> 'rItem' in den <SvStream> 'rStream'
- entweder als Surrogat ('bDirect == FALSE') oder direkt mit 'rItem.Store()'.
- Nicht poolable Items werden immer direkt gespeichert. Items ohne Which-Id,
- also SID-Items, werden nicht gespeichert, ebenso wenn Items, die in der
- File-Format-Version noch nicht vorhanden waren (return FALSE).
-
- Das Item wird im Stream wie folgt abgelegt:
-
- USHORT rItem.Which()
- USHORT GetSlotId( rItem.Which() ) bzw. 0 falls nicht verf"urbar
- USHORT GetSurrogate( &rItem ) bzw. SFX_ITEM_DIRECT bei '!SFX_ITEM_POOLBLE'
-
- optional (falls 'bDirect == TRUE' oder '!rItem.IsPoolable()':
-
- USHORT rItem.GetVersion()
- ULONG Size
- Size rItem.Store()
-
-
- [Querverweise]
-
- <SfxItemPool::LoadItem(SvStream&,FASTBOOL)const>
-*/
-
-{
- DBG_ASSERT( !IsInvalidItem(&rItem), "cannot store invalid items" );
-
- if ( IsSlot( rItem.Which() ) )
- return FALSE;
- const SfxItemPool *pPool = this;
- while ( !pPool->IsInStoringRange(rItem.Which()) )
- if ( 0 == ( pPool = pPool->pSecondary ) )
- return FALSE;
-
- DBG_ASSERT( !pImp->bInSetItem || !rItem.ISA(SfxSetItem),
- "SetItem contains ItemSet with SetItem" );
-
- USHORT nSlotId = pPool->GetSlotId( rItem.Which(), TRUE );
- USHORT nItemVersion = rItem.GetVersion(_nFileFormatVersion);
- if ( USHRT_MAX == nItemVersion )
- return FALSE;
-
- rStream << rItem.Which() << nSlotId;
- if ( bDirect || !pPool->StoreSurrogate( rStream, &rItem ) )
- {
- rStream << nItemVersion;
- rStream << (UINT32) 0L; // Platz fuer Laenge in Bytes
- ULONG nIStart = rStream.Tell();
- rItem.Store(rStream, nItemVersion);
- ULONG nIEnd = rStream.Tell();
- rStream.Seek( nIStart-4 );
- rStream << (INT32) ( nIEnd-nIStart );
- rStream.Seek( nIEnd );
- }
-
- return TRUE;
-}
-
-//-------------------------------------------------------------------------
-
-
-const SfxPoolItem* SfxItemPool::LoadItem( SvStream &rStream, FASTBOOL bDirect,
- const SfxItemPool *pRefPool )
-
-// pRefPool==-1 => nicht putten!
-
-{
- USHORT nWhich, nSlot; // nSurrogate;
- rStream >> nWhich >> nSlot;
-
- BOOL bDontPut = (SfxItemPool*)-1 == pRefPool;
- if ( bDontPut || !pRefPool )
- pRefPool = this;
-
- // richtigen Sekund"ar-Pool finden
- while ( !pRefPool->IsInVersionsRange(nWhich) )
- {
- if ( pRefPool->pSecondary )
- pRefPool = pRefPool->pSecondary;
- else
- {
- // WID in der Version nicht vorhanden => ueberspringen
- USHORT nSurro, nVersion, nLen;
- rStream >> nSurro;
- if ( SFX_ITEMS_DIRECT == nSurro )
- {
- rStream >> nVersion >> nLen;
- rStream.SeekRel( nLen );
- }
- return 0;
- }
- }
-
- // wird eine andere Version geladen?
- FASTBOOL bCurVersion = pRefPool->IsCurrentVersionLoading();
- if ( !bCurVersion )
- // Which-Id auf neue Version mappen
- nWhich = pRefPool->GetNewWhich( nWhich );
-
- DBG_ASSERT( !nWhich || !pImp->bInSetItem ||
- !pRefPool->ppStaticDefaults[pRefPool->GetIndex_Impl(nWhich)]->ISA(SfxSetItem),
- "loading SetItem in ItemSet of SetItem" );
-
- // soll "uber Surrogat geladen werden?
- const SfxPoolItem *pItem = 0;
- if ( !bDirect )
- {
- // Which-Id in dieser Version bekannt?
- if ( nWhich )
- // Surrogat laden, reagieren falls keins vorhanden
- pItem = LoadSurrogate( rStream, nWhich, nSlot, pRefPool );
- else
- // sonst "uberspringen
- rStream.SeekRel( sizeof(USHORT) );
- }
-
- // wird direkt, also nicht "uber Surrogat geladen?
- if ( bDirect || ( nWhich && !pItem ) )
- {
- // bDirekt bzw. nicht IsPoolable() => Item direkt laden
- USHORT nVersion;
- sal_uInt32 nLen;
- rStream >> nVersion >> nLen;
- ULONG nIStart = rStream.Tell();
-
- // Which-Id in dieser Version bekannt?
- if ( nWhich )
- {
- // Item direkt laden
- SfxPoolItem *pNewItem =
- pRefPool->GetDefaultItem(nWhich).Create(rStream, nVersion);
- if ( bDontPut )
- pItem = pNewItem;
- else
- if ( pNewItem )
- {
- pItem = &Put(*pNewItem);
- delete pNewItem;
- }
- else
- pItem = 0;
- ULONG nIEnd = rStream.Tell();
- DBG_ASSERT( nIEnd <= (nIStart+nLen), "read past end of item" );
- if ( (nIStart+nLen) != nIEnd )
- rStream.Seek( nIStart+nLen );
- }
- else
- // Item "uberspringen
- rStream.Seek( nIStart+nLen );
- }
-
- return pItem;
-}
-
-
diff --git a/svtools/source/items1/poolitem.cxx b/svtools/source/items1/poolitem.cxx
deleted file mode 100644
index ef160b4a8b4c..000000000000
--- a/svtools/source/items1/poolitem.cxx
+++ /dev/null
@@ -1,527 +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: poolitem.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_svtools.hxx"
-
-#include <svtools/poolitem.hxx>
-#include <tools/stream.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxPoolItem)
-DBG_NAME(SfxVoidItem)
-// @@@ DBG_NAME(SfxInvalidItem);
-DBG_NAME(SfxItemHandle)
-
-BYTE nSfxFlag8Val[8] =
-{
- 1, 2, 4, 8, 16, 32, 64, 128
-};
-
-USHORT nSfxFlag16Val[16] =
-{
- 1, 2, 4, 8, 16, 32, 64, 128, 256, 512,
- 1024, 2048, 4096, 8192, 16384, 32768
-};
-
-ULONG nSfxFlag32Val[32] =
-{
- 0x1L, 0x2L, 0x4L, 0x8L,
- 0x10L, 0x20L, 0x40L, 0x80L,
- 0x100L, 0x200L, 0x400L, 0x800L,
- 0x1000L, 0x2000L, 0x40000L, 0x8000L,
- 0x10000L, 0x20000L, 0x40000L, 0x80000L,
- 0x100000L, 0x200000L, 0x400000L, 0x800000L,
- 0x1000000L, 0x2000000L, 0x4000000L, 0x8000000L,
- 0x10000000L, 0x20000000L, 0x40000000L, 0x80000000L
-};
-
-// RTTI ------------------------------------------------------------------
-
-TYPEINIT0(SfxPoolItem);
-TYPEINIT1(SfxVoidItem, SfxPoolItem);
-// @@@ TYPEINIT1(SfxInvalidItem, SfxPoolItem);
-TYPEINIT1(SfxSetItem, SfxPoolItem);
-// @@@ TYPEINIT1(SfxItemChangedHint, SfxHint);
-
-// ------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 1
-static ULONG nItemCount = 0;
-
-const char* pw1 = "Wow! 10.000 items!";
-const char* pw2 = "Wow! 100.000 items!";
-const char* pw3 = "Wow! 1.000.000 items!";
-const char* pw4 = "Wow! 50.000.000 items!";
-const char* pw5 = "Wow! 10.000.000 items!";
-#endif
-
-IMPL_PTRHINT(SfxPoolItemHint,SfxPoolItem)
-
-// SfxPoolItem -----------------------------------------------------------
-SfxPoolItem::SfxPoolItem( USHORT nW )
- : nRefCount( 0 ),
- nWhich( nW )
- , nKind( 0 )
-{
- DBG_CTOR(SfxPoolItem, 0);
- DBG_ASSERT(nW <= SHRT_MAX, "Which Bereich ueberschritten");
-#if OSL_DEBUG_LEVEL > 1
- ++nItemCount;
- if ( pw1 && nItemCount>=10000 )
- {
- DBG_WARNING( pw1 );
- pw1 = NULL;
- }
- if ( pw2 && nItemCount>=100000 )
- {
- DBG_WARNING( pw2 );
- pw2 = NULL;
- }
- if ( pw3 && nItemCount>=1000000 )
- {
- DBG_WARNING( pw3 );
- pw3 = NULL;
- }
- if ( pw4 && nItemCount>=5000000 )
- {
- DBG_WARNING( pw4 );
- pw4 = NULL;
- }
- if ( pw5 && nItemCount>=10000000 )
- {
- DBG_WARNING( pw5 );
- pw5 = NULL;
- }
-#endif
-}
-
-// -----------------------------------------------------------------------
-SfxPoolItem::SfxPoolItem( const SfxPoolItem& rCpy )
- : nRefCount( 0 ), // wird ja ein neues Object!
- nWhich( rCpy.Which() ) // Funktion rufen wg. ChkThis()
- , nKind( 0 )
-{
- DBG_CTOR(SfxPoolItem, 0);
-#if OSL_DEBUG_LEVEL > 1
- ++nItemCount;
- if ( pw1 && nItemCount>=10000 )
- {
- DBG_WARNING( pw1 );
- pw1 = NULL;
- }
- if ( pw2 && nItemCount>=100000 )
- {
- DBG_WARNING( pw2 );
- pw2 = NULL;
- }
- if ( pw3 && nItemCount>=1000000 )
- {
- DBG_WARNING( pw3 );
- pw3 = NULL;
- }
- if ( pw4 && nItemCount>=5000000 )
- {
- DBG_WARNING( pw4 );
- pw4 = NULL;
- }
- if ( pw5 && nItemCount>=10000000 )
- {
- DBG_WARNING( pw5 );
- pw5 = NULL;
- }
-#endif
-}
-
-// ------------------------------------------------------------------------
-SfxPoolItem::~SfxPoolItem()
-{
- DBG_DTOR(SfxPoolItem, 0);
- DBG_ASSERT(nRefCount == 0 || nRefCount > SFX_ITEMS_MAXREF, "destroying item in use" );
-#if OSL_DEBUG_LEVEL > 1
- --nItemCount;
-#endif
-}
-
-// ------------------------------------------------------------------------
-int SfxPoolItem::Compare( const SfxPoolItem& ) const
-{
- return 0;
-}
-
-// ------------------------------------------------------------------------
-int SfxPoolItem::Compare( const SfxPoolItem& rWith, const IntlWrapper& ) const
-{
- return Compare( rWith );
-}
-
-// ------------------------------------------------------------------------
-int SfxPoolItem::operator==( const SfxPoolItem& rCmp ) const
-{
- DBG_CHKTHIS(SfxPoolItem, 0);
- return rCmp.Type() == Type();
-}
-
-// -----------------------------------------------------------------------
-#ifndef TF_POOLABLE
-
-int SfxPoolItem::IsPoolable() const
-{
- DBG_CHKTHIS(SfxPoolItem, 0);
- return TRUE;
-}
-#endif
-
-// -----------------------------------------------------------------------
-SfxPoolItem* SfxPoolItem::Create(SvStream &, USHORT) const
-{
- DBG_CHKTHIS(SfxPoolItem, 0);
- return Clone(0);
-}
-
-// -----------------------------------------------------------------------
-USHORT SfxPoolItem::GetVersion( USHORT ) const
-{
- DBG_CHKTHIS(SfxPoolItem, 0);
- return 0;
-}
-
-// -----------------------------------------------------------------------
-SvStream& SfxPoolItem::Store(SvStream &rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxPoolItem, 0);
- return rStream;
-}
-
-//============================================================================
-// static
-bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString)
-{
- rStream.ReadByteString(rString);
- return rStream.GetError() == ERRCODE_NONE;
-}
-
-//============================================================================
-// static
-void SfxPoolItem::writeByteString(SvStream & rStream,
- UniString const & rString)
-{
- rStream.WriteByteString(rString);
-}
-
-//============================================================================
-// static
-bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString,
- bool bUnicode)
-{
- rStream.ReadByteString(rString,
- bUnicode ? RTL_TEXTENCODING_UCS2 :
- rStream.GetStreamCharSet());
- return rStream.GetError() == ERRCODE_NONE;
-}
-
-//============================================================================
-// static
-void SfxPoolItem::writeUnicodeString(SvStream & rStream,
- UniString const & rString)
-{
- rStream.WriteByteString(rString, RTL_TEXTENCODING_UCS2);
-}
-
-// ------------------------------------------------------------------------
-SfxItemPresentation SfxPoolItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/, // IN: wie formatiert werden soll
- SfxMapUnit /*eCoreMetric*/, // IN: Ma\seinheit des SfxPoolItems
- SfxMapUnit /*ePresentationMetric*/, // IN: Wunsch-Ma\einheit der Darstellung
- XubString& /*rText*/, // OUT: textuelle Darstellung
- const IntlWrapper *
-) const
-
-/* [Beschreibung]
-
- "Uber diese virtuelle Methode kann von den SfxPoolItem-Subklassen
- eine textuelle Datstellung des Wertes erhalten werden. Sie sollte
- von allen UI-relevanten SfxPoolItem-Subklassen "uberladen werden.
-
- Da die Ma\seinheit des Wertes im SfxItemPool nur "uber
- <SfxItemPool::GetMetric(USHORT)const> erfragbar ist, und nicht etwa
- in der SfxPoolItem-Instanz oder -Subklasse verf"ugbar ist, wird die
- eigene Ma\seinheit als 'eCoreMetric' "ubergeben.
-
- Die darzustellende Ma\seinheit wird als 'ePresentationMetric'
- "ubergeben.
-
-
- [R"uckgabewert]
-
- SfxItemPresentation SFX_ITEM_PRESENTATION_NONE
- es konnte keine Text-Darstellung erzeugt werden
-
- SFX_ITEM_PRESENTATION_NAMELESS
- es konnte eine Text-Darstellung (ggf. mit
- Ma\seinheit) erzeugt werden, die jedoch keine
- semantische Bedeutung enth"alt
-
- SFX_ITEM_PRESENTATION_COMPLETE
- es konnte eine komplette Text-Darstellung mit
- semantischer Bedeutung (und ggf. Ma\seinheit)
- erzeugt werden
-
-
- [Beispiele]
-
- pSvxFontItem->GetPresentation( SFX_PRESENTATION_NAMELESS, ... )
- "12pt" mit return SFX_ITEM_PRESENTATION_NAMELESS
-
- pSvxColorItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... )
- "rot" mit return SFX_ITEM_PRESENTATION_NAMELESS
- (das das SvxColorItem nicht wei\s, was f"ur eine Farbe es darstellt,
- kann es keinen Namen angeben, was durch den Returnwert mitgeteilt wird.
-
- pSvxBorderItem->GetPresentation( SFX_PRESENTATION_COMPLETE, ... )
- "1cm oberer Rand, 2cm linker Rand, 0,2cm unterer Rand, ..."
-*/
-
-{
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// SfxVoidItem ------------------------------------------------------------
-SfxVoidItem::SfxVoidItem( USHORT which ):
- SfxPoolItem(which)
-{
- DBG_CTOR(SfxVoidItem, 0);
-}
-
-// SfxVoidItem ------------------------------------------------------------
-SfxVoidItem::SfxVoidItem( const SfxVoidItem& rCopy):
- SfxPoolItem(rCopy)
-{
- DBG_CTOR(SfxVoidItem, 0);
-}
-
-// ------------------------------------------------------------------------
-int SfxVoidItem::operator==( const SfxPoolItem&
-#ifdef DBG_UTIL
-rCmp
-#endif
-) const
-{
- DBG_CHKTHIS(SfxVoidItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" );
- return TRUE;
-}
-
-// ------------------------------------------------------------------------
-SfxItemPresentation SfxVoidItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxVoidItem, 0);
- rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Void"));
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// ------------------------------------------------------------------------
-SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxVoidItem, 0);
- return new SfxVoidItem(*this);
-}
-
-// SfxInvalidItem ---------------------------------------------------------
-#if 0 /* @@@ NOT USED @@@ */
-SfxInvalidItem::SfxInvalidItem( USHORT nWhich, const SfxPoolItem &rDefault ):
- SfxPoolItem(nWhich),
- pDefaultItem(&rDefault)
-{
- DBG_CTOR(SfxInvalidItem, 0);
-}
-
-// ------------------------------------------------------------------------
-SfxInvalidItem::SfxInvalidItem( const SfxInvalidItem& rCopy):
- SfxPoolItem(rCopy),
- pDefaultItem(rCopy.pDefaultItem)
-{
- DBG_CTOR(SfxInvalidItem, 0);
- //! pDefaultItem->ReleaseRef?
-}
-
-// ------------------------------------------------------------------------
-SfxInvalidItem::~SfxInvalidItem()
-{
- DBG_DTOR(SfxInvalidItem, 0);
-}
-
-// ------------------------------------------------------------------------
-int SfxInvalidItem::operator==( const SfxPoolItem& rCmp) const
-{
- DBG_CHKTHIS(SfxInvalidItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==(rCmp), "unequal type" );
- return *pDefaultItem == *((SfxInvalidItem&)rCmp).pDefaultItem;
-}
-
-// ------------------------------------------------------------------------
-SfxItemPresentation SfxInvalidItem::GetPresentation
-(
- SfxItemPresentation ePresentation,
- SfxMapUnit eCoreMetric,
- SfxMapUnit ePresentationMetric,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxInvalidItem, 0);
- rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Invalid"));
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-// ------------------------------------------------------------------------
-SfxPoolItem* SfxInvalidItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxInvalidItem, 0);
- return new SfxInvalidItem(*this);
-}
-
-// ------------------------------------------------------------------------
-SfxPoolItem* SfxInvalidItem::Create(SvStream &, USHORT nVersion) const
-{
- DBG_CHKTHIS(SfxInvalidItem, 0);
- DBG_ERROR("SfxInvalidItem::Create() ist sinnlos");
- return Clone();
-}
-
-// ------------------------------------------------------------------------
-SvStream& SfxInvalidItem::Store(SvStream &rStream, USHORT nItemVersion ) const
-{
- DBG_CHKTHIS(SfxInvalidItem, 0);
- DBG_ERROR("SfxInvalidItem::Store() ist sinnlos");
- return rStream;
-}
-#endif /* @@@ NOT USED @@@ */
-
-// SfxItemHandle ----------------------------------------------------------
-SfxItemHandle::SfxItemHandle(SfxPoolItem &rItem):
- pRef(new USHORT(1)),
- pItem(rItem.Clone(0))
-{
- DBG_CTOR(SfxItemHandle, 0);
-}
-
-// ------------------------------------------------------------------------
-SfxItemHandle::SfxItemHandle(const SfxItemHandle &rCopy):
- pRef(rCopy.pRef),
- pItem(rCopy.pItem)
-{
- DBG_CTOR(SfxItemHandle, 0);
- ++(*pRef);
-}
-
-// ------------------------------------------------------------------------
-const SfxItemHandle &SfxItemHandle::operator=(const SfxItemHandle &rCopy)
-{
- DBG_CHKTHIS(SfxItemHandle, 0);
- if(&rCopy == this || pItem == rCopy.pItem)
- return *this;
- --(*pRef);
- if(!(*pRef))
- {
- delete pItem;
- pItem = 0;
- }
- pRef = rCopy.pRef;
- ++(*pRef);
- pItem = rCopy.pItem;
- return *this;
-}
-
-// ------------------------------------------------------------------------
-SfxItemHandle::~SfxItemHandle()
-{
- DBG_DTOR(SfxItemHandle, 0);
- --(*pRef);
- if(!(*pRef)) {
- delete pRef; pRef = 0;
- delete pItem; pItem = 0;
- }
-}
-
-// ------------------------------------------------------------------------
-int SfxPoolItem::ScaleMetrics( long /*lMult*/, long /*lDiv*/ )
-{
- return 0;
-}
-
-// ------------------------------------------------------------------------
-int SfxPoolItem::HasMetrics() const
-{
- return 0;
-}
-
-// -----------------------------------------------------------------------
-#if 0 /* @@@ NOT USED @@@ */
-void SfxPoolItem::GetVersion() const
-{
- DBG_ERROR( "dummy called" );
-}
-
-// -----------------------------------------------------------------------
-void SfxPoolItem::Store(SvStream &rStream) const
-{
- DBG_ERROR( "dummy called" );
-}
-#endif /* @@@ NOT USED @@@ */
-
-// -----------------------------------------------------------------------
-
-BOOL SfxPoolItem::QueryValue( com::sun::star::uno::Any&, BYTE ) const
-{
- DBG_ERROR("There is no implementation for QueryValue for this item!");
- return FALSE;
-}
-
-// -----------------------------------------------------------------------
-
-BOOL SfxPoolItem::PutValue( const com::sun::star::uno::Any&, BYTE )
-{
- DBG_ERROR("There is no implementation for PutValue for this item!");
- return FALSE;
-}
-
-SfxVoidItem::~SfxVoidItem()
-{
- DBG_DTOR(SfxVoidItem, 0);
-}
diff --git a/svtools/source/items1/sfontitm.cxx b/svtools/source/items1/sfontitm.cxx
deleted file mode 100644
index ee7119c95e1c..000000000000
--- a/svtools/source/items1/sfontitm.cxx
+++ /dev/null
@@ -1,142 +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: sfontitm.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <tools/stream.hxx>
-#include <tools/vcompat.hxx>
-#include <svtools/sfontitm.hxx>
-
-//============================================================================
-//
-// class SfxFontItem
-//
-//============================================================================
-
-TYPEINIT1(SfxFontItem, SfxPoolItem);
-
-//============================================================================
-// virtual
-int SfxFontItem::operator ==(const SfxPoolItem & rItem) const
-{
- const SfxFontItem * pFontItem = PTR_CAST(SfxFontItem, &rItem);
- return pFontItem && m_bHasFont == pFontItem->m_bHasFont
- && m_bHasColor == pFontItem->m_bHasColor
- && m_bHasFillColor == pFontItem->m_bHasFillColor
- && (!m_bHasColor || m_aColor == pFontItem->m_aColor)
- && (!m_bHasFillColor || m_aFillColor == pFontItem->m_aFillColor)
- && (!m_bHasFont || (m_bKerning == pFontItem->m_bKerning
- && m_bShadow == pFontItem->m_bShadow
- && m_bOutline == pFontItem->m_bOutline
- && m_bWordLine == pFontItem->m_bWordLine
- && m_nOrientation == pFontItem->m_nOrientation
- && m_nStrikeout == pFontItem->m_nStrikeout
- && m_nUnderline == pFontItem->m_nUnderline
- && m_nItalic == pFontItem->m_nItalic
- && m_nWidthType == pFontItem->m_nWidthType
- && m_nWeight == pFontItem->m_nWeight
- && m_nPitch == pFontItem->m_nPitch
- && m_nFamily == pFontItem->m_nFamily
- && m_nLanguage == pFontItem->m_nLanguage
- && m_nCharSet == pFontItem->m_nCharSet
- && m_aFillColor == pFontItem->m_aFillColor
- && m_aColor == pFontItem->m_aColor
- && m_aSize == pFontItem->m_aSize
- && m_aStyleName == pFontItem->m_aStyleName
- && m_aName == pFontItem->m_aName));
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxFontItem::Create(SvStream & rStream, USHORT) const
-{
- VersionCompat aItemCompat(rStream, STREAM_READ);
- SfxFontItem * pItem = new SfxFontItem(Which());
- {
- VersionCompat aFontCompat(rStream, STREAM_READ);
- readByteString(rStream, pItem->m_aName);
- readByteString(rStream, pItem->m_aStyleName);
- rStream >> pItem->m_aSize;
- sal_Int16 nCharSet = 0;
- rStream >> nCharSet;
- pItem->m_nCharSet = rtl_TextEncoding(nCharSet);
- rStream >> pItem->m_nFamily >> pItem->m_nPitch >> pItem->m_nWeight
- >> pItem->m_nUnderline >> pItem->m_nStrikeout
- >> pItem->m_nItalic;
- sal_Int16 nLanguage = 0;
- rStream >> nLanguage;
- pItem->m_nLanguage = LanguageType(nLanguage);
- rStream >> pItem->m_nWidthType >> pItem->m_nOrientation;
- sal_Int8 nWordLine = 0;
- rStream >> nWordLine;
- pItem->m_bWordLine = nWordLine != 0;
- sal_Int8 nOutline = 0;
- rStream >> nOutline;
- pItem->m_bOutline = nOutline != 0;
- sal_Int8 nShadow = 0;
- rStream >> nShadow;
- pItem->m_bShadow = nShadow != 0;
- sal_Int8 nKerning = 0;
- rStream >> nKerning;
- pItem->m_bKerning = nKerning != 0;
- }
- pItem->m_aColor.Read(rStream, TRUE);
- pItem->m_aFillColor.Read(rStream, TRUE);
- sal_Int16 nFlags = 0;
- rStream >> nFlags;
- pItem->m_bHasFont = (nFlags & 4) != 0;
- pItem->m_bHasColor = (nFlags & 1) != 0;
- pItem->m_bHasFillColor = (nFlags & 2) != 0;
- return pItem;
-}
-
-//============================================================================
-// virtual
-SvStream & SfxFontItem::Store(SvStream & rStream, USHORT) const
-{
- VersionCompat aItemCompat(rStream, STREAM_WRITE, 1);
- {
- VersionCompat aFontCompat(rStream, STREAM_WRITE, 1);
- writeByteString(rStream, m_aName);
- writeByteString(rStream, m_aStyleName);
- rStream << m_aSize << sal_Int16(m_nCharSet)
- << m_nFamily << m_nPitch << m_nWeight << m_nUnderline
- << m_nStrikeout << m_nItalic << sal_Int16(m_nLanguage)
- << m_nWidthType << m_nOrientation << sal_Int8(m_bWordLine)
- << sal_Int8(m_bOutline) << sal_Int8(m_bShadow)
- << sal_Int8(m_bKerning);
- }
- SAL_CONST_CAST(Color &, m_aColor).Write(rStream, TRUE);
- SAL_CONST_CAST(Color &, m_aFillColor).Write(rStream, TRUE);
- rStream << sal_Int16(m_bHasFont << 2 | m_bHasColor
- | m_bHasFillColor << 1);
- return rStream;
-}
-
diff --git a/svtools/source/items1/sitem.cxx b/svtools/source/items1/sitem.cxx
deleted file mode 100644
index 2a917e93bb79..000000000000
--- a/svtools/source/items1/sitem.cxx
+++ /dev/null
@@ -1,116 +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: sitem.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_svtools.hxx"
-// INCLUDE ---------------------------------------------------------------
-
-#ifndef GCC
-#endif
-
-#include <tools/string.hxx>
-#include <tools/stream.hxx>
-
-#include <svtools/poolitem.hxx>
-#include <svtools/itemset.hxx>
-
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxSetItem)
-
-// --------------------------------------------------------------------------
-
-SfxSetItem::SfxSetItem( USHORT which, const SfxItemSet &rSet) :
- SfxPoolItem(which),
- pSet(rSet.Clone(TRUE))
-{
- DBG_CTOR(SfxSetItem, 0);
-}
-
-// --------------------------------------------------------------------------
-
-SfxSetItem::SfxSetItem( USHORT which, SfxItemSet *pS) :
- SfxPoolItem(which),
- pSet(pS)
-{
- DBG_CTOR(SfxSetItem, 0);
- DBG_ASSERT(pS, "SfxSetItem without set constructed" );
-}
-
-// --------------------------------------------------------------------------
-
-SfxSetItem::SfxSetItem( const SfxSetItem& rCopy, SfxItemPool *pPool ) :
- SfxPoolItem(rCopy.Which()),
- pSet(rCopy.pSet->Clone(TRUE, pPool))
-{
- DBG_CTOR(SfxSetItem, 0);
-}
-
-// --------------------------------------------------------------------------
-
-SfxSetItem::~SfxSetItem()
-{
- DBG_DTOR(SfxSetItem, 0);
- delete pSet; pSet = 0;
-}
-
-// --------------------------------------------------------------------------
-
-int SfxSetItem::operator==( const SfxPoolItem& rCmp) const
-{
- DBG_CHKTHIS(SfxSetItem, 0);
- DBG_ASSERT( SfxPoolItem::operator==( rCmp ), "unequal type" );
- return *pSet == *(((const SfxSetItem &)rCmp).pSet);
-}
-
-// --------------------------------------------------------------------------
-
-SfxItemPresentation SfxSetItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& /*rText*/,
- const IntlWrapper *
-) const
-{
- DBG_CHKTHIS(SfxSetItem, 0);
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-// --------------------------------------------------------------------------
-
-SvStream& SfxSetItem::Store(SvStream& rStream, USHORT) const
-{
- GetItemSet().Store(rStream);
- return rStream;
-}
-
diff --git a/svtools/source/items1/slstitm.cxx b/svtools/source/items1/slstitm.cxx
deleted file mode 100644
index 87163d41e033..000000000000
--- a/svtools/source/items1/slstitm.cxx
+++ /dev/null
@@ -1,425 +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: slstitm.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_svtools.hxx"
-
-#include <svtools/slstitm.hxx>
-#include <svtools/poolitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <tools/stream.hxx>
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxStringListItem)
-
-// -----------------------------------------------------------------------
-
-TYPEINIT1_AUTOFACTORY(SfxStringListItem, SfxPoolItem);
-
-class SfxImpStringList
-{
-public:
- USHORT nRefCount;
- List aList;
-
- SfxImpStringList() { nRefCount = 1; }
- ~SfxImpStringList();
- void Sort( BOOL bAscending, List* );
-};
-
-//------------------------------------------------------------------------
-
-SfxImpStringList::~SfxImpStringList()
-{
- DBG_ASSERT(nRefCount!=0xffff,"ImpList already deleted");
- String* pStr = (String*)aList.First();
- while( pStr )
- {
- delete pStr;
- pStr = (String*)aList.Next();
- }
- nRefCount = 0xffff;
-}
-
-//------------------------------------------------------------------------
-
-void SfxImpStringList::Sort( BOOL bAscending, List* pParallelList )
-{
- DBG_ASSERT(!pParallelList || pParallelList->Count() >= aList.Count(),"Sort:ParallelList too small");
- ULONG nCount = aList.Count();
- if( nCount > 1 )
- {
- nCount -= 2;
- // Bubble Dir Einen
- BOOL bSwapped = TRUE;
- while( bSwapped )
- {
- bSwapped = FALSE;
- for( ULONG nCur = 0; nCur <= nCount; nCur++ )
- {
- String* pStr1 = (String*)aList.GetObject( nCur );
- String* pStr2 = (String*)aList.GetObject( nCur+1 );
- // COMPARE_GREATER => pStr2 ist groesser als pStr1
- StringCompare eCompare = pStr1->CompareIgnoreCaseToAscii( *pStr2 ); //@@@
- BOOL bSwap = FALSE;
- if( bAscending )
- {
- if( eCompare == COMPARE_LESS )
- bSwap = TRUE;
- }
- else if( eCompare == COMPARE_GREATER )
- bSwap = TRUE;
-
- if( bSwap )
- {
- bSwapped = TRUE;
- aList.Replace( pStr1, nCur + 1 );
- aList.Replace( pStr2, nCur );
- if( pParallelList )
- {
- void* p1 = pParallelList->GetObject( nCur );
- void* p2 = pParallelList->GetObject( nCur + 1 );
- pParallelList->Replace( p1, nCur + 1 );
- pParallelList->Replace( p2, nCur );
- }
- }
- }
- }
- }
-}
-
-// class SfxStringListItem -----------------------------------------------
-
-SfxStringListItem::SfxStringListItem() :
- pImp(NULL)
-{
-}
-
-//------------------------------------------------------------------------
-
-SfxStringListItem::SfxStringListItem( USHORT which, const List* pList ) :
- SfxPoolItem( which ),
- pImp(NULL)
-{
- // PB: das Putten einer leeren Liste funktionierte nicht,
- // deshalb habe ich hier die Abfrage nach dem Count auskommentiert
- if( pList /*!!! && pList->Count() */ )
- {
- pImp = new SfxImpStringList;
-
- long i, nCount = pList->Count();
- String *pStr1, *pStr2;
- for( i=0; i < nCount; i++ )
- {
- pStr1 = (String*)pList->GetObject(i);
- pStr2 = new String( *pStr1 );
- pImp->aList.Insert( pStr2, LIST_APPEND );
- }
- }
-}
-
-//------------------------------------------------------------------------
-
-SfxStringListItem::SfxStringListItem( USHORT which, SvStream& rStream ) :
- SfxPoolItem( which ),
- pImp(NULL)
-{
- long nEntryCount;
- rStream >> nEntryCount;
-
- if( nEntryCount )
- pImp = new SfxImpStringList;
-
- long i;
- String* pStr;
- for( i=0; i < nEntryCount; i++ )
- {
- pStr = new String;
- readByteString(rStream, *pStr);
- pImp->aList.Insert( pStr, LIST_APPEND );
- }
-}
-
-//------------------------------------------------------------------------
-
-SfxStringListItem::SfxStringListItem( const SfxStringListItem& rItem ) :
- SfxPoolItem( rItem ),
- pImp(NULL)
-{
- pImp = rItem.pImp;
-
- if( pImp )
- {
- DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- pImp->nRefCount++;
- }
-}
-
-//------------------------------------------------------------------------
-
-SfxStringListItem::~SfxStringListItem()
-{
- if( pImp )
- {
- DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- if( pImp->nRefCount > 1 )
- pImp->nRefCount--;
- else
- delete pImp;
- }
-}
-
-//------------------------------------------------------------------------
-
-List* SfxStringListItem::GetList()
-{
- if( !pImp )
- pImp = new SfxImpStringList;
- DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- return &(pImp->aList);
-}
-
-//------------------------------------------------------------------------
-
-int SfxStringListItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- SfxStringListItem* pItem = (SfxStringListItem*)&rItem;
-
- if( pImp == pItem->pImp )
- return TRUE;
- else
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-
-SfxItemPresentation SfxStringListItem::GetPresentation
-(
- SfxItemPresentation /*ePresentation*/,
- SfxMapUnit /*eCoreMetric*/,
- SfxMapUnit /*ePresentationMetric*/,
- XubString& rText,
- const IntlWrapper *
-) const
-{
- rText.AssignAscii(RTL_CONSTASCII_STRINGPARAM("(List)"));
- return SFX_ITEM_PRESENTATION_NONE;
-}
-
-//------------------------------------------------------------------------
-
-SfxPoolItem* SfxStringListItem::Clone( SfxItemPool *) const
-{
- return new SfxStringListItem( *this );
- /*
- if( pImp )
- return new SfxStringListItem( Which(), &(pImp->aList) );
- else
- return new SfxStringListItem( Which(), NULL );
- */
-
-}
-
-//------------------------------------------------------------------------
-
-SfxPoolItem* SfxStringListItem::Create( SvStream & rStream, USHORT ) const
-{
- return new SfxStringListItem( Which(), rStream );
-}
-
-//------------------------------------------------------------------------
-
-SvStream& SfxStringListItem::Store( SvStream & rStream, USHORT ) const
-{
- if( !pImp )
- {
- rStream << 0L;
- return rStream;
- }
-
- DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
-
- long nCount = pImp->aList.Count();
- rStream << nCount;
-
- long i;
- String* pStr;
- for( i=0; i < nCount; i++ )
- {
- pStr = (String*)(pImp->aList.GetObject( i ));
- writeByteString(rStream, *pStr);
- }
-
- return rStream;
-}
-
-//------------------------------------------------------------------------
-
-void SfxStringListItem::SetString( const XubString& rStr )
-{
- DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0");
-
- if ( pImp && (pImp->nRefCount == 1) )
- delete pImp;
- else
- if( pImp )
- pImp->nRefCount--;
- pImp = new SfxImpStringList;
-
- xub_StrLen nStart = 0;
- xub_StrLen nDelimPos;
- XubString aStr(rStr);
- aStr.ConvertLineEnd(LINEEND_CR);
- do
- {
- nDelimPos = aStr.Search( _CR, nStart );
- xub_StrLen nLen;
- if ( nDelimPos == STRING_NOTFOUND )
- nLen = 0xffff;
- else
- nLen = nDelimPos - nStart;
-
- XubString* pStr = new XubString(aStr.Copy(nStart, nLen));
- // String gehoert der Liste
- pImp->aList.Insert( pStr, LIST_APPEND );
-
- nStart += nLen + 1 ; // delimiter ueberspringen
- } while( nDelimPos != STRING_NOTFOUND );
-
- // Kein Leerstring am Ende
- if( pImp->aList.Last() &&
- !((XubString*)pImp->aList.Last())->Len() )
- delete (XubString*)pImp->aList.Remove( pImp->aList.Count()-1 );
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxStringListItem::GetString()
-{
- XubString aStr;
- if ( pImp )
- {
- DBG_ASSERT(pImp->nRefCount!=0xffff,"ImpList not valid");
- XubString* pStr = (XubString*)(pImp->aList.First());
- while( pStr )
- {
- aStr += *pStr;
- pStr = (XubString*)(pImp->aList.Next());
- if ( pStr )
- aStr += '\r';
- }
- }
- aStr.ConvertLineEnd();
- return aStr;
-}
-
-//------------------------------------------------------------------------
-
-#ifndef TF_POOLABLE
-
-int SfxStringListItem::IsPoolable() const
-{
- return FALSE;
-}
-
-#endif
-
-//------------------------------------------------------------------------
-
-void SfxStringListItem::Sort( BOOL bAscending, List* pParallelList )
-{
- DBG_ASSERT(GetRefCount()==0,"Sort:RefCount!=0");
- if( pImp )
- pImp->Sort( bAscending, pParallelList );
-}
-
-//----------------------------------------------------------------------------
-void SfxStringListItem::SetStringList( const com::sun::star::uno::Sequence< rtl::OUString >& rList )
-{
- DBG_ASSERT(GetRefCount()==0,"SetString:RefCount!=0");
-
- if ( pImp && (pImp->nRefCount == 1) )
- delete pImp;
- else
- if( pImp )
- pImp->nRefCount--;
- pImp = new SfxImpStringList;
-
- for ( sal_Int32 n = 0; n < rList.getLength(); n++ )
- {
- XubString* pStr = new XubString( rList[n] );
- // String gehoert der Liste
- pImp->aList.Insert( pStr, LIST_APPEND );
- }
-}
-
-//----------------------------------------------------------------------------
-void SfxStringListItem::GetStringList( com::sun::star::uno::Sequence< rtl::OUString >& rList ) const
-{
- long nCount = pImp->aList.Count();
-
- rList.realloc( nCount );
- for( long i=0; i < nCount; i++ )
- rList[i] = *(String*)(pImp->aList.GetObject( i ));
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxStringListItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE )
-{
- com::sun::star::uno::Sequence< rtl::OUString > aValue;
- if ( rVal >>= aValue )
- {
- SetStringList( aValue );
- return TRUE;
- }
-
- DBG_ERROR( "SfxStringListItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//----------------------------------------------------------------------------
-// virtual
-BOOL SfxStringListItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const
-{
- // GetString() is not const!!!
- SfxStringListItem* pThis = const_cast< SfxStringListItem * >( this );
-
- com::sun::star::uno::Sequence< rtl::OUString > aStringList;
- pThis->GetStringList( aStringList );
- rVal = ::com::sun::star::uno::makeAny( aStringList );
- return TRUE;
-}
-
-
diff --git a/svtools/source/items1/stylepool.cxx b/svtools/source/items1/stylepool.cxx
deleted file mode 100644
index 5f31500be73c..000000000000
--- a/svtools/source/items1/stylepool.cxx
+++ /dev/null
@@ -1,542 +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: stylepool.cxx,v $
- * $Revision: 1.10.78.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifdef _MSC_VER
-#pragma hdrstop
-#endif
-
-#include <vector>
-#include <map>
-
-#include "stylepool.hxx"
-#include <svtools/itemiter.hxx>
-#include <svtools/itempool.hxx>
-
-
-using namespace boost;
-
-namespace {
- // A "Node" represents a subset of inserted SfxItemSets
- // The root node represents the empty set
- // The other nodes contain a SfxPoolItem and represents an item set which contains their
- // pool item and the pool items of their parents.
- class Node
- {
- std::vector<Node*> mChildren; // child nodes, create by findChildNode(..)
- // container of shared pointers of inserted item sets; for non-poolable
- // items more than one item set is needed
- std::vector< StylePool::SfxItemSet_Pointer_t > maItemSet;
- const SfxPoolItem *mpItem; // my pool item
- Node *mpUpper; // if I'm a child node that's my parent node
- // --> OD 2008-03-07 #i86923#
- const bool mbIsItemIgnorable;
- // <--
- public:
- // --> OD 2008-03-07 #i86923#
- Node() // root node Ctor
- : mChildren(),
- maItemSet(),
- mpItem( 0 ),
- mpUpper( 0 ),
- mbIsItemIgnorable( false )
- {}
- Node( const SfxPoolItem& rItem, Node* pParent, const bool bIgnorable ) // child node Ctor
- : mChildren(),
- maItemSet(),
- mpItem( rItem.Clone() ),
- mpUpper( pParent ),
- mbIsItemIgnorable( bIgnorable )
- {}
- // <--
- ~Node();
- // --> OD 2008-03-11 #i86923#
- bool hasItemSet( const bool bCheckUsage ) const;
- // <--
- // --> OD 2008-04-29 #i87808#
-// const StylePool::SfxItemSet_Pointer_t getItemSet() const { return aItemSet[aItemSet.size()-1]; }
- const StylePool::SfxItemSet_Pointer_t getItemSet() const
- {
- return maItemSet.back();
- }
- const StylePool::SfxItemSet_Pointer_t getUsedOrLastAddedItemSet() const;
- // <--
- void setItemSet( const SfxItemSet& rSet ){ maItemSet.push_back( StylePool::SfxItemSet_Pointer_t( rSet.Clone() ) ); }
- // --> OD 2008-03-11 #i86923#
- Node* findChildNode( const SfxPoolItem& rItem,
- const bool bIsItemIgnorable = false );
- Node* nextItemSet( Node* pLast,
- const bool bSkipUnusedItemSet,
- const bool bSkipIgnorable );
- // <--
- const SfxPoolItem& getPoolItem() const { return *mpItem; }
- // --> OD 2008-03-11 #i86923#
- bool hasIgnorableChildren( const bool bCheckUsage ) const;
- const StylePool::SfxItemSet_Pointer_t getItemSetOfIgnorableChild(
- const bool bSkipUnusedItemSets ) const;
- // <--
- };
-
- // --> OD 2008-04-29 #i87808#
- const StylePool::SfxItemSet_Pointer_t Node::getUsedOrLastAddedItemSet() const
- {
- std::vector< StylePool::SfxItemSet_Pointer_t >::const_reverse_iterator aIter;
-
- for ( aIter = maItemSet.rbegin(); aIter != maItemSet.rend(); ++aIter )
- {
- if ( (*aIter).use_count() > 1 )
- {
- return *aIter;
- }
- }
-
- return maItemSet.back();
- }
- // <--
-
- // --> OD 2008-05-06 #i86923#
- bool Node::hasItemSet( const bool bCheckUsage ) const
- {
- bool bHasItemSet = false;
-
- if ( maItemSet.size() > 0 )
- {
- if ( bCheckUsage )
- {
- std::vector< StylePool::SfxItemSet_Pointer_t >::const_reverse_iterator aIter;
-
- for ( aIter = maItemSet.rbegin(); aIter != maItemSet.rend(); ++aIter )
- {
- if ( (*aIter).use_count() > 1 )
- {
- bHasItemSet = true;
- break;
- }
- }
- }
- else
- {
- bHasItemSet = true;
- }
- }
- return bHasItemSet;
- }
- // <--
-
- // --> OD 2008-03-07 #i86923#
- Node* Node::findChildNode( const SfxPoolItem& rItem,
- const bool bIsItemIgnorable )
- // <--
- {
- Node* pNextNode = this;
- std::vector<Node*>::iterator aIter = mChildren.begin();
- while( aIter != mChildren.end() )
- {
- if( rItem.Which() == (*aIter)->getPoolItem().Which() &&
- rItem == (*aIter)->getPoolItem() )
- return *aIter;
- ++aIter;
- }
- // --> OD 2008-03-07 #i86923#
- pNextNode = new Node( rItem, pNextNode, bIsItemIgnorable );
- // <--
- mChildren.push_back( pNextNode );
- return pNextNode;
- }
-
- /* Find the next node which has a SfxItemSet.
- The input parameter pLast has a sophisticated meaning:
- downstairs only:
- pLast == 0 => scan your children and their children
- but neither your parents neither your siblings
- downstairs and upstairs:
- pLast == this => scan your children, their children,
- the children of your parent behind you, and so on
- partial downstairs and upstairs
- pLast != 0 && pLast != this => scan your children behind the given children,
- the children of your parent behind you and so on.
-
- OD 2008-03-11 #i86923#
- introduce parameters <bSkipUnusedItemSets> and <bSkipIgnorable>
- and its handling.
- */
- Node* Node::nextItemSet( Node* pLast,
- const bool bSkipUnusedItemSets,
- const bool bSkipIgnorable )
- {
- // Searching downstairs
- std::vector<Node*>::iterator aIter = mChildren.begin();
- // For pLast == 0 and pLast == this all children are of interest
- // for another pLast the search starts behind pLast...
- if( pLast && pLast != this )
- {
- aIter = std::find( mChildren.begin(), mChildren.end(), pLast );
- if( aIter != mChildren.end() )
- ++aIter;
- }
- Node *pNext = 0;
- while( aIter != mChildren.end() )
- {
- // --> OD 2008-03-11 #i86923#
- if ( bSkipIgnorable && (*aIter)->mbIsItemIgnorable )
- {
- ++aIter;
- continue;
- }
- // <--
- pNext = *aIter;
- // --> OD 2008-03-11 #i86923#
- if ( pNext->hasItemSet( bSkipUnusedItemSets ) )
- {
- return pNext;
- }
- if ( bSkipIgnorable &&
- pNext->hasIgnorableChildren( bSkipUnusedItemSets ) )
- {
- return pNext;
- }
- pNext = pNext->nextItemSet( 0, bSkipUnusedItemSets, bSkipIgnorable ); // 0 => downstairs only
- // <--
- if( pNext )
- return pNext;
- ++aIter;
- }
- // Searching upstairs
- if( pLast && mpUpper )
- {
- // --> OD 2008-03-11 #i86923#
- pNext = mpUpper->nextItemSet( this, bSkipUnusedItemSets, bSkipIgnorable );
- // <--
- }
- return pNext;
- }
-
- // --> OD 2008-03-11 #i86923#
- bool Node::hasIgnorableChildren( const bool bCheckUsage ) const
- {
- bool bHasIgnorableChildren( false );
-
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
- while( aIter != mChildren.end() && !bHasIgnorableChildren )
- {
- Node* pChild = *aIter;
- if ( pChild->mbIsItemIgnorable )
- {
- bHasIgnorableChildren =
- !bCheckUsage ||
- ( pChild->hasItemSet( bCheckUsage /* == true */ ) ||
- pChild->hasIgnorableChildren( bCheckUsage /* == true */ ) );
- }
- ++aIter;
- }
-
- return bHasIgnorableChildren;
- }
-
- const StylePool::SfxItemSet_Pointer_t Node::getItemSetOfIgnorableChild(
- const bool bSkipUnusedItemSets ) const
- {
- DBG_ASSERT( hasIgnorableChildren( bSkipUnusedItemSets ),
- "<Node::getItemSetOfIgnorableChild> - node has no ignorable children" );
-
- std::vector<Node*>::const_iterator aIter = mChildren.begin();
- while( aIter != mChildren.end() )
- {
- Node* pChild = *aIter;
- if ( pChild->mbIsItemIgnorable )
- {
- if ( pChild->hasItemSet( bSkipUnusedItemSets ) )
- {
- return pChild->getUsedOrLastAddedItemSet();
- }
- else
- {
- pChild = pChild->nextItemSet( 0, bSkipUnusedItemSets, false );
- if ( pChild )
- {
- return pChild->getUsedOrLastAddedItemSet();
- }
- }
- }
- ++aIter;
- }
-
- StylePool::SfxItemSet_Pointer_t pReturn;
- return pReturn;
- }
- // <--
-
- Node::~Node()
- {
- std::vector<Node*>::iterator aIter = mChildren.begin();
- while( aIter != mChildren.end() )
- {
- delete *aIter;
- ++aIter;
- }
- delete mpItem;
- }
-
- class Iterator : public IStylePoolIteratorAccess
- {
- std::map< const SfxItemSet*, Node >& mrRoot;
- std::map< const SfxItemSet*, Node >::iterator mpCurrNode;
- Node* mpNode;
- const bool mbSkipUnusedItemSets;
- const bool mbSkipIgnorable;
- public:
- // --> OD 2008-03-07 #i86923#
- Iterator( std::map< const SfxItemSet*, Node >& rR,
- const bool bSkipUnusedItemSets,
- const bool bSkipIgnorable )
- : mrRoot( rR ),
- mpCurrNode( rR.begin() ),
- mpNode(0),
- mbSkipUnusedItemSets( bSkipUnusedItemSets ),
- mbSkipIgnorable( bSkipIgnorable )
- {}
- // <--
- virtual StylePool::SfxItemSet_Pointer_t getNext();
- virtual ::rtl::OUString getName();
- };
-
- StylePool::SfxItemSet_Pointer_t Iterator::getNext()
- {
- StylePool::SfxItemSet_Pointer_t pReturn;
- while( mpNode || mpCurrNode != mrRoot.end() )
- {
- if( !mpNode )
- {
- mpNode = &mpCurrNode->second;
- ++mpCurrNode;
- // --> OD 2008-03-11 #i86923#
- if ( mpNode->hasItemSet( mbSkipUnusedItemSets ) )
- {
- // --> OD 2008-04-30 #i87808#
-// return pNode->getItemSet();
- return mpNode->getUsedOrLastAddedItemSet();
- // <--
- }
- // <--
- }
- // --> OD 2008-03-11 #i86923#
- mpNode = mpNode->nextItemSet( mpNode, mbSkipUnusedItemSets, mbSkipIgnorable );
- if ( mpNode && mpNode->hasItemSet( mbSkipUnusedItemSets ) )
- {
- // --> OD 2008-04-30 #i87808#
-// return pNode->getItemSet();
- return mpNode->getUsedOrLastAddedItemSet();
- // <--
- }
- if ( mbSkipIgnorable &&
- mpNode && mpNode->hasIgnorableChildren( mbSkipUnusedItemSets ) )
- {
- return mpNode->getItemSetOfIgnorableChild( mbSkipUnusedItemSets );
- }
- // <--
- }
- return pReturn;
- }
-
- ::rtl::OUString Iterator::getName()
- {
- ::rtl::OUString aString;
- if( mpNode && mpNode->hasItemSet( false ) )
- {
- // --> OD 2008-04-30 #i87808#
-// aString = StylePool::nameOf( pNode->getItemSet() );
- aString = StylePool::nameOf( mpNode->getUsedOrLastAddedItemSet() );
- // <--
- }
- return aString;
- }
-
-}
-
-/* This static method creates a unique name from a shared pointer to a SfxItemSet
- The name is the memory address of the SfxItemSet itself. */
-
-::rtl::OUString StylePool::nameOf( SfxItemSet_Pointer_t pSet )
-{
- return ::rtl::OUString::valueOf( reinterpret_cast<sal_IntPtr>( pSet.get() ), 16 );
-}
-
-// class StylePoolImpl organized a tree-structure where every node represents a SfxItemSet.
-// The insertItemSet method adds a SfxItemSet into the tree if necessary and returns a shared_ptr
-// to a copy of the SfxItemSet.
-// The aRoot-Node represents an empty SfxItemSet.
-
-class StylePoolImpl
-{
-private:
- std::map< const SfxItemSet*, Node > maRoot;
- sal_Int32 mnCount;
- // --> OD 2008-03-07 #i86923#
- SfxItemSet* mpIgnorableItems;
- // <--
-public:
- // --> OD 2008-03-07 #i86923#
- explicit StylePoolImpl( SfxItemSet* pIgnorableItems = 0 )
- : maRoot(),
- mnCount(0),
- mpIgnorableItems( pIgnorableItems != 0
- ? pIgnorableItems->Clone( FALSE )
- : 0 )
- {
- DBG_ASSERT( !pIgnorableItems || !pIgnorableItems->Count(),
- "<StylePoolImpl::StylePoolImpl(..)> - misusage: item set for ignorable item should be empty. Please correct usage." );
- DBG_ASSERT( !mpIgnorableItems || !mpIgnorableItems->Count(),
- "<StylePoolImpl::StylePoolImpl(..)> - <SfxItemSet::Clone( FALSE )> does not work as excepted - <mpIgnorableItems> is not empty. Please inform OD." );
- }
-
- ~StylePoolImpl()
- {
- delete mpIgnorableItems;
- }
- // <--
-
- StylePool::SfxItemSet_Pointer_t insertItemSet( const SfxItemSet& rSet );
-
- // --> OD 2008-03-07 #i86923#
- IStylePoolIteratorAccess* createIterator( bool bSkipUnusedItemSets = false,
- bool bSkipIgnorableItems = false );
- // <--
- sal_Int32 getCount() const { return mnCount; }
-};
-
-StylePool::SfxItemSet_Pointer_t StylePoolImpl::insertItemSet( const SfxItemSet& rSet )
-{
- bool bNonPoolable = false;
- Node* pCurNode = &maRoot[ rSet.GetParent() ];
- SfxItemIter aIter( rSet );
- const SfxPoolItem* pItem = aIter.GetCurItem();
- // Every SfxPoolItem in the SfxItemSet causes a step deeper into the tree,
- // a complete empty SfxItemSet would stay at the root node.
- // --> OD 2008-03-07 #i86923#
- // insert ignorable items to the tree leaves.
- std::auto_ptr<SfxItemSet> pFoundIgnorableItems;
- if ( mpIgnorableItems )
- {
- pFoundIgnorableItems.reset( new SfxItemSet( *mpIgnorableItems ) );
- }
- while( pItem )
- {
- if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) )
- bNonPoolable = true;
- if ( !pFoundIgnorableItems.get() ||
- ( pFoundIgnorableItems.get() &&
- pFoundIgnorableItems->Put( *pItem ) == 0 ) )
- {
- pCurNode = pCurNode->findChildNode( *pItem );
- }
- pItem = aIter.NextItem();
- }
- if ( pFoundIgnorableItems.get() &&
- pFoundIgnorableItems->Count() > 0 )
- {
- SfxItemIter aIgnorableItemsIter( *pFoundIgnorableItems );
- pItem = aIgnorableItemsIter.GetCurItem();
- while( pItem )
- {
- if( !rSet.GetPool()->IsItemFlag(pItem->Which(), SFX_ITEM_POOLABLE ) )
- bNonPoolable = true;
- pCurNode = pCurNode->findChildNode( *pItem, true );
- pItem = aIgnorableItemsIter.NextItem();
- }
- }
- // <--
- // Every leaf node represents an inserted item set, but "non-leaf" nodes represents subsets
- // of inserted itemsets.
- // These nodes could have but does not need to have a shared_ptr to a item set.
- if( !pCurNode->hasItemSet( false ) )
- {
- pCurNode->setItemSet( rSet );
- bNonPoolable = false; // to avoid a double insertion
- ++mnCount;
- }
- // If rSet contains at least one non poolable item, a new itemset has to be inserted
- if( bNonPoolable )
- pCurNode->setItemSet( rSet );
-#ifdef DEBUG
- {
- sal_Int32 nCheck = -1;
- sal_Int32 nNo = -1;
- IStylePoolIteratorAccess* pIter = createIterator();
- StylePool::SfxItemSet_Pointer_t pTemp;
- do
- {
- ++nCheck;
- pTemp = pIter->getNext();
- if( pCurNode->hasItemSet( false ) && pTemp.get() == pCurNode->getItemSet().get() )
- {
- ::rtl::OUString aStr = StylePool::nameOf( pTemp );
- nNo = nCheck;
- }
- } while( pTemp.get() );
- DBG_ASSERT( mnCount == nCheck, "Wrong counting");
- delete pIter;
- }
-#endif
- return pCurNode->getItemSet();
-}
-
-// --> OD 2008-03-07 #i86923#
-IStylePoolIteratorAccess* StylePoolImpl::createIterator( bool bSkipUnusedItemSets,
- bool bSkipIgnorableItems )
-{
- return new Iterator( maRoot, bSkipUnusedItemSets, bSkipIgnorableItems );
-}
-// <--
-
-// Ctor, Dtor and redirected methods of class StylePool, nearly inline ;-)
-
-// --> OD 2008-03-07 #i86923#
-StylePool::StylePool( SfxItemSet* pIgnorableItems )
- : pImpl( new StylePoolImpl( pIgnorableItems ) )
-{}
-// <--
-
-StylePool::SfxItemSet_Pointer_t StylePool::insertItemSet( const SfxItemSet& rSet )
-{ return pImpl->insertItemSet( rSet ); }
-
-// --> OD 2008-03-11 #i86923#
-IStylePoolIteratorAccess* StylePool::createIterator( const bool bSkipUnusedItemSets,
- const bool bSkipIgnorableItems )
-{
- return pImpl->createIterator( bSkipUnusedItemSets, bSkipIgnorableItems );
-}
-// <--
-
-sal_Int32 StylePool::getCount() const
-{ return pImpl->getCount(); }
-
-StylePool::~StylePool() { delete pImpl; }
-
-// End of class StylePool
-
diff --git a/svtools/source/items1/tfrmitem.cxx b/svtools/source/items1/tfrmitem.cxx
deleted file mode 100644
index a7019ff69947..000000000000
--- a/svtools/source/items1/tfrmitem.cxx
+++ /dev/null
@@ -1,184 +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: tfrmitem.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_svtools.hxx"
-#include <com/sun/star/uno/Any.hxx>
-
-#include <tools/stream.hxx>
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-
-#include <svtools/tfrmitem.hxx>
-
-DBG_NAME( SfxTargetFrameItem )
-TYPEINIT1( SfxTargetFrameItem, SfxPoolItem );
-
-// -----------------------------------------------------------------------
-
-SfxTargetFrameItem::SfxTargetFrameItem( USHORT which ) :
- SfxPoolItem( which )
-{
- DBG_CTOR( SfxTargetFrameItem, 0 );
-}
-
-// -----------------------------------------------------------------------
-
-SfxTargetFrameItem::SfxTargetFrameItem( const SfxTargetFrameItem& rItem ) :
- SfxPoolItem( rItem )
-{
- DBG_CTOR( SfxTargetFrameItem, 0 );
- for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ )
- _aFrames[nCur] = rItem._aFrames[nCur];
-}
-
-// -----------------------------------------------------------------------
-
-SfxTargetFrameItem::SfxTargetFrameItem( USHORT which,
- const String& rOpenSelectFrame, const String& rOpenOpenFrame,
- const String& rOpenAddTaskFrame ) : SfxPoolItem( which )
-{
- DBG_CTOR( SfxTargetFrameItem, 0 );
- _aFrames[ (USHORT)SfxOpenSelect ] = rOpenSelectFrame;
- _aFrames[ (USHORT)SfxOpenOpen ] = rOpenOpenFrame;
- _aFrames[ (USHORT)SfxOpenAddTask ] = rOpenAddTaskFrame;
-}
-
-// -----------------------------------------------------------------------
-
-SfxTargetFrameItem::~SfxTargetFrameItem()
-{
- DBG_DTOR(SfxTargetFrameItem, 0);
-}
-
-// -----------------------------------------------------------------------
-
-String SfxTargetFrameItem::GetTargetFrame( SfxOpenMode eMode ) const
-{
- DBG_CHKTHIS( SfxTargetFrameItem, 0 );
- if( eMode <= SfxOpenModeLast )
- return _aFrames[ (USHORT)eMode ];
- String aResult;
- return aResult;
-}
-
-// -----------------------------------------------------------------------
-
-int SfxTargetFrameItem::operator==( const SfxPoolItem& rItem ) const
-{
- DBG_CHKTHIS( SfxTargetFrameItem, 0 );
- DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal type" );
-
- for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ )
- {
- if( _aFrames[nCur] != ((const SfxTargetFrameItem&)rItem)._aFrames[nCur] )
- return 0;
- }
- return 1;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxTargetFrameItem::Create( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS(SfxTargetFrameItem, 0);
- SfxTargetFrameItem* pItem = new SfxTargetFrameItem( Which() );
- USHORT nCount = 0;
- rStream >> nCount;
- for(USHORT nCur=0; nCur<= (USHORT)SfxOpenModeLast && nCount; nCur++,nCount--)
- {
- readByteString(rStream, pItem->_aFrames[ nCur ]);
- }
- // die uebriggebliebenen ueberspringen
- String aTemp;
- while( nCount )
- {
- readByteString(rStream, aTemp);
- nCount--;
- }
- return pItem;
-}
-
-// -----------------------------------------------------------------------
-
-SvStream& SfxTargetFrameItem::Store( SvStream& rStream, USHORT ) const
-{
- DBG_CHKTHIS( SfxTargetFrameItem, 0 );
- USHORT nCount = (USHORT)(SfxOpenModeLast+1);
- rStream << nCount;
- for( USHORT nCur = 0; nCur <= (USHORT)SfxOpenModeLast; nCur++ )
- {
- writeByteString(rStream, _aFrames[ nCur ]);
- }
- return rStream;
-}
-
-// -----------------------------------------------------------------------
-
-SfxPoolItem* SfxTargetFrameItem::Clone( SfxItemPool* ) const
-{
- DBG_CHKTHIS( SfxTargetFrameItem, 0 );
- return new SfxTargetFrameItem( *this );
-}
-
-// -----------------------------------------------------------------------
-// virtual
-BOOL SfxTargetFrameItem::QueryValue( com::sun::star::uno::Any& rVal,BYTE ) const
-{
- String aVal;
- for ( int i = 0; i <= SfxOpenModeLast; i++ )
- {
- aVal += _aFrames[ i ];
- aVal += ';' ;
- }
-
- rVal <<= rtl::OUString( aVal );
- return TRUE;
-}
-
-// -----------------------------------------------------------------------
-// virtual
-BOOL SfxTargetFrameItem::PutValue( const com::sun::star::uno::Any& rVal,BYTE )
-{
- rtl::OUString aValue;
- if ( rVal >>= aValue )
- {
- const String aVal( aValue );
-
- for ( USHORT i = 0; i <= SfxOpenModeLast; i++ )
- _aFrames[ i ] = aVal.GetToken( i );
-
- return TRUE;
- }
-
- DBG_ERROR( "SfxTargetFrameItem::PutValue - Wrong type!" );
- return FALSE;
-}
-
diff --git a/svtools/source/items1/tresitem.cxx b/svtools/source/items1/tresitem.cxx
deleted file mode 100644
index 6e70c82a4d03..000000000000
--- a/svtools/source/items1/tresitem.cxx
+++ /dev/null
@@ -1,78 +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: tresitem.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <svtools/tresitem.hxx>
-
-using namespace com::sun::star;
-
-//============================================================================
-//
-// CntTransferResultItem
-//
-//============================================================================
-
-TYPEINIT1_AUTOFACTORY(CntTransferResultItem, SfxPoolItem)
-
-//============================================================================
-// virtual
-int CntTransferResultItem::operator ==(SfxPoolItem const & rItem) const
-{
- if (CntTransferResultItem * pResultItem = PTR_CAST(CntTransferResultItem,
- &rItem))
- return m_aResult.Source == pResultItem->m_aResult.Source
- && m_aResult.Target == pResultItem->m_aResult.Target
- && m_aResult.Result == pResultItem->m_aResult.Result;
- return false;
-}
-
-//============================================================================
-// virtual
-BOOL CntTransferResultItem::QueryValue(uno::Any & rVal, BYTE) const
-{
- rVal <<= m_aResult;
- return true;
-}
-
-//============================================================================
-// virtual
-BOOL CntTransferResultItem::PutValue(uno::Any const & rVal, BYTE)
-{
- return rVal >>= m_aResult;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * CntTransferResultItem::Clone(SfxItemPool *) const
-{
- return new CntTransferResultItem(*this);
-}
-
diff --git a/svtools/source/items1/visitem.cxx b/svtools/source/items1/visitem.cxx
deleted file mode 100644
index 112b223a8be0..000000000000
--- a/svtools/source/items1/visitem.cxx
+++ /dev/null
@@ -1,148 +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: visitem.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_svtools.hxx"
-#include <svtools/visitem.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <tools/stream.hxx>
-
-//============================================================================
-//
-// class SfxVisibilityItem
-//
-//============================================================================
-
-DBG_NAME(SfxVisibilityItem)
-
-//============================================================================
-TYPEINIT1_AUTOFACTORY(SfxVisibilityItem, SfxPoolItem);
-
-//============================================================================
-SfxVisibilityItem::SfxVisibilityItem(USHORT which, SvStream & rStream):
- SfxPoolItem(which)
-{
- DBG_CTOR(SfxVisibilityItem, 0);
- sal_Bool bValue = 0;
- rStream >> bValue;
- m_nValue.bVisible = bValue;
-}
-
-//============================================================================
-// virtual
-int SfxVisibilityItem::operator ==(const SfxPoolItem & rItem) const
-{
- DBG_CHKTHIS(SfxVisibilityItem, 0);
- DBG_ASSERT(SfxPoolItem::operator ==(rItem), "unequal type");
- return m_nValue.bVisible == SAL_STATIC_CAST(const SfxVisibilityItem *, &rItem)->
- m_nValue.bVisible;
-}
-
-//============================================================================
-// virtual
-int SfxVisibilityItem::Compare(const SfxPoolItem & rWith) const
-{
- DBG_ASSERT(rWith.ISA(SfxVisibilityItem), "SfxVisibilityItem::Compare(): Bad type");
- return m_nValue.bVisible == static_cast< SfxVisibilityItem const * >(&rWith)->m_nValue.bVisible ?
- 0 : m_nValue.bVisible ? -1 : 1;
-}
-
-//============================================================================
-// virtual
-SfxItemPresentation SfxVisibilityItem::GetPresentation(SfxItemPresentation,
- SfxMapUnit, SfxMapUnit,
- XubString & rText,
- const IntlWrapper *) const
-{
- rText = GetValueTextByVal(m_nValue.bVisible);
- return SFX_ITEM_PRESENTATION_NAMELESS;
-}
-
-
-//============================================================================
-// virtual
-BOOL SfxVisibilityItem::QueryValue(com::sun::star::uno::Any& rVal,BYTE) const
-{
- rVal <<= m_nValue;
- return TRUE;
-}
-
-//============================================================================
-// virtual
-BOOL SfxVisibilityItem::PutValue(const com::sun::star::uno::Any& rVal,BYTE)
-{
- if (rVal >>= m_nValue)
- return TRUE;
-
- DBG_ERROR( "SfxInt16Item::PutValue - Wrong type!" );
- return FALSE;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxVisibilityItem::Create(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(SfxVisibilityItem, 0);
- return new SfxVisibilityItem(Which(), rStream);
-}
-
-//============================================================================
-// virtual
-SvStream & SfxVisibilityItem::Store(SvStream & rStream, USHORT) const
-{
- DBG_CHKTHIS(SfxVisibilityItem, 0);
- rStream << m_nValue.bVisible;
- return rStream;
-}
-
-//============================================================================
-// virtual
-SfxPoolItem * SfxVisibilityItem::Clone(SfxItemPool *) const
-{
- DBG_CHKTHIS(SfxVisibilityItem, 0);
- return new SfxVisibilityItem(*this);
-}
-
-//============================================================================
-// virtual
-USHORT SfxVisibilityItem::GetValueCount() const
-{
- return 2;
-}
-
-//============================================================================
-// virtual
-UniString SfxVisibilityItem::GetValueTextByVal(BOOL bTheValue) const
-{
- return
- bTheValue ?
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("TRUE")) :
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("FALSE"));
-}
diff --git a/svtools/source/items1/whassert.hxx b/svtools/source/items1/whassert.hxx
deleted file mode 100644
index fe9a834816c2..000000000000
--- a/svtools/source/items1/whassert.hxx
+++ /dev/null
@@ -1,57 +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: whassert.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.
- *
- ************************************************************************/
-#ifndef _SFX_WHASSERT_HXX
-#define _SFX_WHASSERT_HXX
-
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-
-//------------------------------------------------------------------------
-
-#ifdef DBG_UTIL
-#define SFX_ASSERT( bCondition, nId, sMessage ) \
-{ \
- if ( DbgIsAssert() ) \
- { \
- if ( !(bCondition) ) \
- { \
- ByteString aMsg( sMessage ); \
- aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \
- aMsg += ByteString::CreateFromInt32( nId ); \
- DbgOut( aMsg.GetBuffer(), DBG_OUT_ERROR, __FILE__, __LINE__); \
- } \
- } \
-}
-#else
-#define SFX_ASSERT( bCondition, nId, sMessage )
-#endif
-
-
-#endif
diff --git a/svtools/source/items1/whiter.cxx b/svtools/source/items1/whiter.cxx
deleted file mode 100644
index 461daf7ac012..000000000000
--- a/svtools/source/items1/whiter.cxx
+++ /dev/null
@@ -1,127 +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: whiter.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_svtools.hxx"
-// INCLUDE ---------------------------------------------------------------
-#ifndef GCC
-#endif
-
-#include "whiter.hxx"
-#include <svtools/itemset.hxx>
-
-DBG_NAME(SfxWhichIter)
-
-// -----------------------------------------------------------------------
-
-SfxWhichIter::SfxWhichIter( const SfxItemSet& rSet, USHORT nFromWh, USHORT nToWh ):
- pRanges(rSet.GetRanges()),
- pStart(rSet.GetRanges()),
- nOfst(0), nFrom(nFromWh), nTo(nToWh)
-{
- DBG_CTOR(SfxWhichIter, 0);
- if ( nFrom > 0 )
- FirstWhich();
-}
-
-// -----------------------------------------------------------------------
-
-SfxWhichIter::~SfxWhichIter()
-{
- DBG_DTOR(SfxWhichIter, 0);
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxWhichIter::NextWhich()
-{
- DBG_CHKTHIS(SfxWhichIter, 0);
- while ( 0 != *pRanges )
- {
- const USHORT nLastWhich = *pRanges + nOfst;
- ++nOfst;
- if (*(pRanges+1) == nLastWhich)
- {
- pRanges += 2;
- nOfst = 0;
- }
- USHORT nWhich = *pRanges + nOfst;
- if ( 0 == nWhich || ( nWhich >= nFrom && nWhich <= nTo ) )
- return nWhich;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxWhichIter::PrevWhich()
-{
- DBG_CHKTHIS(SfxWhichIter, 0);
- while ( pRanges != pStart || 0 != nOfst )
- {
- if(nOfst)
- --nOfst;
- else {
- pRanges -= 2;
- nOfst = *(pRanges+1) - (*pRanges);
- }
- USHORT nWhich = *pRanges + nOfst;
- if ( nWhich >= nFrom && nWhich <= nTo )
- return nWhich;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxWhichIter::FirstWhich()
-{
- DBG_CHKTHIS(SfxWhichIter, 0);
- pRanges = pStart;
- nOfst = 0;
- if ( *pRanges >= nFrom && *pRanges <= nTo )
- return *pRanges;
- return NextWhich();
-}
-
-// -----------------------------------------------------------------------
-
-USHORT SfxWhichIter::LastWhich()
-{
- DBG_CHKTHIS(SfxWhichIter, 0);
- while(*pRanges)
- ++pRanges;
- nOfst = 0;
- USHORT nWhich = *(pRanges-1);
- if ( nWhich >= nFrom && nWhich <= nTo )
- return nWhich;
- return PrevWhich();
-}
-
diff --git a/svtools/source/java/javaerror.src b/svtools/source/java/javaerror.src
index 3063bcd994d5..3460df859c2b 100644
--- a/svtools/source/java/javaerror.src
+++ b/svtools/source/java/javaerror.src
@@ -28,7 +28,7 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
WarningBox WARNINGBOX_JAVANOTFOUND
{
diff --git a/svtools/source/java/javainteractionhandler.cxx b/svtools/source/java/javainteractionhandler.cxx
index 30f8775a6d5f..a7808c80992b 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -33,7 +33,7 @@
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <tools/resid.hxx>
#include <com/sun/star/task/XInteractionContinuation.hpp>
#include <com/sun/star/task/XInteractionAbort.hpp>
diff --git a/svtools/source/java/patchjavaerror.src b/svtools/source/java/patchjavaerror.src
index bfdfd5a8bcba..2d2ad06a9592 100644
--- a/svtools/source/java/patchjavaerror.src
+++ b/svtools/source/java/patchjavaerror.src
@@ -28,7 +28,7 @@
*
************************************************************************/
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
WarningBox WARNINGBOX_JAVANOTFOUND
{
diff --git a/svtools/source/memtools/makefile.mk b/svtools/source/memtools/makefile.mk
deleted file mode 100644
index 4592bceff8cc..000000000000
--- a/svtools/source/memtools/makefile.mk
+++ /dev/null
@@ -1,50 +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: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=svarray
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES=\
- $(SLO)$/svarray.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/memtools/svarray.cxx b/svtools/source/memtools/svarray.cxx
deleted file mode 100644
index fe682e5f535d..000000000000
--- a/svtools/source/memtools/svarray.cxx
+++ /dev/null
@@ -1,385 +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: svarray.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_svtools.hxx"
-
-#define _SVARRAY_CXX
-
-#define _SVSTDARR_BOOLS
-#define _SVSTDARR_BYTES
-#define _SVSTDARR_ULONGS
-#define _SVSTDARR_ULONGSSORT
-#define _SVSTDARR_USHORTS
-#define _SVSTDARR_LONGS
-#define _SVSTDARR_LONGSSORT
-#define _SVSTDARR_SHORTS
-#define _SVSTDARR_STRINGS
-#define _SVSTDARR_STRINGSDTOR
-#define _SVSTDARR_STRINGSSORT
-#define _SVSTDARR_STRINGSSORTDTOR
-#define _SVSTDARR_STRINGSISORT
-#define _SVSTDARR_STRINGSISORTDTOR
-#define _SVSTDARR_USHORTSSORT
-
-#define _SVSTDARR_BYTESTRINGS
-#define _SVSTDARR_BYTESTRINGSDTOR
-#define _SVSTDARR_BYTESTRINGSSORT
-#define _SVSTDARR_BYTESTRINGSSORTDTOR
-#define _SVSTDARR_BYTESTRINGSISORT
-#define _SVSTDARR_BYTESTRINGSISORTDTOR
-
-#define _SVSTDARR_XUB_STRLEN
-#define _SVSTDARR_XUB_STRLENSORT
-
-#include <svtools/svstdarr.hxx>
-#include <tools/string.hxx>
-#include <tools/debug.hxx>
-
-SV_IMPL_VARARR(SvPtrarr,VoidPtr)
-SV_IMPL_VARARR_PLAIN(SvPtrarrPlain,VoidPtr)
-
-USHORT SvPtrarr::GetPos( const VoidPtr& aElement ) const
-{ USHORT n;
- for( n=0; n < nA && *(GetData()+n) != aElement; ) n++;
- return ( n >= nA ? USHRT_MAX : n );
-}
-
-USHORT SvPtrarrPlain::GetPos( const VoidPtr aElement ) const
-{ USHORT n;
- for( n=0; n < nA && *(GetData()+n) != aElement; ) n++;
- return ( n >= nA ? USHRT_MAX : n );
-}
-
-
-SV_IMPL_VARARR( SvBools, BOOL )
-SV_IMPL_VARARR( SvBytes, BYTE )
-SV_IMPL_VARARR( SvULongs, ULONG )
-SV_IMPL_VARARR( SvUShorts, USHORT )
-SV_IMPL_VARARR( SvLongs, long)
-SV_IMPL_VARARR( SvShorts, short )
-
-SV_IMPL_VARARR_SORT( SvULongsSort, ULONG )
-SV_IMPL_VARARR_SORT( SvLongsSort, long )
-SV_IMPL_VARARR_SORT( SvXub_StrLensSort, xub_StrLen )
-
-SV_IMPL_VARARR( SvXub_StrLens, xub_StrLen )
-
-SV_IMPL_PTRARR( SvStrings, StringPtr )
-SV_IMPL_PTRARR( SvStringsDtor, StringPtr )
-SV_IMPL_OP_PTRARR_SORT( SvStringsSort, StringPtr )
-SV_IMPL_OP_PTRARR_SORT( SvStringsSortDtor, StringPtr )
-
-SV_IMPL_PTRARR( SvByteStrings, ByteStringPtr )
-SV_IMPL_PTRARR( SvByteStringsDtor, ByteStringPtr )
-SV_IMPL_OP_PTRARR_SORT( SvByteStringsSort, ByteStringPtr )
-SV_IMPL_OP_PTRARR_SORT( SvByteStringsSortDtor, ByteStringPtr )
-
-
-
-// ---------------- strings -------------------------------------
-
-// Array mit anderer Seek-Methode!
-_SV_IMPL_SORTAR_ALG( SvStringsISort, StringPtr )
-void SvStringsISort::DeleteAndDestroy( USHORT nP, USHORT nL )
-{
- if( nL )
- {
- DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );
- for( USHORT n=nP; n < nP + nL; n++ )
- delete *((StringPtr*)pData+n);
- SvPtrarr::Remove( nP, nL );
- }
-}
-BOOL SvStringsISort::Seek_Entry( const StringPtr aE, USHORT* pP ) const
-{
- register USHORT nO = SvStringsISort_SAR::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- StringCompare eCmp = (*((StringPtr*)pData + nM))->
- CompareIgnoreCaseToAscii( *(aE) );
- if( COMPARE_EQUAL == eCmp )
- {
- if( pP ) *pP = nM;
- return TRUE;
- }
- else if( COMPARE_LESS == eCmp )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return FALSE;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return FALSE;
-}
-
-// ---------------- strings -------------------------------------
-
-// Array mit anderer Seek-Methode!
-_SV_IMPL_SORTAR_ALG( SvStringsISortDtor, StringPtr )
-void SvStringsISortDtor::DeleteAndDestroy( USHORT nP, USHORT nL )
-{
- if( nL )
- {
- DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );
- for( USHORT n=nP; n < nP + nL; n++ )
- delete *((StringPtr*)pData+n);
- SvPtrarr::Remove( nP, nL );
- }
-}
-BOOL SvStringsISortDtor::Seek_Entry( const StringPtr aE, USHORT* pP ) const
-{
- register USHORT nO = SvStringsISortDtor_SAR::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- StringCompare eCmp = (*((StringPtr*)pData + nM))->
- CompareIgnoreCaseToAscii( *(aE) );
- if( COMPARE_EQUAL == eCmp )
- {
- if( pP ) *pP = nM;
- return TRUE;
- }
- else if( COMPARE_LESS == eCmp )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return FALSE;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return FALSE;
-}
-
-// ---------------- Ushorts -------------------------------------
-
-/* SortArray fuer UShorts */
-BOOL SvUShortsSort::Seek_Entry( const USHORT aE, USHORT* pP ) const
-{
- register USHORT nO = SvUShorts::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- if( *(pData + nM) == aE )
- {
- if( pP ) *pP = nM;
- return TRUE;
- }
- else if( *(pData + nM) < aE )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return FALSE;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return FALSE;
-}
-
-void SvUShortsSort::Insert( const SvUShortsSort * pI, USHORT nS, USHORT nE )
-{
- if( USHRT_MAX == nE )
- nE = pI->Count();
- USHORT nP;
- const USHORT * pIArr = pI->GetData();
- for( ; nS < nE; ++nS )
- {
- if( ! Seek_Entry( *(pIArr+nS), &nP) )
- SvUShorts::Insert( *(pIArr+nS), nP );
- if( ++nP >= Count() )
- {
- SvUShorts::Insert( pI, nP, nS+1, nE );
- nS = nE;
- }
- }
-}
-
-BOOL SvUShortsSort::Insert( const USHORT aE )
-{
- USHORT nP;
- BOOL bExist = Seek_Entry( aE, &nP );
- if( !bExist )
- SvUShorts::Insert( aE, nP );
- return !bExist;
-}
-
-BOOL SvUShortsSort::Insert( const USHORT aE, USHORT& rP )
-{
- BOOL bExist = Seek_Entry( aE, &rP );
- if( !bExist )
- SvUShorts::Insert( aE, rP );
- return !bExist;
-}
-
-void SvUShortsSort::Insert( const USHORT* pE, USHORT nL)
-{
- USHORT nP;
- for( USHORT n = 0; n < nL; ++n )
- if( ! Seek_Entry( *(pE+n), &nP ))
- SvUShorts::Insert( *(pE+n), nP );
-}
-
-// remove ab Pos
-void SvUShortsSort::RemoveAt( const USHORT nP, USHORT nL )
-{
- if( nL )
- SvUShorts::Remove( nP, nL);
-}
-
-// remove ab dem Eintrag
-void SvUShortsSort::Remove( const USHORT aE, USHORT nL )
-{
- USHORT nP;
- if( nL && Seek_Entry( aE, &nP ) )
- SvUShorts::Remove( nP, nL);
-}
-
-// ---------------- bytestrings -------------------------------------
-
-// Array mit anderer Seek-Methode!
-_SV_IMPL_SORTAR_ALG( SvByteStringsISort, ByteStringPtr )
-void SvByteStringsISort::DeleteAndDestroy( USHORT nP, USHORT nL )
-{
- if( nL )
- {
- DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );
- for( USHORT n=nP; n < nP + nL; n++ )
- delete *((ByteStringPtr*)pData+n);
- SvPtrarr::Remove( nP, nL );
- }
-}
-BOOL SvByteStringsISort::Seek_Entry( const ByteStringPtr aE, USHORT* pP ) const
-{
- register USHORT nO = SvByteStringsISort_SAR::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- StringCompare eCmp = (*((ByteStringPtr*)pData + nM))->
- CompareIgnoreCaseToAscii( *(aE) );
- if( COMPARE_EQUAL == eCmp )
- {
- if( pP ) *pP = nM;
- return TRUE;
- }
- else if( COMPARE_LESS == eCmp )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return FALSE;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return FALSE;
-}
-
-
-// Array mit anderer Seek-Methode!
-_SV_IMPL_SORTAR_ALG( SvByteStringsISortDtor, ByteStringPtr )
-void SvByteStringsISortDtor::DeleteAndDestroy( USHORT nP, USHORT nL )
-{
- if( nL )
- {
- DBG_ASSERT( nP < nA && nP + nL <= nA, "ERR_VAR_DEL" );
- for( USHORT n=nP; n < nP + nL; n++ )
- delete *((ByteStringPtr*)pData+n);
- SvPtrarr::Remove( nP, nL );
- }
-}
-BOOL SvByteStringsISortDtor::Seek_Entry( const ByteStringPtr aE, USHORT* pP ) const
-{
- register USHORT nO = SvByteStringsISortDtor_SAR::Count(),
- nM,
- nU = 0;
- if( nO > 0 )
- {
- nO--;
- while( nU <= nO )
- {
- nM = nU + ( nO - nU ) / 2;
- StringCompare eCmp = (*((ByteStringPtr*)pData + nM))->
- CompareIgnoreCaseToAscii( *(aE) );
- if( COMPARE_EQUAL == eCmp )
- {
- if( pP ) *pP = nM;
- return TRUE;
- }
- else if( COMPARE_LESS == eCmp )
- nU = nM + 1;
- else if( nM == 0 )
- {
- if( pP ) *pP = nU;
- return FALSE;
- }
- else
- nO = nM - 1;
- }
- }
- if( pP ) *pP = nU;
- return FALSE;
-}
-
diff --git a/svtools/source/misc/documentlockfile.cxx b/svtools/source/misc/documentlockfile.cxx
deleted file mode 100644
index 990f1ba58d73..000000000000
--- a/svtools/source/misc/documentlockfile.cxx
+++ /dev/null
@@ -1,238 +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: documentlockfile.cxx,v $
- *
- * $Revision: 1.3.82.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <stdio.h>
-
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#include <com/sun/star/ucb/NameClashException.hpp>
-#include <com/sun/star/io/WrongFormatException.hpp>
-
-#include <osl/time.h>
-#include <osl/security.hxx>
-#include <osl/socket.hxx>
-
-#include <rtl/string.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <comphelper/processfactory.hxx>
-
-#include <tools/urlobj.hxx>
-#include <unotools/bootstrap.hxx>
-
-#include <ucbhelper/content.hxx>
-
-#include <svtools/useroptions.hxx>
-
-#include <svtools/documentlockfile.hxx>
-
-using namespace ::com::sun::star;
-
-namespace svt {
-
-sal_Bool DocumentLockFile::m_bAllowInteraction = sal_True;
-
-// ----------------------------------------------------------------------
-DocumentLockFile::DocumentLockFile( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-: LockFileCommon( aOrigURL, xFactory, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".~lock." ) ) )
-{
-}
-
-// ----------------------------------------------------------------------
-DocumentLockFile::~DocumentLockFile()
-{
-}
-
-// ----------------------------------------------------------------------
-void DocumentLockFile::WriteEntryToStream( uno::Sequence< ::rtl::OUString > aEntry, uno::Reference< io::XOutputStream > xOutput )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- ::rtl::OUStringBuffer aBuffer;
-
- for ( sal_Int32 nEntryInd = 0; nEntryInd < aEntry.getLength(); nEntryInd++ )
- {
- aBuffer.append( EscapeCharacters( aEntry[nEntryInd] ) );
- if ( nEntryInd < aEntry.getLength() - 1 )
- aBuffer.append( (sal_Unicode)',' );
- else
- aBuffer.append( (sal_Unicode)';' );
- }
-
- ::rtl::OString aStringData( ::rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) );
- uno::Sequence< sal_Int8 > aData( (sal_Int8*)aStringData.getStr(), aStringData.getLength() );
- xOutput->writeBytes( aData );
-}
-
-// ----------------------------------------------------------------------
-sal_Bool DocumentLockFile::CreateOwnLockFile()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- try
- {
- uno::Reference< io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ),
- uno::UNO_QUERY_THROW );
- uno::Reference< io::XSeekable > xSeekable( xTempFile, uno::UNO_QUERY_THROW );
-
- uno::Reference< io::XInputStream > xInput = xTempFile->getInputStream();
- uno::Reference< io::XOutputStream > xOutput = xTempFile->getOutputStream();
-
- if ( !xInput.is() || !xOutput.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry();
- WriteEntryToStream( aNewEntry, xOutput );
- xOutput->closeOutput();
-
- xSeekable->seek( 0 );
-
- uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aTargetContent( m_aURL, xEnv );
-
- ucb::InsertCommandArgument aInsertArg;
- aInsertArg.Data = xInput;
- aInsertArg.ReplaceExisting = sal_False;
- uno::Any aCmdArg;
- aCmdArg <<= aInsertArg;
- aTargetContent.executeCommand( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "insert" ) ), aCmdArg );
-
- // try to let the file be hidden if possible
- try {
- aTargetContent.setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), uno::makeAny( sal_True ) );
- } catch( uno::Exception& ) {}
- }
- catch( ucb::NameClashException& )
- {
- return sal_False;
- }
-
- return sal_True;
-}
-
-// ----------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > DocumentLockFile::GetLockData()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- uno::Reference< io::XInputStream > xInput = OpenStream();
- if ( !xInput.is() )
- throw uno::RuntimeException();
-
- const sal_Int32 nBufLen = 32000;
- uno::Sequence< sal_Int8 > aBuffer( nBufLen );
-
- sal_Int32 nRead = 0;
-
- nRead = xInput->readBytes( aBuffer, nBufLen );
- xInput->closeInput();
-
- if ( nRead == nBufLen )
- throw io::WrongFormatException();
-
- sal_Int32 nCurPos = 0;
- return ParseEntry( aBuffer, nCurPos );
-}
-
-// ----------------------------------------------------------------------
-uno::Reference< io::XInputStream > DocumentLockFile::OpenStream()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess(
- xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ),
- uno::UNO_QUERY_THROW );
-
- // the file can be opened readonly, no locking will be done
- return xSimpleFileAccess->openFileRead( m_aURL );
-}
-
-// ----------------------------------------------------------------------
-sal_Bool DocumentLockFile::OverwriteOwnLockFile()
-{
- // allows to overwrite the lock file with the current data
- try
- {
- uno::Reference < ::com::sun::star::ucb::XCommandEnvironment > xEnv;
- ::ucbhelper::Content aTargetContent( m_aURL, xEnv );
-
- uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry();
-
- uno::Reference< io::XStream > xStream = aTargetContent.openWriteableStreamNoLock();
- uno::Reference< io::XOutputStream > xOutput = xStream->getOutputStream();
- uno::Reference< io::XTruncate > xTruncate( xOutput, uno::UNO_QUERY_THROW );
-
- xTruncate->truncate();
- WriteEntryToStream( aNewEntry, xOutput );
- xOutput->closeOutput();
- }
- catch( uno::Exception& )
- {
- return sal_False;
- }
-
- return sal_True;
-}
-
-// ----------------------------------------------------------------------
-void DocumentLockFile::RemoveFile()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // TODO/LATER: the removing is not atomar, is it possible in general to make it atomar?
- uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry();
- uno::Sequence< ::rtl::OUString > aFileData = GetLockData();
-
- if ( aFileData.getLength() < LOCKFILE_ENTRYSIZE )
- throw io::WrongFormatException();
-
- if ( !aFileData[LOCKFILE_SYSUSERNAME_ID].equals( aNewEntry[LOCKFILE_SYSUSERNAME_ID] )
- || !aFileData[LOCKFILE_LOCALHOST_ID].equals( aNewEntry[LOCKFILE_LOCALHOST_ID] )
- || !aFileData[LOCKFILE_USERURL_ID].equals( aNewEntry[LOCKFILE_USERURL_ID] ) )
- throw io::IOException(); // not the owner, access denied
-
- uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess(
- xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ),
- uno::UNO_QUERY_THROW );
- xSimpleFileAccess->kill( m_aURL );
-}
-
-} // namespace svt
-
diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx
index 6e89193f1b6b..4084aa47bc80 100644
--- a/svtools/source/misc/ehdl.cxx
+++ b/svtools/source/misc/ehdl.cxx
@@ -45,7 +45,7 @@
#include <svtools/ehdl.hxx>
#include <svtools/svtdata.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "sfxecode.hxx"
//=========================================================================
diff --git a/svtools/source/misc/ehdl.src b/svtools/source/misc/ehdl.src
index ed32172a92e2..5267d13765c3 100644
--- a/svtools/source/misc/ehdl.src
+++ b/svtools/source/misc/ehdl.src
@@ -29,7 +29,7 @@
************************************************************************/
#define __RSC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "sfxecode.hxx"
// pragma ----------------------------------------------------------------
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 6bd1126f8082..3554f6955171 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -7,7 +7,6 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: embedhlp.cxx,v $
- * $Revision: 1.28 $
*
* This file is part of OpenOffice.org.
*
@@ -33,7 +32,7 @@
#include <svtools/embedhlp.hxx>
#include <svtools/filter.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <comphelper/embeddedobjectcontainer.hxx>
@@ -58,6 +57,7 @@
#include <cppuhelper/implbase4.hxx>
#include "vcl/svapp.hxx"
#include <rtl/logfile.hxx>
+#include <vos/mutex.hxx>
using namespace com::sun::star;
@@ -189,7 +189,6 @@ void SAL_CALL EmbedEventListener_Impl::modified( const lang::EventObject& ) thro
pObject->UpdateReplacementOnDemand();
}
}
-
}
void SAL_CALL EmbedEventListener_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException )
@@ -250,6 +249,9 @@ struct EmbeddedObjectRef_Impl
sal_Int64 nViewAspect;
BOOL bIsLocked;
sal_Bool bNeedUpdate;
+
+ // #i104867#
+ sal_uInt32 mnGraphicVersion;
awt::Size aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member
};
@@ -262,6 +264,7 @@ void EmbeddedObjectRef::Construct_Impl()
mpImp->nViewAspect = embed::Aspects::MSOLE_CONTENT;
mpImp->bIsLocked = FALSE;
mpImp->bNeedUpdate = sal_False;
+ mpImp->mnGraphicVersion = 0;
mpImp->aDefaultSizeForChart_In_100TH_MM = awt::Size(8000,7000);
}
@@ -297,12 +300,14 @@ EmbeddedObjectRef::EmbeddedObjectRef( const EmbeddedObjectRef& rObj )
mpImp->pGraphic = 0;
mpImp->pHCGraphic = 0;
+ mpImp->mnGraphicVersion = 0;
}
EmbeddedObjectRef::~EmbeddedObjectRef()
{
delete mpImp->pGraphic;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
Clear();
}
/*
@@ -453,10 +458,15 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate )
DELETEZ( mpImp->pGraphic );
mpImp->aMediaType = ::rtl::OUString();
mpImp->pGraphic = new Graphic;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
}
else if ( !mpImp->pGraphic )
+ {
mpImp->pGraphic = new Graphic;
+ mpImp->mnGraphicVersion++;
+ }
else
{
DBG_ERROR("No update, but replacement exists already!");
@@ -469,6 +479,7 @@ void EmbeddedObjectRef::GetReplacement( BOOL bUpdate )
GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
if( mpImp->pGraphic )
pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
+ mpImp->mnGraphicVersion++;
delete pGraphicStream;
}
}
@@ -598,6 +609,7 @@ Graphic* EmbeddedObjectRef::GetHCGraphic() const
mpImp->pHCGraphic = pGraphic;
else
delete pGraphic;
+ mpImp->mnGraphicVersion++;
}
delete pStream;
@@ -615,7 +627,9 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
delete mpImp->pGraphic;
mpImp->pGraphic = new Graphic();
mpImp->aMediaType = rMediaType;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( xInGrStream );
@@ -623,6 +637,7 @@ void EmbeddedObjectRef::SetGraphicStream( const uno::Reference< io::XInputStream
{
GraphicFilter* pGF = GraphicFilter::GetGraphicFilter();
pGF->ImportGraphic( *mpImp->pGraphic, String(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW );
+ mpImp->mnGraphicVersion++;
if ( mpImp->pContainer )
{
@@ -645,7 +660,9 @@ void EmbeddedObjectRef::SetGraphic( const Graphic& rGraphic, const ::rtl::OUStri
delete mpImp->pGraphic;
mpImp->pGraphic = new Graphic( rGraphic );
mpImp->aMediaType = rMediaType;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
if ( mpImp->pContainer )
SetGraphicToContainer( rGraphic, *mpImp->pContainer, mpImp->aPersistName, rMediaType );
@@ -880,7 +897,9 @@ void EmbeddedObjectRef::UpdateReplacementOnDemand()
{
DELETEZ( mpImp->pGraphic );
mpImp->bNeedUpdate = sal_True;
- if ( mpImp->pHCGraphic ) DELETEZ( mpImp->pHCGraphic );
+ if ( mpImp->pHCGraphic )
+ DELETEZ( mpImp->pHCGraphic );
+ mpImp->mnGraphicVersion++;
if( mpImp->pContainer )
{
@@ -914,6 +933,12 @@ BOOL EmbeddedObjectRef::IsChart() const
return sal_False;
}
+// #i104867#
+sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const
+{
+ return mpImp->mnGraphicVersion;
+}
+
void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM )
{
//#i103460# charts do not necessaryly have an own size within ODF files,
@@ -928,4 +953,5 @@ void EmbeddedObjectRef::SetDefaultSizeForChart( const Size& rSizeIn_100TH_MM )
xSizeTransmitter->setDefaultSize( mpImp->aDefaultSizeForChart_In_100TH_MM );
}
-}
+} // namespace svt
+
diff --git a/svtools/source/misc/errtxt.src b/svtools/source/misc/errtxt.src
index ebd922bfedf7..3ab58ef92dbf 100644
--- a/svtools/source/misc/errtxt.src
+++ b/svtools/source/misc/errtxt.src
@@ -29,7 +29,7 @@
************************************************************************/
#define __RSC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "sfxecode.hxx"
// pragma ----------------------------------------------------------------
Resource RID_ERRCTX
diff --git a/svtools/source/misc/flbytes.cxx b/svtools/source/misc/flbytes.cxx
deleted file mode 100644
index acf53d9b3e94..000000000000
--- a/svtools/source/misc/flbytes.cxx
+++ /dev/null
@@ -1,432 +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: flbytes.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <vcl/svapp.hxx>
-#include <flbytes.hxx>
-
-#ifndef _SVSTDARR_ULONGS_DECL
-#define _SVSTDARR_ULONGS
-#include <svtools/svstdarr.hxx>
-#undef _SVSTDARR_ULONGS
-#endif
-
-namespace unnamed_svtools_flbytes {} using namespace unnamed_svtools_flbytes;
- // unnamed namespaces don't work well yet
-
-//============================================================================
-namespace unnamed_svtools_flbytes {
-
-inline ULONG MyMin( long a, long b )
-{
- return Max( long( Min( a , b ) ), 0L );
-}
-
-}
-
-//============================================================================
-//
-// SvFillLockBytes
-//
-//============================================================================
-
-TYPEINIT1(SvFillLockBytes, SvLockBytes);
-
-//============================================================================
-SvFillLockBytes::SvFillLockBytes( SvLockBytes* pLockBytes )
- : xLockBytes( pLockBytes ),
- nFilledSize( 0 ),
- bTerminated( FALSE )
-{
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::ReadAt( ULONG nPos, void* pBuffer, ULONG nCount,
- ULONG *pRead ) const
-{
- if( bTerminated )
- return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead );
- else
- {
- ULONG nWanted = nPos + nCount;
- if( IsSynchronMode() )
- {
- while( nWanted > nFilledSize && !bTerminated )
- Application::Yield();
- return xLockBytes->ReadAt( nPos, pBuffer, nCount, pRead );
- }
- else
- {
- ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos );
- ULONG nErr = xLockBytes->ReadAt( nPos, pBuffer, nRead, pRead );
- return ( !nCount || nRead == nCount || nErr ) ?
- nErr : ERRCODE_IO_PENDING;
- }
- }
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::WriteAt( ULONG nPos, const void* pBuffer,
- ULONG nCount, ULONG *pWritten )
-{
- if( bTerminated )
- return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten );
- else
- {
- ULONG nWanted = nPos + nCount;
- if( IsSynchronMode() )
- {
- while( nWanted > nFilledSize && !bTerminated )
- Application::Yield();
- return xLockBytes->WriteAt( nPos, pBuffer, nCount, pWritten );
- }
- else
- {
- ULONG nRead = MyMin( nCount, long( nFilledSize ) - nPos );
- ULONG nErr = xLockBytes->WriteAt( nPos, pBuffer, nRead, pWritten );
- return ( !nCount || nRead == nCount || nErr ) ?
- nErr : ERRCODE_IO_PENDING;
- }
- }
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::Flush() const
-{
- return xLockBytes->Flush( );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::SetSize( ULONG nSize )
-{
- return xLockBytes->SetSize( nSize );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::LockRegion( ULONG nPos, ULONG nCount, LockType eType)
-{
- return xLockBytes->LockRegion( nPos, nCount, eType );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::UnlockRegion(
- ULONG nPos, ULONG nCount, LockType eType)
-{
- return xLockBytes->UnlockRegion( nPos, nCount, eType );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::Stat(
- SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const
-{
- return xLockBytes->Stat( pStat, eFlag );
-}
-
-//============================================================================
-ErrCode SvFillLockBytes::FillAppend( const void* pBuffer, ULONG nCount, ULONG *pWritten )
-{
- ErrCode nRet = xLockBytes->WriteAt(
- nFilledSize, pBuffer, nCount, pWritten );
- nFilledSize += *pWritten;
- return nRet;
-}
-
-//============================================================================
-void SvFillLockBytes::Terminate()
-{
- bTerminated = TRUE;
-}
-
-//============================================================================
-SV_DECL_IMPL_REF_LIST( SvLockBytes, SvLockBytes* )
-
-//============================================================================
-//
-// SvSyncLockBytes
-//
-//============================================================================
-
-TYPEINIT1(SvSyncLockBytes, SvOpenLockBytes);
-
-//============================================================================
-// virtual
-ErrCode SvSyncLockBytes::ReadAt(ULONG nPos, void * pBuffer, ULONG nCount,
- ULONG * pRead) const
-{
- for (ULONG nReadTotal = 0;;)
- {
- ULONG nReadCount = 0;
- ErrCode nError = m_xAsyncLockBytes->ReadAt(nPos, pBuffer, nCount,
- &nReadCount);
- nReadTotal += nReadCount;
- if (nError != ERRCODE_IO_PENDING || !IsSynchronMode())
- {
- if (pRead)
- *pRead = nReadTotal;
- return nError;
- }
- nPos += nReadCount;
- pBuffer = static_cast< sal_Char * >(pBuffer) + nReadCount;
- nCount -= nReadCount;
- Application::Yield();
- }
-}
-
-//============================================================================
-// virtual
-ErrCode SvSyncLockBytes::WriteAt(ULONG nPos, const void * pBuffer,
- ULONG nCount, ULONG * pWritten)
-{
- for (ULONG nWrittenTotal = 0;;)
- {
- ULONG nWrittenCount = 0;
- ErrCode nError = m_xAsyncLockBytes->WriteAt(nPos, pBuffer, nCount,
- &nWrittenCount);
- nWrittenTotal += nWrittenCount;
- if (nError != ERRCODE_IO_PENDING || !IsSynchronMode())
- {
- if (pWritten)
- *pWritten = nWrittenTotal;
- return nError;
- }
- nPos += nWrittenCount;
- pBuffer = static_cast< sal_Char const * >(pBuffer) + nWrittenCount;
- nCount -= nWrittenCount;
- Application::Yield();
- }
-}
-
-//============================================================================
-//
-// SvCompositeLockBytes
-//
-//============================================================================
-
-struct SvCompositeLockBytes_Impl
-{
- SvLockBytesMemberList aLockBytes;
- SvULongs aPositions;
- SvULongs aOffsets;
- BOOL bPending;
- ULONG RelativeOffset( ULONG nPos ) const;
- ErrCode ReadWrite_Impl(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed,
- BOOL bRead );
- SvCompositeLockBytes_Impl() : bPending( FALSE ){}
-};
-
-//============================================================================
-ULONG SvCompositeLockBytes_Impl::RelativeOffset( ULONG nPos ) const
-{
- const SvULongs& rPositions = aPositions;
- const SvULongs& rOffsets = aOffsets;
-
- USHORT nMinPos = 0;
- USHORT nListCount = rPositions.Count();
-
- // Erster Lockbytes, der bearbeitet werden muss
- while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos )
- nMinPos ++;
- ULONG nSectionStart = rPositions[ nMinPos ];
- if( nSectionStart > nPos )
- return ULONG_MAX;
- return rOffsets[ nMinPos ] + nPos - nSectionStart;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes_Impl::ReadWrite_Impl(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pProcessed,
- BOOL bRead )
-{
- ErrCode nErr = ERRCODE_NONE;
- SvULongs& rPositions = aPositions;
- SvULongs& rOffsets = aOffsets;
- SvLockBytesMemberList& rLockBytes = aLockBytes;
-
- ULONG nBytes = nCount;
- USHORT nListCount = rPositions.Count();
- USHORT nMinPos = 0;
-
- // Erster Lockbytes, der bearbeitet werden muss
- while( nMinPos + 1 < nListCount && rPositions[ nMinPos + 1 ] <= nPos )
- nMinPos ++;
- ULONG nSectionStart = rPositions[ nMinPos ];
-
- if( nSectionStart > nPos )
- {
- // Es wird aus fuehrendem Leerbereich gearbeitet
- *pProcessed = 0;
- return ERRCODE_IO_CANTREAD;
- }
-
- ULONG nDone;
- while( nMinPos < nListCount )
- {
- ULONG nToProcess;
- ULONG nSectionStop;
- if( nMinPos + 1 < nListCount )
- {
- nSectionStop = rPositions[ nMinPos + 1 ];
- nToProcess = MyMin( long( nSectionStop ) - nPos, nBytes );
- }
- else
- {
- nToProcess = nBytes;
- nSectionStop = 0;
- }
- ULONG nAbsPos = nPos - nSectionStart + rOffsets[ nMinPos ];
- SvLockBytes* pLB = rLockBytes.GetObject( nMinPos );
- if( bRead )
- nErr = pLB->ReadAt( nAbsPos, pBuffer, nToProcess, &nDone );
- else
- nErr = pLB->WriteAt( nAbsPos, pBuffer, nToProcess, &nDone );
- nBytes -= nDone;
- if( nErr || nDone < nToProcess || !nBytes )
- {
- *pProcessed = nCount - nBytes;
- // Wenn aus dem letzten LockBytes nichts mehr gelesen wurde und
- // bPending gesetzt ist, Pending zurueck
- if( !nDone && nMinPos == nListCount - 1 )
- return bPending ? ERRCODE_IO_PENDING : nErr;
- else return nErr;
- }
- pBuffer = static_cast< sal_Char * >(pBuffer) + nDone;
- nPos += nDone;
- nSectionStart = nSectionStop;
- nMinPos++;
- }
- return nErr;
-}
-
-//============================================================================
-TYPEINIT1(SvCompositeLockBytes, SvLockBytes);
-
-//============================================================================
-SvCompositeLockBytes::SvCompositeLockBytes()
- : pImpl( new SvCompositeLockBytes_Impl )
-{
-}
-
-//============================================================================
-SvCompositeLockBytes::~SvCompositeLockBytes()
-{
- delete pImpl;
-}
-
-//============================================================================
-void SvCompositeLockBytes::SetIsPending( BOOL bSet )
-{
- pImpl->bPending = bSet;
-}
-
-//============================================================================
-ULONG SvCompositeLockBytes::RelativeOffset( ULONG nPos ) const
-{
- return pImpl->RelativeOffset( nPos );
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::ReadAt(
- ULONG nPos, void* pBuffer, ULONG nCount, ULONG* pRead ) const
-{
- return pImpl->ReadWrite_Impl( nPos, pBuffer, nCount, pRead, TRUE );
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::WriteAt(
- ULONG nPos, const void* pBuffer, ULONG nCount, ULONG* pWritten )
-{
- return pImpl->ReadWrite_Impl(
- nPos, const_cast< void * >(pBuffer), nCount, pWritten, FALSE );
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::Flush() const
-{
- SvLockBytesMemberList& rLockBytes = pImpl->aLockBytes;
- ErrCode nErr = ERRCODE_NONE;
- for( USHORT nCount = (USHORT)rLockBytes.Count(); !nErr && nCount--; )
- nErr = rLockBytes.GetObject( nCount )->Flush();
- return nErr;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::SetSize( ULONG )
-{
- DBG_ERROR( "not implemented" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::LockRegion( ULONG, ULONG, LockType )
-{
- DBG_ERROR( "not implemented" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::UnlockRegion(
- ULONG, ULONG, LockType )
-{
- DBG_ERROR( "not implemented" );
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-ErrCode SvCompositeLockBytes::Stat(
- SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag) const
-{
- USHORT nMax = pImpl->aPositions.Count() - 1;
-
- SvLockBytesStat aStat;
- ErrCode nErr = pImpl->aLockBytes.GetObject( nMax )->Stat( &aStat, eFlag );
- pStat->nSize = pImpl->aPositions[ nMax ] + aStat.nSize;
-
- return nErr;
-}
-
-//============================================================================
-void SvCompositeLockBytes::Append(
- SvLockBytes* pLockBytes, ULONG nPos, ULONG nOffset )
-{
- USHORT nCount = pImpl->aOffsets.Count();
- pImpl->aLockBytes.Insert( pLockBytes, nCount );
- pImpl->aPositions.Insert( nPos, nCount );
- pImpl->aOffsets.Insert( nOffset, nCount );
-}
-
-//============================================================================
-SvLockBytes* SvCompositeLockBytes::GetLastLockBytes() const
-{
- return pImpl->aLockBytes.Count() ?
- pImpl->aLockBytes.GetObject( pImpl->aLockBytes.Count() - 1 ) : 0;
-}
-
diff --git a/svtools/source/misc/helpagent.src b/svtools/source/misc/helpagent.src
index 3b9e2a450ec1..181583bc8f6d 100644
--- a/svtools/source/misc/helpagent.src
+++ b/svtools/source/misc/helpagent.src
@@ -29,7 +29,7 @@
************************************************************************/
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
Bitmap BMP_HELP_AGENT_IMAGE
diff --git a/svtools/source/misc/helpagentwindow.cxx b/svtools/source/misc/helpagentwindow.cxx
index 368c55a94ade..51cd7ebfb740 100644
--- a/svtools/source/misc/helpagentwindow.cxx
+++ b/svtools/source/misc/helpagentwindow.cxx
@@ -39,7 +39,7 @@
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx
index 314242063711..76752b27354e 100644
--- a/svtools/source/misc/imagemgr.cxx
+++ b/svtools/source/misc/imagemgr.cxx
@@ -55,9 +55,10 @@
#include <rtl/logfile.hxx>
#include <unotools/configmgr.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "imagemgr.hrc"
#include <svtools/svtdata.hxx>
+#include <vos/mutex.hxx>
// globals *******************************************************************
diff --git a/svtools/source/misc/imagemgr.src b/svtools/source/misc/imagemgr.src
index 0aada34305da..e082398beaa1 100644
--- a/svtools/source/misc/imagemgr.src
+++ b/svtools/source/misc/imagemgr.src
@@ -29,7 +29,7 @@
************************************************************************/
// includes ******************************************************************
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include "imagemgr.hrc"
// images ********************************************************************
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index 9fb60111094e..df7760f7931b 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -36,7 +36,7 @@
#include <vcl/mapmod.hxx>
#include <vcl/window.hxx>
-#include "urihelper.hxx"
+#include "svl/urihelper.hxx"
#include <svtools/imap.hxx>
#include <svtools/imapobj.hxx>
#include <svtools/imapcirc.hxx>
diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx
index b1e03a574188..1dd10c36c81a 100644
--- a/svtools/source/misc/imap2.cxx
+++ b/svtools/source/misc/imap2.cxx
@@ -43,7 +43,7 @@
#endif
#include <sot/formats.hxx>
-#include "urihelper.hxx"
+#include "svl/urihelper.hxx"
#include <svtools/imap.hxx>
#include <svtools/imap.hxx>
#include <svtools/imapobj.hxx>
diff --git a/svtools/source/misc/inidef.cxx b/svtools/source/misc/inidef.cxx
deleted file mode 100644
index bdecd1b833dd..000000000000
--- a/svtools/source/misc/inidef.cxx
+++ /dev/null
@@ -1,269 +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: inidef.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-
-#include <tools/string.hxx>
-#include "inetdef.hxx"
-#include "inidef.hxx"
-
-//========================================================================
-
-class SfxStdIniDef_Impl: public SfxIniDefaulter
-{
-public:
- SfxStdIniDef_Impl( SfxIniDefaultManager *pDefMgr )
- : SfxIniDefaulter( pDefMgr )
- {}
- virtual BOOL QueryDefault( String &rValue, const SfxIniEntry &rEntry );
-};
-
-//-------------------------------------------------------------------------
-
-BOOL SfxStdIniDef_Impl::QueryDefault( String &rValue, const SfxIniEntry &rEntry )
-{
- switch ( rEntry.GetKey() )
- {
- case SFX_KEY_BROWSERRESTORE:
- {
- rValue = "1";
- return TRUE;
- }
-
- case SFX_KEY_INET_HOME:
- {
- if ( System::GetLanguage() == LANGUAGE_GERMAN )
- rValue = "http://www.stardivision.de";
- else
- rValue = "http://www.stardivision.com";
- return TRUE;
- }
-
- case SFX_KEY_INET_MEMCACHE:
- rValue = "4";
- return TRUE;
-
- case SFX_KEY_INET_DISKCACHE:
- rValue = "2048";
- return TRUE;
-
- case SFX_KEY_INET_CACHEEXPIRATION:
- rValue = "3";
- return TRUE;
-
- case SFX_KEY_INET_MAXHTTPCONS:
- rValue = "4";
- return TRUE;
-
- case SFX_KEY_INET_MAXFTPCONS:
- rValue = "2";
- return TRUE;
-
-// case SFX_KEY_INET_JAVAMINHEAP:
-// rValue = "256";
-// return TRUE;
-
-// case SFX_KEY_INET_JAVAMAXHEAP:
-// rValue = "";
-// return TRUE;
-
- case SFX_KEY_INET_USERAGENT:
- rValue = INET_DEF_CALLERNAME;
- return TRUE;
-
- case SFX_KEY_INET_EXE_JAVASCRIPT:
-#ifdef SOLAR_JAVA
- rValue = "0"; // noch "0", solange es noch soviel Bugs gibt
-#else
- rValue = "0"; // immer "0"
-#endif
- return TRUE;
-
- case SFX_KEY_INET_EXE_PLUGIN:
- rValue = "1";
- return TRUE;
-
-/* case SFX_KEY_INET_JAVA_ENABLE:
-#ifdef SOLAR_JAVA
- rValue = "1";
-#else
- rValue = "0";
-#endif
- return TRUE; */
-
-// case SFX_KEY_INET_NETACCESS:
-// rValue = "2";
-// return TRUE;
-
- case SFX_KEY_INET_CHANNELS:
- rValue = "1";
- return TRUE;
-
- case SFX_KEY_BASIC_ENABLE:
- rValue = "1";
- return TRUE;
-
- case SFX_KEY_INET_COOKIES:
- rValue = "1";
- return TRUE;
-
- case SFX_KEY_ICONGRID:
- rValue = "100;70;0";
- return TRUE;
-
- case SFX_KEY_METAFILEPRINT:
- rValue = "1";
- return TRUE;
- }
-
- return SfxIniDefaulter::QueryDefault( rValue, rEntry );
-}
-
-//=========================================================================
-
-SfxIniDefaultManager::SfxIniDefaultManager()
-: _pList( new SfxIniDefaulterList )
-{
- new SfxStdIniDef_Impl( this );
-}
-
-//-------------------------------------------------------------------------
-
-SfxIniDefaultManager::~SfxIniDefaultManager()
-{
- if ( _pList )
- {
- for ( USHORT n = _pList->Count(); n--; )
- delete _pList->GetObject(n);
- delete _pList;
- }
-}
-
-//-------------------------------------------------------------------------
-
-BOOL SfxIniDefaultManager::QueryDefault
-(
- String& rValue, /* out: Default-Wert f"ur 'rEntry'
- (Default ist Leerstring) */
- const SfxIniEntry& rEntry // in: Beschreibung des Eintrags
-)
-
-/* [Beschreibung]
-
- "Uber diese interne Methode besorgt sich der <SfxIniManager> den
- Default f"ur einen in 'rEntry' beschriebenen Eintrag.
-*/
-
-{
- for ( USHORT n = _pList->Count(); n--; )
- if ( _pList->GetObject(n)->QueryDefault( rValue, rEntry ) )
- return TRUE;
- return FALSE;
-}
-
-//=========================================================================
-
-SfxIniDefaulter::SfxIniDefaulter( SfxIniDefaultManager *pManager )
-
-/* [Beschreibung]
-
- Der Ctor dieser Klasse meldet die neue Instanz automatisch am
- <SfxiniDefaultManager> 'pManager' an.
-*/
-
-: _pManager( pManager )
-
-{
- pManager->Insert( this );
-}
-
-//-------------------------------------------------------------------------
-
-SfxIniDefaulter::~SfxIniDefaulter()
-
-/* [Beschreibung]
-
- Der Dtor dieser Klasse meldet die neue Instanz automatisch am
- <SfxiniDefaultManager> ab, der im Ctor angegeben wurde.
-*/
-
-{
- _pManager->Remove( this );
-}
-
-//-------------------------------------------------------------------------
-
-BOOL SfxIniDefaulter::QueryDefault
-(
- String& rValue, /* out: Default-Wert f"ur 'rEntry'
- (Default ist Leerstring) */
- const SfxIniEntry& rEntry // in: Beschreibung des Eintrags
-)
-
-/* [Beschreibung]
-
- Diese virtuelle Methode mu\s "uberladen werden. Sie soll dann in
- 'rValue' einen Default-Wert f"ur den in 'rEntry' beschriebenen
- ini-Eintrag setzen, falls ihr dieser bekannt ist.
-
-
- [Returnwert]
-
- TRUE In 'rValue' befindet sich der Default-Wert.
-
- FALSE F"ur diesen Eintrag ist kein Default-Wert bekannt.
-
-*/
-
-{
- return FALSE;
-};
-
-//========================================================================
-
-SfxIniEntry::SfxIniEntry
-(
- const String& aGroup,
- const String& aKey,
- SfxIniGroup eGroup,
- SfxIniKey eKey,
- USHORT nIndex
-)
-: _aGroup( aGroup ),
- _aKey( aKey ),
- _eGroup( eGroup ),
- _eKey( eKey ),
- _nIndex( nIndex )
-{
-}
-
-
diff --git a/svtools/source/misc/iniprop.cxx b/svtools/source/misc/iniprop.cxx
deleted file mode 100644
index 16e0e5bc48a7..000000000000
--- a/svtools/source/misc/iniprop.cxx
+++ /dev/null
@@ -1,47 +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: iniprop.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-
-#include "iniprop.hxx"
-
-//-------------------------------------------------------------------------
-
-TYPEINIT1(SfxAppIniManagerProperty, ApplicationProperty);
-
-//-------------------------------------------------------------------------
-
-SfxAppIniManagerProperty::~SfxAppIniManagerProperty()
-{
-}
-
-
diff --git a/svtools/source/items/itemdel.cxx b/svtools/source/misc/itemdel.cxx
index 4028aa497c22..9db70f852d30 100644
--- a/svtools/source/items/itemdel.cxx
+++ b/svtools/source/misc/itemdel.cxx
@@ -37,8 +37,8 @@
#include <limits.h>
#include <svtools/svtdata.hxx>
-#include <svtools/svarray.hxx>
-#include <svtools/itempool.hxx>
+#include <svl/svarray.hxx>
+#include <svl/itempool.hxx>
// STATIC DATA -----------------------------------------------------------
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index 870e6378a216..ef2cedcc50c2 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -42,10 +42,10 @@
#include <i18npool/lang.h>
#include <i18npool/mslangid.hxx>
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#include <svtools/svtdata.hxx>
#include <svtools/langtab.hxx>
-#include <svtools/syslocale.hxx>
+#include <unotools/syslocale.hxx>
using namespace ::com::sun::star;
diff --git a/svtools/source/misc/langtab.src b/svtools/source/misc/langtab.src
index 4458d4b0f132..0aa90f8e96b9 100644
--- a/svtools/source/misc/langtab.src
+++ b/svtools/source/misc/langtab.src
@@ -29,7 +29,7 @@
************************************************************************/
// include ---------------------------------------------------------------
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#define RSC_RESOURCE_USAGE 1
#include <i18npool/lang.h>
diff --git a/svtools/source/misc/lockfilecommon.cxx b/svtools/source/misc/lockfilecommon.cxx
deleted file mode 100644
index ef2cf89d8572..000000000000
--- a/svtools/source/misc/lockfilecommon.cxx
+++ /dev/null
@@ -1,276 +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: ,v $
- *
- * $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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include <stdio.h>
-
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#include <com/sun/star/ucb/NameClashException.hpp>
-#include <com/sun/star/io/WrongFormatException.hpp>
-
-#include <osl/time.h>
-#include <osl/security.hxx>
-#include <osl/socket.hxx>
-#include <osl/file.hxx>
-
-#include <rtl/string.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <comphelper/processfactory.hxx>
-
-#include <tools/urlobj.hxx>
-#include <unotools/bootstrap.hxx>
-
-#include <ucbhelper/content.hxx>
-
-#include <svtools/useroptions.hxx>
-
-#include <svtools/lockfilecommon.hxx>
-
-using namespace ::com::sun::star;
-
-namespace svt {
-
-// ----------------------------------------------------------------------
-LockFileCommon::LockFileCommon( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory, const ::rtl::OUString& aPrefix )
-: m_xFactory( xFactory )
-{
- if ( !m_xFactory.is() )
- m_xFactory = ::comphelper::getProcessServiceFactory();
-
- INetURLObject aDocURL = ResolveLinks( INetURLObject( aOrigURL ) );
-
- ::rtl::OUString aShareURLString = aDocURL.GetPartBeforeLastName();
- aShareURLString += aPrefix;
- aShareURLString += aDocURL.GetName();
- aShareURLString += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "#" ) );
- m_aURL = INetURLObject( aShareURLString ).GetMainURL( INetURLObject::NO_DECODE );
-}
-
-// ----------------------------------------------------------------------
-LockFileCommon::~LockFileCommon()
-{
-}
-
-// ----------------------------------------------------------------------
-INetURLObject LockFileCommon::ResolveLinks( const INetURLObject& aDocURL )
-{
- if ( aDocURL.HasError() )
- throw lang::IllegalArgumentException();
-
- ::rtl::OUString aURLToCheck = aDocURL.GetMainURL( INetURLObject::NO_DECODE );
-
- sal_Bool bNeedsChecking = sal_True;
- sal_Int32 nMaxLinkCount = 128;
- sal_Int32 nCount = 0;
-
- while( bNeedsChecking )
- {
- bNeedsChecking = sal_False;
-
- // do not allow too deep links
- if ( nCount++ >= nMaxLinkCount )
- throw io::IOException();
-
- // there is currently no UCB functionality to resolve the symbolic links;
- // since the lock files are used only for local file systems the osl functionality is used directly
-
- ::osl::FileStatus aStatus( FileStatusMask_Type | FileStatusMask_LinkTargetURL );
- ::osl::DirectoryItem aItem;
- if ( ::osl::FileBase::E_None == ::osl::DirectoryItem::get( aURLToCheck, aItem )
- && aItem.is() && ::osl::FileBase::E_None == aItem.getFileStatus( aStatus ) )
- {
- if ( aStatus.isValid( FileStatusMask_Type )
- && aStatus.isValid( FileStatusMask_LinkTargetURL )
- && aStatus.getFileType() == ::osl::FileStatus::Link )
- {
- aURLToCheck = aStatus.getLinkTargetURL();
- bNeedsChecking = sal_True;
- }
- }
- }
-
- return INetURLObject( aURLToCheck );
-}
-
-// ----------------------------------------------------------------------
-uno::Sequence< uno::Sequence< ::rtl::OUString > > LockFileCommon::ParseList( const uno::Sequence< sal_Int8 >& aBuffer )
-{
- sal_Int32 nCurPos = 0;
- sal_Int32 nCurEntry = 0;
- uno::Sequence< uno::Sequence< ::rtl::OUString > > aResult( 10 );
-
- while ( nCurPos < aBuffer.getLength() )
- {
- if ( nCurEntry >= aResult.getLength() )
- aResult.realloc( nCurEntry + 10 );
- aResult[nCurEntry] = ParseEntry( aBuffer, nCurPos );
- nCurEntry++;
- }
-
- aResult.realloc( nCurEntry );
- return aResult;
-}
-
-// ----------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > LockFileCommon::ParseEntry( const uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& io_nCurPos )
-{
- uno::Sequence< ::rtl::OUString > aResult( LOCKFILE_ENTRYSIZE );
-
- for ( int nInd = 0; nInd < LOCKFILE_ENTRYSIZE; nInd++ )
- {
- aResult[nInd] = ParseName( aBuffer, io_nCurPos );
- if ( io_nCurPos >= aBuffer.getLength()
- || ( nInd < LOCKFILE_ENTRYSIZE - 1 && aBuffer[io_nCurPos++] != ',' )
- || ( nInd == LOCKFILE_ENTRYSIZE - 1 && aBuffer[io_nCurPos++] != ';' ) )
- throw io::WrongFormatException();
- }
-
- return aResult;
-}
-
-// ----------------------------------------------------------------------
-::rtl::OUString LockFileCommon::ParseName( const uno::Sequence< sal_Int8 >& aBuffer, sal_Int32& io_nCurPos )
-{
- ::rtl::OStringBuffer aResult;
- sal_Bool bHaveName = sal_False;
- sal_Bool bEscape = sal_False;
-
- while( !bHaveName )
- {
- if ( io_nCurPos >= aBuffer.getLength() )
- throw io::WrongFormatException();
-
- if ( bEscape )
- {
- if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' || aBuffer[io_nCurPos] == '\\' )
- aResult.append( (sal_Char)aBuffer[io_nCurPos] );
- else
- throw io::WrongFormatException();
-
- bEscape = sal_False;
- io_nCurPos++;
- }
- else if ( aBuffer[io_nCurPos] == ',' || aBuffer[io_nCurPos] == ';' )
- bHaveName = sal_True;
- else
- {
- if ( aBuffer[io_nCurPos] == '\\' )
- bEscape = sal_True;
- else
- aResult.append( (sal_Char)aBuffer[io_nCurPos] );
-
- io_nCurPos++;
- }
- }
-
- return ::rtl::OStringToOUString( aResult.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
-}
-
-// ----------------------------------------------------------------------
-::rtl::OUString LockFileCommon::EscapeCharacters( const ::rtl::OUString& aSource )
-{
- ::rtl::OUStringBuffer aBuffer;
- const sal_Unicode* pStr = aSource.getStr();
- for ( sal_Int32 nInd = 0; nInd < aSource.getLength() && pStr[nInd] != 0; nInd++ )
- {
- if ( pStr[nInd] == '\\' || pStr[nInd] == ';' || pStr[nInd] == ',' )
- aBuffer.append( (sal_Unicode)'\\' );
- aBuffer.append( pStr[nInd] );
- }
-
- return aBuffer.makeStringAndClear();
-}
-
-// ----------------------------------------------------------------------
-::rtl::OUString LockFileCommon::GetOOOUserName()
-{
- SvtUserOptions aUserOpt;
- ::rtl::OUString aName = aUserOpt.GetFirstName();
- if ( aName.getLength() )
- aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) );
- aName += aUserOpt.GetLastName();
-
- return aName;
-}
-
-// ----------------------------------------------------------------------
-::rtl::OUString LockFileCommon::GetCurrentLocalTime()
-{
- ::rtl::OUString aTime;
-
- TimeValue aSysTime;
- if ( osl_getSystemTime( &aSysTime ) )
- {
- TimeValue aLocTime;
- if ( osl_getLocalTimeFromSystemTime( &aSysTime, &aLocTime ) )
- {
- oslDateTime aDateTime;
- if ( osl_getDateTimeFromTimeValue( &aLocTime, &aDateTime ) )
- {
- char pDateTime[20];
- sprintf( pDateTime, "%02d.%02d.%4d %02d:%02d", aDateTime.Day, aDateTime.Month, aDateTime.Year, aDateTime.Hours, aDateTime.Minutes );
- aTime = ::rtl::OUString::createFromAscii( pDateTime );
- }
- }
- }
-
- return aTime;
-}
-
-// ----------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > LockFileCommon::GenerateOwnEntry()
-{
- uno::Sequence< ::rtl::OUString > aResult( LOCKFILE_ENTRYSIZE );
-
- aResult[LOCKFILE_OOOUSERNAME_ID] = GetOOOUserName();
-
- ::osl::Security aSecurity;
- aSecurity.getUserName( aResult[LOCKFILE_SYSUSERNAME_ID] );
-
- aResult[LOCKFILE_LOCALHOST_ID] = ::osl::SocketAddr::getLocalHostname();
-
- aResult[LOCKFILE_EDITTIME_ID] = GetCurrentLocalTime();
-
- ::utl::Bootstrap::locateUserInstallation( aResult[LOCKFILE_USERURL_ID] );
-
-
- return aResult;
-}
-
-} // namespace svt
-
diff --git a/svtools/source/misc/makefile.mk b/svtools/source/misc/makefile.mk
index a23092e120da..77cf8a41a8bd 100644
--- a/svtools/source/misc/makefile.mk
+++ b/svtools/source/misc/makefile.mk
@@ -46,11 +46,9 @@ ENABLE_EXCEPTIONS := TRUE
SRS1NAME=misc
SRC1FILES=\
- config.src \
- iniman.src \
ehdl.src \
- imagemgr.src \
helpagent.src \
+ imagemgr.src \
langtab.src
SRS2NAME=ehdl
@@ -59,33 +57,28 @@ SRC2FILES=\
SLOFILES=\
$(SLO)$/acceleratorexecute.obj \
+ $(SLO)$/chartprettypainter.obj \
$(SLO)$/cliplistener.obj \
+ $(SLO)$/dialogclosedlistener.obj\
+ $(SLO)$/dialogcontrolling.obj \
+ $(SLO)$/ehdl.obj \
$(SLO)$/embedhlp.obj \
$(SLO)$/embedtransfer.obj \
+ $(SLO)$/helpagentwindow.obj \
$(SLO)$/imagemgr.obj \
$(SLO)$/imageresourceaccess.obj \
- $(SLO)$/templatefoldercache.obj \
- $(SLO)$/transfer.obj \
- $(SLO)$/transfer2.obj \
- $(SLO)$/stringtransfer.obj \
- $(SLO)$/urihelper.obj \
- $(SLO)$/svtaccessiblefactory.obj \
- $(SLO)$/ehdl.obj \
- $(SLO)$/flbytes.obj \
- $(SLO)$/helpagentwindow.obj \
$(SLO)$/imap.obj \
$(SLO)$/imap2.obj \
$(SLO)$/imap3.obj \
- $(SLO)$/ownlist.obj \
- $(SLO)$/vcldata.obj \
- $(SLO)$/restrictedpaths.obj \
- $(SLO)$/dialogclosedlistener.obj\
- $(SLO)$/dialogcontrolling.obj \
- $(SLO)$/chartprettypainter.obj \
- $(SLO)$/lockfilecommon.obj \
- $(SLO)$/sharecontrolfile.obj \
- $(SLO)$/documentlockfile.obj \
- $(SLO)$/langtab.obj
+ $(SLO)$/itemdel.obj \
+ $(SLO)$/langtab.obj \
+ $(SLO)$/stringtransfer.obj \
+ $(SLO)$/svtaccessiblefactory.obj \
+ $(SLO)$/svtdata.obj \
+ $(SLO)$/templatefoldercache.obj \
+ $(SLO)$/transfer.obj \
+ $(SLO)$/transfer2.obj \
+ $(SLO)$/wallitem.obj
# --- Targets -------------------------------------------------------
diff --git a/svtools/source/misc/ownlist.cxx b/svtools/source/misc/ownlist.cxx
deleted file mode 100644
index 346b4ff7251e..000000000000
--- a/svtools/source/misc/ownlist.cxx
+++ /dev/null
@@ -1,330 +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: ownlist.cxx,v $
- * $Revision: 1.6.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <ctype.h>
-#include <stdio.h>
-#include <com/sun/star/beans/PropertyValues.hpp>
-
-#include <svtools/ownlist.hxx>
-
-using namespace com::sun::star;
-
-//=========================================================================
-//============== SvCommandList ============================================
-//=========================================================================
-PRV_SV_IMPL_OWNER_LIST(SvCommandList,SvCommand)
-
-
-static String parseString(const String & rCmd, USHORT * pIndex)
-{
- String result;
-
- if(rCmd.GetChar( *pIndex ) == '\"') {
- (*pIndex) ++;
-
- USHORT begin = *pIndex;
-
- while(*pIndex < rCmd.Len() && rCmd.GetChar((*pIndex) ++) != '\"') ;
-
- result = String(rCmd.Copy(begin, *pIndex - begin - 1));
- }
-
- return result;
-}
-
-static String parseWord(const String & rCmd, USHORT * pIndex)
-{
- USHORT begin = *pIndex;
-
- while(*pIndex < rCmd.Len() && !isspace(rCmd.GetChar(*pIndex)) && rCmd.GetChar(*pIndex) != '=')
- (*pIndex) ++;
-
- return String(rCmd.Copy(begin, *pIndex - begin));
-}
-
-static void eatSpace(const String & rCmd, USHORT * pIndex)
-{
- while(*pIndex < rCmd.Len() && isspace(rCmd.GetChar(*pIndex)))
- (*pIndex) ++;
-}
-
-
-//=========================================================================
-BOOL SvCommandList::AppendCommands
-(
- const String & rCmd, /* Dieser Text wird in Kommandos umgesetzt */
- USHORT * pEaten /* Anzahl der Zeichen, die gelesen wurden */
-)
-/* [Beschreibung]
-
- Es wird eine Text geparsed und die einzelnen Kommandos werden an
- die Liste angeh"angt.
-
- [R"uckgabewert]
-
- BOOL TRUE, der Text wurde korrekt geparsed.
- FALSE, der Text wurde nicht korrekt geparsed.
-*/
-{
- USHORT index = 0;
- while(index < rCmd.Len())
- {
-
- eatSpace(rCmd, &index);
- String name = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
-
- eatSpace(rCmd, &index);
- String value;
- if(index < rCmd.Len() && rCmd.GetChar(index) == '=')
- {
- index ++;
-
- eatSpace(rCmd, &index);
- value = (rCmd.GetChar(index) == '\"') ? parseString(rCmd, &index) : parseWord(rCmd, &index);
- }
-
- SvCommand * pCmd = new SvCommand(name, value);
- aTypes.Insert(pCmd, LIST_APPEND);
- }
-
- *pEaten = index;
-
-// USHORT nPos = 0;
-// while( nPos < rCmd.Len() )
-// {
-// // ein Zeichen ? Dann faengt hier eine Option an
-// if( isalpha( rCmd[nPos] ) )
-// {
-// String aValue;
-// USHORT nStt = nPos;
-// register char c;
-
-// while( nPos < rCmd.Len() &&
-// ( isalnum(c=rCmd[nPos]) || '-'==c || '.'==c ) )
-// nPos++;
-
-// String aToken( rCmd.Copy( nStt, nPos-nStt ) );
-
-// while( nPos < rCmd.Len() &&
-// ( !String::IsPrintable( (c=rCmd[nPos]),
-// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) )
-// nPos++;
-
-// // hat die Option auch einen Wert?
-// if( nPos!=rCmd.Len() && '='==c )
-// {
-// nPos++;
-
-// while( nPos < rCmd.Len() &&
-// ( !String::IsPrintable( (c=rCmd[nPos]),
-// RTL_TEXTENCODING_MS_1252 ) || isspace(c) ) )
-// nPos++;
-
-// if( nPos != rCmd.Len() )
-// {
-// USHORT nLen = 0;
-// nStt = nPos;
-// if( '"' == c )
-// {
-// nPos++; nStt++;
-// while( nPos < rCmd.Len() &&
-// '"' != rCmd[nPos] )
-// nPos++, nLen++;
-// if( nPos!=rCmd.Len() )
-// nPos++;
-// }
-// else
-// // hier sind wir etwas laxer als der
-// // Standard und erlauben alles druckbare
-// while( nPos < rCmd.Len() &&
-// String::IsPrintable( (c=rCmd[nPos]),
-// RTL_TEXTENCODING_MS_1252 ) &&
-// !isspace( c ) )
-// nPos++, nLen++;
-
-// if( nLen )
-// aValue = rCmd( nStt, nLen );
-// }
-// }
-
-// SvCommand * pCmd = new SvCommand( aToken, aValue );
-// aTypes.Insert( pCmd, LIST_APPEND );
-// }
-// else
-// // white space un unerwartete Zeichen ignorieren wie
-// nPos++;
-// }
-// *pEaten = nPos;
- return TRUE;
-}
-
-//=========================================================================
-String SvCommandList::GetCommands() const
-/* [Beschreibung]
-
- Die Kommandos in der Liste werden als Text hintereinander, durch ein
- Leerzeichen getrennt geschrieben. Der Text muss nicht genauso
- aussehen wie der in <SvCommandList::AppendCommands()> "ubergebene.
-
- [R"uckgabewert]
-
- String Die Kommandos werden zur"uckgegeben.
-*/
-{
- String aRet;
- for( ULONG i = 0; i < aTypes.Count(); i++ )
- {
- if( i != 0 )
- aRet += ' ';
- SvCommand * pCmd = (SvCommand *)aTypes.GetObject( i );
- aRet += pCmd->GetCommand();
- if( pCmd->GetArgument().Len() )
- {
- aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "=\"" ) );
- aRet += pCmd->GetArgument();
- aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\"" ) );
- }
- }
- return aRet;
-}
-
-//=========================================================================
-SvCommand & SvCommandList::Append
-(
- const String & rCommand, /* das Kommando */
- const String & rArg /* dasArgument des Kommandos */
-)
-/* [Beschreibung]
-
- Es wird eine Objekt vom Typ SvCommand erzeugt und an die Liste
- angeh"angt.
-
- [R"uckgabewert]
-
- SvCommand & Das erteugte Objekt wird zur"uckgegeben.
-*/
-{
- SvCommand * pCmd = new SvCommand( rCommand, rArg );
- aTypes.Insert( pCmd, LIST_APPEND );
- return *pCmd;
-}
-
-//=========================================================================
-SvStream & operator >>
-(
- SvStream & rStm, /* Stream aus dem gelesen wird */
- SvCommandList & rThis /* Die zu f"ullende Liste */
-)
-/* [Beschreibung]
-
- Die Liste mit ihren Elementen wird gelesen. Das Format ist:
- 1. Anzahl der Elemente
- 2. Alle Elemente
-
- [R"uckgabewert]
-
- SvStream & Der "ubergebene Stream.
-*/
-{
- UINT32 nCount = 0;
- rStm >> nCount;
- if( !rStm.GetError() )
- {
- while( nCount-- )
- {
- SvCommand * pCmd = new SvCommand();
- rStm >> *pCmd;
- rThis.aTypes.Insert( pCmd, LIST_APPEND );
- }
- }
- return rStm;
-}
-
-//=========================================================================
-SvStream & operator <<
-(
- SvStream & rStm, /* Stream in den geschrieben wird */
- const SvCommandList & rThis /* Die zu schreibende Liste */
-)
-/* [Beschreibung]
-
- Die Liste mit ihren Elementen wir geschrieben. Das Format ist:
- 1. Anzahl der Elemente
- 2. Alle Elemente
-
- [R"uckgabewert]
-
- SvStream & Der "ubergebene Stream.
-*/
-{
- UINT32 nCount = rThis.aTypes.Count();
- rStm << nCount;
-
- for( UINT32 i = 0; i < nCount; i++ )
- {
- SvCommand * pCmd = (SvCommand *)rThis.aTypes.GetObject( i );
- rStm << *pCmd;
- }
- return rStm;
-}
-
-BOOL SvCommandList::FillFromSequence( const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence )
-{
- const sal_Int32 nCount = aCommandSequence.getLength();
- String aCommand, aArg;
- ::rtl::OUString aApiArg;
- for( sal_Int32 nIndex=0; nIndex<nCount; nIndex++ )
- {
- aCommand = aCommandSequence[nIndex].Name;
- if( !( aCommandSequence[nIndex].Value >>= aApiArg ) )
- return sal_False;
- aArg = aApiArg;
- Append( aCommand, aArg );
- }
-
- return TRUE;
-}
-
-void SvCommandList::FillSequence( com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >& aCommandSequence )
-{
- const sal_Int32 nCount = Count();
- aCommandSequence.realloc( nCount );
- for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ )
- {
- const SvCommand& rCommand = (*this)[ nIndex ];
- aCommandSequence[nIndex].Name = rCommand.GetCommand();
- aCommandSequence[nIndex].Handle = -1;
- aCommandSequence[nIndex].Value = uno::makeAny( ::rtl::OUString( rCommand.GetArgument() ) );
- aCommandSequence[nIndex].State = beans::PropertyState_DIRECT_VALUE;
- }
-}
-
diff --git a/svtools/source/misc/restrictedpaths.cxx b/svtools/source/misc/restrictedpaths.cxx
deleted file mode 100644
index 354e32126680..000000000000
--- a/svtools/source/misc/restrictedpaths.cxx
+++ /dev/null
@@ -1,217 +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: restrictedpaths.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_svtools.hxx"
-#include <svtools/restrictedpaths.hxx>
-
-#include <algorithm>
-#include <osl/process.h>
-#include <tools/urlobj.hxx>
-#include <unotools/localfilehelper.hxx>
-#include <svtools/syslocale.hxx>
-
-namespace svt
-{
- namespace
- {
- // ----------------------------------------------------------------
- /** retrieves the value of an environment variable
- @return <TRUE/> if and only if the retrieved string value is not empty
- */
- bool lcl_getEnvironmentValue( const sal_Char* _pAsciiEnvName, ::rtl::OUString& _rValue )
- {
- _rValue = ::rtl::OUString();
- ::rtl::OUString sEnvName = ::rtl::OUString::createFromAscii( _pAsciiEnvName );
- osl_getEnvironment( sEnvName.pData, &_rValue.pData );
- return _rValue.getLength() != 0;
- }
-
- //-----------------------------------------------------------------
- void lcl_convertStringListToUrls( const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash )
- {
- const sal_Unicode s_cSeparator =
- #if defined(WNT)
- ';'
- #else
- ':'
- #endif
- ;
- xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator );
- _rTokens.resize( 0 ); _rTokens.reserve( nTokens );
- for ( xub_StrLen i=0; i<nTokens; ++i )
- {
- // the current token in the list
- String sCurrentToken = _rColonSeparatedList.GetToken( i, s_cSeparator );
- if ( !sCurrentToken.Len() )
- continue;
-
- INetURLObject aCurrentURL;
-
- String sURL;
- if ( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sCurrentToken, sURL ) )
- aCurrentURL = INetURLObject( sURL );
- else
- {
- // smart URL parsing, assuming FILE protocol
- aCurrentURL = INetURLObject( sCurrentToken, INET_PROT_FILE );
- }
-
- if ( _bFinalSlash )
- aCurrentURL.setFinalSlash( );
- else
- aCurrentURL.removeFinalSlash( );
- _rTokens.push_back( aCurrentURL.GetMainURL( INetURLObject::NO_DECODE ) );
- }
- }
-
- }
-
- //=====================================================================
- //= CheckURLAllowed
- //=====================================================================
- struct CheckURLAllowed
- {
- protected:
- #ifdef WNT
- SvtSysLocale m_aSysLocale;
- #endif
- String m_sCheckURL; // the URL to check
- bool m_bAllowParent;
- public:
- inline CheckURLAllowed( const String& _rCheckURL, bool bAllowParent = true )
- :m_sCheckURL( _rCheckURL ), m_bAllowParent( bAllowParent )
- {
- #ifdef WNT
- // on windows, assume that the relevant file systems are case insensitive,
- // thus normalize the URL
- m_sCheckURL = m_aSysLocale.GetCharClass().toLower( m_sCheckURL, 0, m_sCheckURL.Len() );
- #endif
- }
-
- bool operator()( const String& _rApprovedURL )
- {
- #ifdef WNT
- // on windows, assume that the relevant file systems are case insensitive,
- // thus normalize the URL
- String sApprovedURL( m_aSysLocale.GetCharClass().toLower( _rApprovedURL, 0, _rApprovedURL.Len() ) );
- #else
- String sApprovedURL( _rApprovedURL );
- #endif
-
- xub_StrLen nLenApproved = sApprovedURL.Len();
- xub_StrLen nLenChecked = m_sCheckURL.Len();
-
- if ( nLenApproved > nLenChecked )
- {
- if ( m_bAllowParent )
- {
- if ( sApprovedURL.Search( m_sCheckURL ) == 0 )
- {
- if ( ( m_sCheckURL.GetChar( nLenChecked - 1 ) == '/' )
- || ( sApprovedURL.GetChar( nLenChecked ) == '/' ) )
- return true;
- }
- }
- else
- {
- // just a difference in final slash?
- if ( ( nLenApproved == ( nLenChecked + 1 ) ) &&
- ( sApprovedURL.GetChar( nLenApproved - 1 ) == '/' ) )
- return true;
- }
- return false;
- }
- else if ( nLenApproved < nLenChecked )
- {
- if ( m_sCheckURL.Search( sApprovedURL ) == 0 )
- {
- if ( ( sApprovedURL.GetChar( nLenApproved - 1 ) == '/' )
- || ( m_sCheckURL.GetChar( nLenApproved ) == '/' ) )
- return true;
- }
- return false;
- }
- else
- {
- // strings have equal length
- return ( sApprovedURL == m_sCheckURL );
- }
- }
- };
-
- //=====================================================================
- //= RestrictedPaths
- //=====================================================================
- //---------------------------------------------------------------------
- RestrictedPaths::RestrictedPaths()
- :m_bFilterIsEnabled( true )
- {
- ::rtl::OUString sRestrictedPathList;
- if ( lcl_getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) )
- // append a final slash. This ensures that when we later on check
- // for unrestricted paths, we don't allow paths like "/home/user35" just because
- // "/home/user3" is allowed - with the final slash, we make it "/home/user3/".
- lcl_convertStringListToUrls( sRestrictedPathList, m_aUnrestrictedURLs, true );
- }
-
- RestrictedPaths::~RestrictedPaths() {}
-
- // --------------------------------------------------------------------
- bool RestrictedPaths::isUrlAllowed( const String& _rURL ) const
- {
- if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled )
- return true;
-
- ::std::vector< String >::const_iterator aApprovedURL = ::std::find_if(
- m_aUnrestrictedURLs.begin(),
- m_aUnrestrictedURLs.end(),
- CheckURLAllowed( _rURL, true )
- );
-
- return ( aApprovedURL != m_aUnrestrictedURLs.end() );
- }
-
- // --------------------------------------------------------------------
- bool RestrictedPaths::isUrlAllowed( const String& _rURL, bool allowParents ) const
- {
- if ( m_aUnrestrictedURLs.empty() || !m_bFilterIsEnabled )
- return true;
-
- ::std::vector< String >::const_iterator aApprovedURL = ::std::find_if(
- m_aUnrestrictedURLs.begin(),
- m_aUnrestrictedURLs.end(),
- CheckURLAllowed( _rURL, allowParents )
- );
-
- return ( aApprovedURL != m_aUnrestrictedURLs.end() );
- }
-
-} // namespace svt
diff --git a/svtools/source/misc/sharecontrolfile.cxx b/svtools/source/misc/sharecontrolfile.cxx
deleted file mode 100644
index dbea89f54bcc..000000000000
--- a/svtools/source/misc/sharecontrolfile.cxx
+++ /dev/null
@@ -1,376 +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: sharecontrolfile.cxx,v $
- * $Revision: 1.6.82.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <stdio.h>
-
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/ucb/XCommandEnvironment.hpp>
-#include <com/sun/star/ucb/XContent.hpp>
-#include <com/sun/star/ucb/InsertCommandArgument.hpp>
-#include <com/sun/star/ucb/InteractiveIOException.hpp>
-#include <com/sun/star/io/WrongFormatException.hpp>
-
-#include <osl/time.h>
-#include <osl/security.hxx>
-#include <osl/socket.hxx>
-
-#include <rtl/string.hxx>
-#include <rtl/ustring.hxx>
-#include <rtl/strbuf.hxx>
-#include <rtl/ustrbuf.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <ucbhelper/content.hxx>
-
-#include <tools/urlobj.hxx>
-#include <tools/stream.hxx>
-#include <unotools/bootstrap.hxx>
-#include <unotools/streamwrap.hxx>
-
-#include <svtools/useroptions.hxx>
-
-#include <svtools/sharecontrolfile.hxx>
-
-using namespace ::com::sun::star;
-
-namespace svt {
-
-// ----------------------------------------------------------------------
-ShareControlFile::ShareControlFile( const ::rtl::OUString& aOrigURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-: LockFileCommon( aOrigURL, xFactory, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".~sharing." ) ) )
-{
- OpenStream();
-
- if ( !IsValid() )
- throw io::NotConnectedException();
-}
-
-// ----------------------------------------------------------------------
-ShareControlFile::~ShareControlFile()
-{
- try
- {
- Close();
- }
- catch( uno::Exception& )
- {}
-}
-
-// ----------------------------------------------------------------------
-void ShareControlFile::OpenStream()
-{
- // if it is called outside of constructor the mutex must be locked already
-
- if ( !m_xStream.is() && m_aURL.getLength() )
- {
- uno::Reference< ucb::XCommandEnvironment > xDummyEnv;
- ::ucbhelper::Content aContent = ::ucbhelper::Content( m_aURL, xDummyEnv );
-
- uno::Reference< ucb::XContentIdentifier > xContId( aContent.get().is() ? aContent.get()->getIdentifier() : 0 );
- if ( !xContId.is() || !xContId->getContentProviderScheme().equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "file" ) ) ) )
- throw io::IOException(); // the implementation supports only local files for now
-
- uno::Reference< io::XStream > xStream;
-
- // Currently the locking of the original document is intended to be used.
- // That means that the shared file should be accessed only when the original document is locked and only by user who has locked the document.
- // TODO/LATER: should the own file locking be used?
-
- try
- {
- xStream = aContent.openWriteableStreamNoLock();
- }
- catch ( ucb::InteractiveIOException const & e )
- {
- if ( e.Code == ucb::IOErrorCode_NOT_EXISTING )
- {
- // Create file...
- SvMemoryStream aStream(0,0);
- uno::Reference< io::XInputStream > xInput( new ::utl::OInputStreamWrapper( aStream ) );
- ucb::InsertCommandArgument aInsertArg;
- aInsertArg.Data = xInput;
- aInsertArg.ReplaceExisting = sal_False;
- aContent.executeCommand( rtl::OUString::createFromAscii( "insert" ), uno::makeAny( aInsertArg ) );
-
- // try to let the file be hidden if possible
- try {
- aContent.setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsHidden" ) ), uno::makeAny( sal_True ) );
- } catch( uno::Exception& ) {}
-
- // Try to open one more time
- xStream = aContent.openWriteableStreamNoLock();
- }
- else
- throw;
- }
-
- m_xSeekable.set( xStream, uno::UNO_QUERY_THROW );
- m_xInputStream.set( xStream->getInputStream(), uno::UNO_QUERY_THROW );
- m_xOutputStream.set( xStream->getOutputStream(), uno::UNO_QUERY_THROW );
- m_xTruncate.set( m_xOutputStream, uno::UNO_QUERY_THROW );
- m_xStream = xStream;
- }
-}
-
-// ----------------------------------------------------------------------
-void ShareControlFile::Close()
-{
- // if it is called outside of destructor the mutex must be locked
-
- if ( m_xStream.is() )
- {
- try
- {
- if ( m_xInputStream.is() )
- m_xInputStream->closeInput();
- if ( m_xOutputStream.is() )
- m_xOutputStream->closeOutput();
- }
- catch( uno::Exception& )
- {}
-
- m_xStream = uno::Reference< io::XStream >();
- m_xInputStream = uno::Reference< io::XInputStream >();
- m_xOutputStream = uno::Reference< io::XOutputStream >();
- m_xSeekable = uno::Reference< io::XSeekable >();
- m_xTruncate = uno::Reference< io::XTruncate >();
- m_aUsersData.realloc( 0 );
- }
-}
-
-// ----------------------------------------------------------------------
-uno::Sequence< uno::Sequence< ::rtl::OUString > > ShareControlFile::GetUsersData()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !IsValid() )
- throw io::NotConnectedException();
-
- if ( !m_aUsersData.getLength() )
- {
- sal_Int64 nLength = m_xSeekable->getLength();
- if ( nLength > SAL_MAX_INT32 )
- throw uno::RuntimeException();
-
- uno::Sequence< sal_Int8 > aBuffer( (sal_Int32)nLength );
- m_xSeekable->seek( 0 );
-
- sal_Int32 nRead = m_xInputStream->readBytes( aBuffer, (sal_Int32)nLength );
- nLength -= nRead;
- while ( nLength > 0 )
- {
- uno::Sequence< sal_Int8 > aTmpBuf( (sal_Int32)nLength );
- nRead = m_xInputStream->readBytes( aTmpBuf, (sal_Int32)nLength );
- if ( nRead > nLength )
- throw uno::RuntimeException();
-
- for ( sal_Int32 nInd = 0; nInd < nRead; nInd++ )
- aBuffer[aBuffer.getLength() - (sal_Int32)nLength + nInd] = aTmpBuf[nInd];
- nLength -= nRead;
- }
-
- m_aUsersData = ParseList( aBuffer );
- }
-
- return m_aUsersData;
-}
-
-// ----------------------------------------------------------------------
-void ShareControlFile::SetUsersDataAndStore( const uno::Sequence< uno::Sequence< ::rtl::OUString > >& aUsersData )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !IsValid() )
- throw io::NotConnectedException();
-
- if ( !m_xTruncate.is() || !m_xOutputStream.is() || !m_xSeekable.is() )
- throw uno::RuntimeException();
-
- m_xTruncate->truncate();
- m_xSeekable->seek( 0 );
-
- ::rtl::OUStringBuffer aBuffer;
- for ( sal_Int32 nInd = 0; nInd < aUsersData.getLength(); nInd++ )
- {
- if ( aUsersData[nInd].getLength() != SHARED_ENTRYSIZE )
- throw lang::IllegalArgumentException();
-
- for ( sal_Int32 nEntryInd = 0; nEntryInd < SHARED_ENTRYSIZE; nEntryInd++ )
- {
- aBuffer.append( EscapeCharacters( aUsersData[nInd][nEntryInd] ) );
- if ( nEntryInd < SHARED_ENTRYSIZE - 1 )
- aBuffer.append( (sal_Unicode)',' );
- else
- aBuffer.append( (sal_Unicode)';' );
- }
- }
-
- ::rtl::OString aStringData( ::rtl::OUStringToOString( aBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 ) );
- uno::Sequence< sal_Int8 > aData( (sal_Int8*)aStringData.getStr(), aStringData.getLength() );
- m_xOutputStream->writeBytes( aData );
- m_aUsersData = aUsersData;
-}
-
-// ----------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > ShareControlFile::InsertOwnEntry()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !IsValid() )
- throw io::NotConnectedException();
-
- GetUsersData();
- uno::Sequence< ::uno::Sequence< ::rtl::OUString > > aNewData( m_aUsersData.getLength() + 1 );
- uno::Sequence< ::rtl::OUString > aNewEntry = GenerateOwnEntry();
-
- sal_Bool bExists = sal_False;
- sal_Int32 nNewInd = 0;
- for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); nInd++ )
- {
- if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE )
- {
- if ( m_aUsersData[nInd][SHARED_LOCALHOST_ID] == aNewEntry[SHARED_LOCALHOST_ID]
- && m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] == aNewEntry[SHARED_SYSUSERNAME_ID]
- && m_aUsersData[nInd][SHARED_USERURL_ID] == aNewEntry[SHARED_USERURL_ID] )
- {
- if ( !bExists )
- {
- aNewData[nNewInd] = aNewEntry;
- bExists = sal_True;
- }
- }
- else
- {
- aNewData[nNewInd] = m_aUsersData[nInd];
- }
-
- nNewInd++;
- }
- }
-
- if ( !bExists )
- aNewData[nNewInd++] = aNewEntry;
-
- aNewData.realloc( nNewInd );
- SetUsersDataAndStore( aNewData );
-
- return aNewEntry;
-}
-
-// ----------------------------------------------------------------------
-bool ShareControlFile::HasOwnEntry()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !IsValid() )
- {
- throw io::NotConnectedException();
- }
-
- GetUsersData();
- uno::Sequence< ::rtl::OUString > aEntry = GenerateOwnEntry();
-
- for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); ++nInd )
- {
- if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE &&
- m_aUsersData[nInd][SHARED_LOCALHOST_ID] == aEntry[SHARED_LOCALHOST_ID] &&
- m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] == aEntry[SHARED_SYSUSERNAME_ID] &&
- m_aUsersData[nInd][SHARED_USERURL_ID] == aEntry[SHARED_USERURL_ID] )
- {
- return true;
- }
- }
-
- return false;
-}
-
-// ----------------------------------------------------------------------
-void ShareControlFile::RemoveEntry( const uno::Sequence< ::rtl::OUString >& aArgEntry )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !IsValid() )
- throw io::NotConnectedException();
-
- GetUsersData();
-
- uno::Sequence< ::rtl::OUString > aEntry = aArgEntry;
- if ( aEntry.getLength() != SHARED_ENTRYSIZE )
- aEntry = GenerateOwnEntry();
-
- uno::Sequence< ::uno::Sequence< ::rtl::OUString > > aNewData( m_aUsersData.getLength() + 1 );
-
- sal_Int32 nNewInd = 0;
- for ( sal_Int32 nInd = 0; nInd < m_aUsersData.getLength(); nInd++ )
- {
- if ( m_aUsersData[nInd].getLength() == SHARED_ENTRYSIZE )
- {
- if ( m_aUsersData[nInd][SHARED_LOCALHOST_ID] != aEntry[SHARED_LOCALHOST_ID]
- || m_aUsersData[nInd][SHARED_SYSUSERNAME_ID] != aEntry[SHARED_SYSUSERNAME_ID]
- || m_aUsersData[nInd][SHARED_USERURL_ID] != aEntry[SHARED_USERURL_ID] )
- {
- aNewData[nNewInd] = m_aUsersData[nInd];
- nNewInd++;
- }
- }
- }
-
- aNewData.realloc( nNewInd );
- SetUsersDataAndStore( aNewData );
-
- if ( !nNewInd )
- {
- // try to remove the file if it is empty
- RemoveFile();
- }
-}
-
-// ----------------------------------------------------------------------
-void ShareControlFile::RemoveFile()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !IsValid() )
- throw io::NotConnectedException();
-
- Close();
-
- uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xSimpleFileAccess(
- xFactory->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.ucb.SimpleFileAccess") ),
- uno::UNO_QUERY_THROW );
- xSimpleFileAccess->kill( m_aURL );
-}
-
-} // namespace svt
-
diff --git a/svtools/source/misc/svtaccessiblefactory.cxx b/svtools/source/misc/svtaccessiblefactory.cxx
index b2d57c250d32..a4b3cc1e8ecc 100644
--- a/svtools/source/misc/svtaccessiblefactory.cxx
+++ b/svtools/source/misc/svtaccessiblefactory.cxx
@@ -107,6 +107,15 @@ namespace svt
return NULL;
}
+ virtual table::IAccessibleTableControl*
+ createAccessibleTableControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& /*_rxParent*/,
+ table::IAccessibleTable& /*_rTable*/
+ ) const
+ {
+ return NULL;
+ }
+
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
createAccessibleIconChoiceCtrl(
SvtIconChoiceCtrl& /*_rIconCtrl*/,
diff --git a/svtools/source/misc1/svtdata.cxx b/svtools/source/misc/svtdata.cxx
index 51247a628c0e..2bc1977e9197 100644
--- a/svtools/source/misc1/svtdata.cxx
+++ b/svtools/source/misc/svtdata.cxx
@@ -36,17 +36,7 @@
#include <tools/shl.hxx>
#include <vos/process.hxx>
#include <svtools/svtdata.hxx>
-
-namespace unnamed_svtools_svtdata {}
-using namespace unnamed_svtools_svtdata;
- // unnamed namespaces don't work well yet
-
-//============================================================================
-namespace unnamed_svtools_svtdata {
-
-typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap;
-
-}
+#include <vcl/svapp.hxx>
//============================================================================
//
@@ -57,11 +47,6 @@ typedef std::map< rtl::OUString, SimpleResMgr * > SimpleResMgrMap;
ImpSvtData::~ImpSvtData()
{
delete pResMgr;
- for (SimpleResMgrMap::iterator t
- = static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->begin();
- t != static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs)->end(); ++t)
- delete t->second;
- delete static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs);
}
//============================================================================
@@ -74,22 +59,9 @@ ResMgr * ImpSvtData::GetResMgr(const ::com::sun::star::lang::Locale aLocale)
return pResMgr;
}
-//============================================================================
-SimpleResMgr* ImpSvtData::GetSimpleRM(const ::com::sun::star::lang::Locale& rLocale)
+ResMgr * ImpSvtData::GetResMgr()
{
- if (!m_pThreadsafeRMs)
- m_pThreadsafeRMs = new SimpleResMgrMap;
- rtl::OUString aISOcode = rLocale.Language;
- aISOcode += rtl::OStringToOUString("-", RTL_TEXTENCODING_UTF8);
- aISOcode += rLocale.Country;
-
- SimpleResMgr *& rResMgr
- = (*static_cast< SimpleResMgrMap * >(m_pThreadsafeRMs))[aISOcode];
- if (!rResMgr)
- {
- rResMgr = new SimpleResMgr(CREATEVERSIONRESMGR_NAME(svs), rLocale );
- }
- return rResMgr;
+ return GetResMgr(Application::GetSettings().GetUILocale());
}
ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocale)
@@ -101,6 +73,16 @@ ResMgr * ImpSvtData::GetPatchResMgr(const ::com::sun::star::lang::Locale& aLocal
return pPatchResMgr;
}
+ResMgr * ImpSvtData::GetPatchResMgr()
+{
+ return GetPatchResMgr(Application::GetSettings().GetUILocale());
+}
+
+SvpResId::SvpResId( USHORT nId ) :
+ ResId( nId, *ImpSvtData::GetSvtData().GetPatchResMgr() )
+{
+}
+
//============================================================================
// static
ImpSvtData & ImpSvtData::GetSvtData()
diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx
index 93ed9a7f5c90..348a9638399b 100644
--- a/svtools/source/misc/templatefoldercache.cxx
+++ b/svtools/source/misc/templatefoldercache.cxx
@@ -45,7 +45,7 @@
#include <vos/refernce.hxx>
#include <tools/urlobj.hxx>
#include <tools/debug.hxx>
-#include <svtools/pathoptions.hxx>
+#include <unotools/pathoptions.hxx>
#include "comphelper/processfactory.hxx"
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 0bcd00af40aa..4a814637e1af 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -76,7 +76,7 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
-#include "urlbmk.hxx"
+#include "svl/urlbmk.hxx"
#include "inetimg.hxx"
#include <svtools/wmf.hxx>
#include <svtools/imap.hxx>
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
index 8dcbbf9d93dc..027dbc31572d 100644
--- a/svtools/source/misc/transfer2.cxx
+++ b/svtools/source/misc/transfer2.cxx
@@ -50,7 +50,7 @@
#include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp>
#endif
-#include "urlbmk.hxx"
+#include "svl/urlbmk.hxx"
#include "inetimg.hxx"
#include <svtools/imap.hxx>
#include <svtools/transfer.hxx>
diff --git a/svtools/source/misc/urihelper.cxx b/svtools/source/misc/urihelper.cxx
deleted file mode 100644
index 1ddb4c6dd6f9..000000000000
--- a/svtools/source/misc/urihelper.cxx
+++ /dev/null
@@ -1,952 +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: urihelper.cxx,v $
- * $Revision: 1.22.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <urihelper.hxx>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
-#include "com/sun/star/ucb/Command.hpp"
-#include <com/sun/star/ucb/FileSystemNotation.hpp>
-#include "com/sun/star/ucb/IllegalIdentifierException.hpp"
-#include "com/sun/star/ucb/UnsupportedCommandException.hpp"
-#include "com/sun/star/ucb/XCommandEnvironment.hpp"
-#include "com/sun/star/ucb/XCommandProcessor.hpp"
-#include "com/sun/star/ucb/XContent.hpp"
-#include "com/sun/star/ucb/XContentIdentifierFactory.hpp"
-#include "com/sun/star/ucb/XContentProvider.hpp"
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
-#include "com/sun/star/uno/Any.hxx"
-#include "com/sun/star/uno/Exception.hpp"
-#include "com/sun/star/uno/Reference.hxx"
-#include "com/sun/star/uno/RuntimeException.hpp"
-#include "com/sun/star/uno/Sequence.hxx"
-#include "com/sun/star/uno/XComponentContext.hpp"
-#include "com/sun/star/uno/XInterface.hpp"
-#include "com/sun/star/uri/UriReferenceFactory.hpp"
-#include "com/sun/star/uri/XUriReference.hpp"
-#include "com/sun/star/uri/XUriReferenceFactory.hpp"
-#include "cppuhelper/exc_hlp.hxx"
-#include "comphelper/processfactory.hxx"
-#include "osl/diagnose.h"
-#include "rtl/ustrbuf.hxx"
-#include "rtl/ustring.h"
-#include "rtl/ustring.hxx"
-#include "sal/types.h"
-#include <tools/debug.hxx>
-#include <tools/inetmime.hxx>
-#include <ucbhelper/contentbroker.hxx>
-#include <unotools/charclass.hxx>
-#include "rtl/instance.hxx"
-
-namespace unnamed_svtools_urihelper {}
-using namespace unnamed_svtools_urihelper;
- // unnamed namespaces don't work well yet...
-
-namespace css = com::sun::star;
-using namespace com::sun::star;
-
-//============================================================================
-//
-// SmartRel2Abs
-//
-//============================================================================
-
-namespace unnamed_svtools_urihelper {
-
-inline UniString toUniString(ByteString const & rString)
-{
- return UniString(rString, RTL_TEXTENCODING_ISO_8859_1);
-}
-
-inline UniString toUniString(UniString const & rString)
-{
- return rString;
-}
-
-template< typename Str >
-inline UniString SmartRel2Abs_Impl(INetURLObject const & rTheBaseURIRef,
- Str const & rTheRelURIRef,
- Link const & rMaybeFileHdl,
- bool bCheckFileExists,
- bool bIgnoreFragment,
- INetURLObject::EncodeMechanism
- eEncodeMechanism,
- INetURLObject::DecodeMechanism
- eDecodeMechanism,
- rtl_TextEncoding eCharset,
- bool bRelativeNonURIs,
- INetURLObject::FSysStyle eStyle)
-{
- // Backwards compatibility:
- if (rTheRelURIRef.Len() != 0 && rTheRelURIRef.GetChar(0) == '#')
- return toUniString(rTheRelURIRef);
-
- INetURLObject aAbsURIRef;
- if (rTheBaseURIRef.HasError())
- aAbsURIRef.
- SetSmartURL(rTheRelURIRef, eEncodeMechanism, eCharset, eStyle);
- else
- {
- bool bWasAbsolute;
- aAbsURIRef = rTheBaseURIRef.smartRel2Abs(rTheRelURIRef,
- bWasAbsolute,
- bIgnoreFragment,
- eEncodeMechanism,
- eCharset,
- bRelativeNonURIs,
- eStyle);
- if (bCheckFileExists
- && !bWasAbsolute
- && (aAbsURIRef.GetProtocol() == INET_PROT_FILE
- || aAbsURIRef.GetProtocol() == INET_PROT_VND_SUN_STAR_WFS))
- {
- INetURLObject aNonFileURIRef;
- aNonFileURIRef.SetSmartURL(rTheRelURIRef,
- eEncodeMechanism,
- eCharset,
- eStyle);
- if (!aNonFileURIRef.HasError()
- && aNonFileURIRef.GetProtocol() != INET_PROT_FILE)
- {
- bool bMaybeFile = false;
- if (rMaybeFileHdl.IsSet())
- {
- UniString aFilePath(toUniString(rTheRelURIRef));
- bMaybeFile = rMaybeFileHdl.Call(&aFilePath) != 0;
- }
- if (!bMaybeFile)
- aAbsURIRef = aNonFileURIRef;
- }
- }
- }
- return aAbsURIRef.GetMainURL(eDecodeMechanism, eCharset);
-}
-
-}
-
-UniString
-URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
- ByteString const & rTheRelURIRef,
- Link const & rMaybeFileHdl,
- bool bCheckFileExists,
- bool bIgnoreFragment,
- INetURLObject::EncodeMechanism eEncodeMechanism,
- INetURLObject::DecodeMechanism eDecodeMechanism,
- rtl_TextEncoding eCharset,
- bool bRelativeNonURIs,
- INetURLObject::FSysStyle eStyle)
-{
- return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl,
- bCheckFileExists, bIgnoreFragment,
- eEncodeMechanism, eDecodeMechanism, eCharset,
- bRelativeNonURIs, eStyle);
-}
-
-UniString
-URIHelper::SmartRel2Abs(INetURLObject const & rTheBaseURIRef,
- UniString const & rTheRelURIRef,
- Link const & rMaybeFileHdl,
- bool bCheckFileExists,
- bool bIgnoreFragment,
- INetURLObject::EncodeMechanism eEncodeMechanism,
- INetURLObject::DecodeMechanism eDecodeMechanism,
- rtl_TextEncoding eCharset,
- bool bRelativeNonURIs,
- INetURLObject::FSysStyle eStyle)
-{
- return SmartRel2Abs_Impl(rTheBaseURIRef, rTheRelURIRef, rMaybeFileHdl,
- bCheckFileExists, bIgnoreFragment,
- eEncodeMechanism, eDecodeMechanism, eCharset,
- bRelativeNonURIs, eStyle);
-}
-
-//============================================================================
-//
-// SetMaybeFileHdl
-//
-//============================================================================
-
-namespace { struct MaybeFileHdl : public rtl::Static< Link, MaybeFileHdl > {}; }
-
-void URIHelper::SetMaybeFileHdl(Link const & rTheMaybeFileHdl)
-{
- MaybeFileHdl::get() = rTheMaybeFileHdl;
-}
-
-//============================================================================
-//
-// GetMaybeFileHdl
-//
-//============================================================================
-
-Link URIHelper::GetMaybeFileHdl()
-{
- return MaybeFileHdl::get();
-}
-
-namespace {
-
-bool isAbsoluteHierarchicalUriReference(
- css::uno::Reference< css::uri::XUriReference > const & uriReference)
-{
- return uriReference.is() && uriReference->isAbsolute()
- && uriReference->isHierarchical() && !uriReference->hasRelativePath();
-}
-
-// To improve performance, assume that if for any prefix URL of a given
-// hierarchical URL either a UCB content cannot be created, or the UCB content
-// does not support the getCasePreservingURL command, then this will hold for
-// any other prefix URL of the given URL, too:
-enum Result { Success, GeneralFailure, SpecificFailure };
-
-Result normalizePrefix(
- css::uno::Reference< css::ucb::XContentProvider > const & broker,
- rtl::OUString const & uri, rtl::OUString * normalized)
-{
- OSL_ASSERT(broker.is() && normalized != 0);
- css::uno::Reference< css::ucb::XContent > content;
- try {
- content = broker->queryContent(
- css::uno::Reference< css::ucb::XContentIdentifierFactory >(
- broker, css::uno::UNO_QUERY_THROW)->createContentIdentifier(
- uri));
- } catch (css::ucb::IllegalIdentifierException &) {}
- if (!content.is()) {
- return GeneralFailure;
- }
- try {
- #if OSL_DEBUG_LEVEL > 0
- bool ok =
- #endif
- (css::uno::Reference< css::ucb::XCommandProcessor >(
- content, css::uno::UNO_QUERY_THROW)->execute(
- css::ucb::Command(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "getCasePreservingURL")),
- -1, css::uno::Any()),
- 0,
- css::uno::Reference< css::ucb::XCommandEnvironment >())
- >>= *normalized);
- OSL_ASSERT(ok);
- } catch (css::uno::RuntimeException &) {
- throw;
- } catch (css::ucb::UnsupportedCommandException &) {
- return GeneralFailure;
- } catch (css::uno::Exception &) {
- return SpecificFailure;
- }
- return Success;
-}
-
-rtl::OUString normalize(
- css::uno::Reference< css::ucb::XContentProvider > const & broker,
- css::uno::Reference< css::uri::XUriReferenceFactory > const & uriFactory,
- rtl::OUString const & uriReference)
-{
- // normalizePrefix can potentially fail (a typically example being a file
- // URL that denotes a non-existing resource); in such a case, try to
- // normalize as long a prefix of the given URL as possible (i.e., normalize
- // all the existing directories within the path):
- rtl::OUString normalized;
- sal_Int32 n = uriReference.indexOf('#');
- normalized = n == -1 ? uriReference : uriReference.copy(0, n);
- switch (normalizePrefix(broker, normalized, &normalized)) {
- case Success:
- return n == -1 ? normalized : normalized + uriReference.copy(n);
- case GeneralFailure:
- return uriReference;
- case SpecificFailure:
- default:
- break;
- }
- css::uno::Reference< css::uri::XUriReference > ref(
- uriFactory->parse(uriReference));
- if (!isAbsoluteHierarchicalUriReference(ref)) {
- return uriReference;
- }
- sal_Int32 count = ref->getPathSegmentCount();
- if (count < 2) {
- return uriReference;
- }
- rtl::OUStringBuffer head(ref->getScheme());
- head.append(static_cast< sal_Unicode >(':'));
- if (ref->hasAuthority()) {
- head.appendAscii(RTL_CONSTASCII_STRINGPARAM("//"));
- head.append(ref->getAuthority());
- }
- for (sal_Int32 i = count - 1; i > 0; --i) {
- rtl::OUStringBuffer buf(head);
- for (sal_Int32 j = 0; j < i; ++j) {
- buf.append(static_cast< sal_Unicode >('/'));
- buf.append(ref->getPathSegment(j));
- }
- normalized = buf.makeStringAndClear();
- if (normalizePrefix(broker, normalized, &normalized) != SpecificFailure)
- {
- buf.append(normalized);
- css::uno::Reference< css::uri::XUriReference > preRef(
- uriFactory->parse(normalized));
- if (!isAbsoluteHierarchicalUriReference(preRef)) {
- // This could only happen if something is inconsistent:
- break;
- }
- sal_Int32 preCount = preRef->getPathSegmentCount();
- // normalizePrefix may have added or removed a final slash:
- if (preCount != i) {
- if (preCount == i - 1) {
- buf.append(static_cast< sal_Unicode >('/'));
- } else if (preCount - 1 == i && buf.getLength() > 0
- && buf.charAt(buf.getLength() - 1) == '/')
- {
- buf.setLength(buf.getLength() - 1);
- } else {
- // This could only happen if something is inconsistent:
- break;
- }
- }
- for (sal_Int32 j = i; j < count; ++j) {
- buf.append(static_cast< sal_Unicode >('/'));
- buf.append(ref->getPathSegment(j));
- }
- if (ref->hasQuery()) {
- buf.append(static_cast< sal_Unicode >('?'));
- buf.append(ref->getQuery());
- }
- if (ref->hasFragment()) {
- buf.append(static_cast< sal_Unicode >('#'));
- buf.append(ref->getFragment());
- }
- return buf.makeStringAndClear();
- }
- }
- return uriReference;
-}
-
-}
-
-css::uno::Reference< css::uri::XUriReference >
-URIHelper::normalizedMakeRelative(
- css::uno::Reference< css::uno::XComponentContext > const & context,
- rtl::OUString const & baseUriReference, rtl::OUString const & uriReference)
-{
- OSL_ASSERT(context.is());
- css::uno::Reference< css::lang::XMultiComponentFactory > componentFactory(
- context->getServiceManager());
- if (!componentFactory.is()) {
- throw css::uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "component context has no service manager")),
- css::uno::Reference< css::uno::XInterface >());
- }
- css::uno::Sequence< css::uno::Any > args(2);
- args[0] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Local"));
- args[1] <<= rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office"));
- css::uno::Reference< css::ucb::XContentProvider > broker;
- try {
- broker = css::uno::Reference< css::ucb::XContentProvider >(
- componentFactory->createInstanceWithArgumentsAndContext(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.ucb.UniversalContentBroker")),
- args, context),
- css::uno::UNO_QUERY_THROW);
- } catch (css::uno::RuntimeException &) {
- throw;
- } catch (css::uno::Exception &) {
- css::uno::Any exception(cppu::getCaughtException());
- throw css::lang::WrappedTargetRuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "creating com.sun.star.ucb.UniversalContentBroker failed")),
- css::uno::Reference< css::uno::XInterface >(),
- exception);
- }
- css::uno::Reference< css::uri::XUriReferenceFactory > uriFactory(
- css::uri::UriReferenceFactory::create(context));
- return uriFactory->makeRelative(
- uriFactory->parse(normalize(broker, uriFactory, baseUriReference)),
- uriFactory->parse(normalize(broker, uriFactory, uriReference)), true,
- true, false);
-}
-
-rtl::OUString URIHelper::simpleNormalizedMakeRelative(
- rtl::OUString const & baseUriReference, rtl::OUString const & uriReference)
-{
- com::sun::star::uno::Reference< com::sun::star::uri::XUriReference > rel(
- URIHelper::normalizedMakeRelative(
- com::sun::star::uno::Reference<
- com::sun::star::uno::XComponentContext >(
- (com::sun::star::uno::Reference<
- com::sun::star::beans::XPropertySet >(
- comphelper::getProcessServiceFactory(),
- com::sun::star::uno::UNO_QUERY_THROW)->
- getPropertyValue(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("DefaultContext")))),
- com::sun::star::uno::UNO_QUERY_THROW),
- baseUriReference, uriReference));
- return rel.is() ? rel->getUriReference() : uriReference;
-}
-
-//============================================================================
-//
-// FindFirstURLInText
-//
-//============================================================================
-
-namespace unnamed_svtools_urihelper {
-
-inline xub_StrLen nextChar(UniString const & rStr, xub_StrLen nPos)
-{
- return INetMIME::isHighSurrogate(rStr.GetChar(nPos))
- && rStr.Len() - nPos >= 2
- && INetMIME::isLowSurrogate(rStr.GetChar(nPos + 1)) ?
- nPos + 2 : nPos + 1;
-}
-
-bool isBoundary1(CharClass const & rCharClass, UniString const & rStr,
- xub_StrLen nPos, xub_StrLen nEnd)
-{
- if (nPos == nEnd)
- return true;
- if (rCharClass.isLetterNumeric(rStr, nPos))
- return false;
- switch (rStr.GetChar(nPos))
- {
- case '$':
- case '%':
- case '&':
- case '-':
- case '/':
- case '@':
- case '\\':
- return false;
- default:
- return true;
- }
-}
-
-bool isBoundary2(CharClass const & rCharClass, UniString const & rStr,
- xub_StrLen nPos, xub_StrLen nEnd)
-{
- if (nPos == nEnd)
- return true;
- if (rCharClass.isLetterNumeric(rStr, nPos))
- return false;
- switch (rStr.GetChar(nPos))
- {
- case '!':
- case '#':
- case '$':
- case '%':
- case '&':
- case '\'':
- case '*':
- case '+':
- case '-':
- case '/':
- case '=':
- case '?':
- case '@':
- case '^':
- case '_':
- case '`':
- case '{':
- case '|':
- case '}':
- case '~':
- return false;
- default:
- return true;
- }
-}
-
-bool checkWChar(CharClass const & rCharClass, UniString const & rStr,
- xub_StrLen * pPos, xub_StrLen * pEnd, bool bBackslash = false,
- bool bPipe = false)
-{
- sal_Unicode c = rStr.GetChar(*pPos);
- if (INetMIME::isUSASCII(c))
- {
- static sal_uInt8 const aMap[128]
- = { 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 4, 4, 4, 1, // !"#$%&'
- 1, 1, 1, 1, 1, 4, 1, 4, // ()*+,-./
- 4, 4, 4, 4, 4, 4, 4, 4, // 01234567
- 4, 4, 1, 1, 0, 1, 0, 1, // 89:;<=>?
- 4, 4, 4, 4, 4, 4, 4, 4, // @ABCDEFG
- 4, 4, 4, 4, 4, 4, 4, 4, // HIJKLMNO
- 4, 4, 4, 4, 4, 4, 4, 4, // PQRSTUVW
- 4, 4, 4, 1, 2, 1, 0, 1, // XYZ[\]^_
- 0, 4, 4, 4, 4, 4, 4, 4, // `abcdefg
- 4, 4, 4, 4, 4, 4, 4, 4, // hijklmno
- 4, 4, 4, 4, 4, 4, 4, 4, // pqrstuvw
- 4, 4, 4, 0, 3, 0, 1, 0 }; // xyz{|}~
- switch (aMap[c])
- {
- default: // not uric
- return false;
-
- case 1: // uric
- ++(*pPos);
- return true;
-
- case 2: // "\"
- if (bBackslash)
- {
- *pEnd = ++(*pPos);
- return true;
- }
- else
- return false;
-
- case 3: // "|"
- if (bPipe)
- {
- *pEnd = ++(*pPos);
- return true;
- }
- else
- return false;
-
- case 4: // alpha, digit, "$", "%", "&", "-", "/", "@" (see
- // isBoundary1)
- *pEnd = ++(*pPos);
- return true;
- }
- }
- else if (rCharClass.isLetterNumeric(rStr, *pPos))
- {
- *pEnd = *pPos = nextChar(rStr, *pPos);
- return true;
- }
- else
- return false;
-}
-
-sal_uInt32 scanDomain(UniString const & rStr, xub_StrLen * pPos,
- xub_StrLen nEnd)
-{
- sal_Unicode const * pBuffer = rStr.GetBuffer();
- sal_Unicode const * p = pBuffer + *pPos;
- sal_uInt32 nLabels = INetURLObject::scanDomain(p, pBuffer + nEnd, false);
- *pPos = sal::static_int_cast< xub_StrLen >(p - pBuffer);
- return nLabels;
-}
-
-}
-
-UniString
-URIHelper::FindFirstURLInText(UniString const & rText,
- xub_StrLen & rBegin,
- xub_StrLen & rEnd,
- CharClass const & rCharClass,
- INetURLObject::EncodeMechanism eMechanism,
- rtl_TextEncoding eCharset,
- INetURLObject::FSysStyle eStyle)
-{
- if (!(rBegin <= rEnd && rEnd <= rText.Len()))
- return UniString();
-
- // Search for the first substring of [rBegin..rEnd[ that matches any of the
- // following productions (for which the appropriate style bit is set in
- // eStyle, if applicable).
- //
- // 1st Production (known scheme):
- // \B1 <one of the known schemes, except file> ":" 1*wchar ["#" 1*wchar]
- // \B1
- //
- // 2nd Production (file):
- // \B1 "FILE:" 1*(wchar / "\" / "|") ["#" 1*wchar] \B1
- //
- // 3rd Production (ftp):
- // \B1 "FTP" 2*("." label) ["/" *wchar] ["#" 1*wchar] \B1
- //
- // 4th Production (http):
- // \B1 "WWW" 2*("." label) ["/" *wchar] ["#" 1*wchar] \B1
- //
- // 5th Production (mailto):
- // \B2 local-part "@" domain \B1
- //
- // 6th Production (UNC file):
- // \B1 "\\" domain "\" *(wchar / "\") \B1
- //
- // 7th Production (DOS file):
- // \B1 ALPHA ":\" *(wchar / "\") \B1
- //
- // 8th Production (Unix-like DOS file):
- // \B1 ALPHA ":/" *(wchar / "\") \B1
- //
- // The productions use the following auxiliary rules.
- //
- // local-part = atom *("." atom)
- // atom = 1*(alphanum / "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+"
- // / "-" / "/" / "=" / "?" / "^" / "_" / "`" / "{" / "|" / "}"
- // / "~")
- // domain = label *("." label)
- // label = alphanum [*(alphanum / "-") alphanum]
- // alphanum = ALPHA / DIGIT
- // wchar = <any uric character (ignoring the escaped rule), or "%", or
- // a letter or digit (according to rCharClass)>
- //
- // "\B1" (boundary 1) stands for the beginning or end of the block of text,
- // or a character that is neither (a) a letter or digit (according to
- // rCharClass), nor (b) any of "$", "%", "&", "-", "/", "@", or "\".
- // (FIXME: What was the rationale for this set of punctuation characters?)
- //
- // "\B2" (boundary 2) stands for the beginning or end of the block of text,
- // or a character that is neither (a) a letter or digit (according to
- // rCharClass), nor (b) any of "!", "#", "$", "%", "&", "'", "*", "+", "-",
- // "/", "=", "?", "@", "^", "_", "`", "{", "|", "}", or "~" (i.e., an RFC
- // 822 <atom> character, or "@" from \B1's set above).
- //
- // Productions 1--4, and 6--8 try to find a maximum-length match, but they
- // stop at the first <wchar> character that is a "\B1" character which is
- // only followed by "\B1" characters (taking "\" and "|" characters into
- // account appropriately). Production 5 simply tries to find a maximum-
- // length match.
- //
- // Productions 1--4 use the given eMechanism and eCharset. Productions 5--9
- // use ENCODE_ALL.
- //
- // Productions 6--9 are only applicable if the FSYS_DOS bit is set in
- // eStyle.
-
- bool bBoundary1 = true;
- bool bBoundary2 = true;
- for (xub_StrLen nPos = rBegin; nPos != rEnd; nPos = nextChar(rText, nPos))
- {
- sal_Unicode c = rText.GetChar(nPos);
- if (bBoundary1)
- {
- if (INetMIME::isAlpha(c))
- {
- xub_StrLen i = nPos;
- INetProtocol eScheme
- = INetURLObject::CompareProtocolScheme(UniString(rText, i,
- rEnd));
- if (eScheme == INET_PROT_FILE) // 2nd
- {
- while (rText.GetChar(i++) != ':') ;
- xub_StrLen nPrefixEnd = i;
- xub_StrLen nUriEnd = i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd, true,
- true)) ;
- if (i != nPrefixEnd && rText.GetChar(i) == '#')
- {
- ++i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd)) ;
- }
- if (nUriEnd != nPrefixEnd
- && isBoundary1(rCharClass, rText, nUriEnd, rEnd))
- {
- INetURLObject aUri(UniString(rText, nPos,
- nUriEnd - nPos),
- INET_PROT_FILE, eMechanism, eCharset,
- eStyle);
- if (!aUri.HasError())
- {
- rBegin = nPos;
- rEnd = nUriEnd;
- return
- aUri.GetMainURL(INetURLObject::DECODE_TO_IURI);
- }
- }
- }
- else if (eScheme != INET_PROT_NOT_VALID) // 1st
- {
- while (rText.GetChar(i++) != ':') ;
- xub_StrLen nPrefixEnd = i;
- xub_StrLen nUriEnd = i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd)) ;
- if (i != nPrefixEnd && rText.GetChar(i) == '#')
- {
- ++i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd)) ;
- }
- if (nUriEnd != nPrefixEnd
- && (isBoundary1(rCharClass, rText, nUriEnd, rEnd)
- || rText.GetChar(nUriEnd) == '\\'))
- {
- INetURLObject aUri(UniString(rText, nPos,
- nUriEnd - nPos),
- INET_PROT_HTTP, eMechanism,
- eCharset);
- if (!aUri.HasError())
- {
- rBegin = nPos;
- rEnd = nUriEnd;
- return
- aUri.GetMainURL(INetURLObject::DECODE_TO_IURI);
- }
- }
- }
-
- // 3rd, 4th:
- i = nPos;
- sal_uInt32 nLabels = scanDomain(rText, &i, rEnd);
- if (nLabels >= 3
- && rText.GetChar(nPos + 3) == '.'
- && (((rText.GetChar(nPos) == 'w'
- || rText.GetChar(nPos) == 'W')
- && (rText.GetChar(nPos + 1) == 'w'
- || rText.GetChar(nPos + 1) == 'W')
- && (rText.GetChar(nPos + 2) == 'w'
- || rText.GetChar(nPos + 2) == 'W'))
- || ((rText.GetChar(nPos) == 'f'
- || rText.GetChar(nPos) == 'F')
- && (rText.GetChar(nPos + 1) == 't'
- || rText.GetChar(nPos + 1) == 'T')
- && (rText.GetChar(nPos + 2) == 'p'
- || rText.GetChar(nPos + 2) == 'P'))))
- // (note that rText.GetChar(nPos + 3) is guaranteed to be
- // valid)
- {
- xub_StrLen nUriEnd = i;
- if (i != rEnd && rText.GetChar(i) == '/')
- {
- nUriEnd = ++i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd)) ;
- }
- if (i != rEnd && rText.GetChar(i) == '#')
- {
- ++i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd)) ;
- }
- if (isBoundary1(rCharClass, rText, nUriEnd, rEnd)
- || rText.GetChar(nUriEnd) == '\\')
- {
- INetURLObject aUri(UniString(rText, nPos,
- nUriEnd - nPos),
- INET_PROT_HTTP, eMechanism,
- eCharset);
- if (!aUri.HasError())
- {
- rBegin = nPos;
- rEnd = nUriEnd;
- return
- aUri.GetMainURL(INetURLObject::DECODE_TO_IURI);
- }
- }
- }
-
- if ((eStyle & INetURLObject::FSYS_DOS) != 0 && rEnd - nPos >= 3
- && rText.GetChar(nPos + 1) == ':'
- && (rText.GetChar(nPos + 2) == '/'
- || rText.GetChar(nPos + 2) == '\\')) // 7th, 8th
- {
- i = nPos + 3;
- xub_StrLen nUriEnd = i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd)) ;
- if (isBoundary1(rCharClass, rText, nUriEnd, rEnd))
- {
- INetURLObject aUri(UniString(rText, nPos,
- nUriEnd - nPos),
- INET_PROT_FILE,
- INetURLObject::ENCODE_ALL,
- RTL_TEXTENCODING_UTF8,
- INetURLObject::FSYS_DOS);
- if (!aUri.HasError())
- {
- rBegin = nPos;
- rEnd = nUriEnd;
- return
- aUri.GetMainURL(INetURLObject::DECODE_TO_IURI);
- }
- }
- }
- }
- else if ((eStyle & INetURLObject::FSYS_DOS) != 0 && rEnd - nPos >= 2
- && rText.GetChar(nPos) == '\\'
- && rText.GetChar(nPos + 1) == '\\') // 6th
- {
- xub_StrLen i = nPos + 2;
- sal_uInt32 nLabels = scanDomain(rText, &i, rEnd);
- if (nLabels >= 1 && i != rEnd && rText.GetChar(i) == '\\')
- {
- xub_StrLen nUriEnd = ++i;
- while (i != rEnd
- && checkWChar(rCharClass, rText, &i, &nUriEnd,
- true)) ;
- if (isBoundary1(rCharClass, rText, nUriEnd, rEnd))
- {
- INetURLObject aUri(UniString(rText, nPos,
- nUriEnd - nPos),
- INET_PROT_FILE,
- INetURLObject::ENCODE_ALL,
- RTL_TEXTENCODING_UTF8,
- INetURLObject::FSYS_DOS);
- if (!aUri.HasError())
- {
- rBegin = nPos;
- rEnd = nUriEnd;
- return
- aUri.GetMainURL(INetURLObject::DECODE_TO_IURI);
- }
- }
- }
- }
- }
- if (bBoundary2 && INetMIME::isAtomChar(c)) // 5th
- {
- bool bDot = false;
- for (xub_StrLen i = nPos + 1; i != rEnd; ++i)
- {
- sal_Unicode c2 = rText.GetChar(i);
- if (INetMIME::isAtomChar(c2))
- bDot = false;
- else if (bDot)
- break;
- else if (c2 == '.')
- bDot = true;
- else
- {
- if (c2 == '@')
- {
- ++i;
- sal_uInt32 nLabels = scanDomain(rText, &i, rEnd);
- if (nLabels >= 1
- && isBoundary1(rCharClass, rText, i, rEnd))
- {
- INetURLObject aUri(UniString(rText, nPos, i - nPos),
- INET_PROT_MAILTO,
- INetURLObject::ENCODE_ALL);
- if (!aUri.HasError())
- {
- rBegin = nPos;
- rEnd = i;
- return aUri.GetMainURL(
- INetURLObject::DECODE_TO_IURI);
- }
- }
- }
- break;
- }
- }
- }
- bBoundary1 = isBoundary1(rCharClass, rText, nPos, rEnd);
- bBoundary2 = isBoundary2(rCharClass, rText, nPos, rEnd);
- }
- rBegin = rEnd;
- return UniString();
-}
-
-//============================================================================
-//
-// removePassword
-//
-//============================================================================
-
-UniString
-URIHelper::removePassword(UniString const & rURI,
- INetURLObject::EncodeMechanism eEncodeMechanism,
- INetURLObject::DecodeMechanism eDecodeMechanism,
- rtl_TextEncoding eCharset)
-{
- INetURLObject aObj(rURI, eEncodeMechanism, eCharset);
- return aObj.HasError() ?
- rURI :
- String(aObj.GetURLNoPass(eDecodeMechanism, eCharset));
-}
-
-//============================================================================
-//
-// queryFSysStyle
-//
-//============================================================================
-
-INetURLObject::FSysStyle URIHelper::queryFSysStyle(UniString const & rFileUrl,
- bool bAddConvenienceStyles)
- throw (uno::RuntimeException)
-{
- ::ucbhelper::ContentBroker const * pBroker = ::ucbhelper::ContentBroker::get();
- uno::Reference< ucb::XContentProviderManager > xManager;
- if (pBroker)
- xManager = pBroker->getContentProviderManagerInterface();
- uno::Reference< beans::XPropertySet > xProperties;
- if (xManager.is())
- xProperties
- = uno::Reference< beans::XPropertySet >(
- xManager->queryContentProvider(rFileUrl), uno::UNO_QUERY);
- sal_Int32 nNotation = ucb::FileSystemNotation::UNKNOWN_NOTATION;
- if (xProperties.is())
- try
- {
- xProperties->getPropertyValue(rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "FileSystemNotation")))
- >>= nNotation;
- }
- catch (beans::UnknownPropertyException const &) {}
- catch (lang::WrappedTargetException const &) {}
-
- // The following code depends on the fact that the
- // com::sun::star::ucb::FileSystemNotation constants range from UNKNOWN to
- // MAC, without any holes. The table below has two entries per notation,
- // the first is used if bAddConvenienceStyles == false, while the second
- // is used if bAddConvenienceStyles == true:
- static INetURLObject::FSysStyle const aMap[][2]
- = { { INetURLObject::FSysStyle(0),
- INetURLObject::FSYS_DETECT },
- // UNKNOWN
- { INetURLObject::FSYS_UNX,
- INetURLObject::FSysStyle(INetURLObject::FSYS_VOS
- | INetURLObject::FSYS_UNX) },
- // UNIX
- { INetURLObject::FSYS_DOS,
- INetURLObject::FSysStyle(INetURLObject::FSYS_VOS
- | INetURLObject::FSYS_UNX
- | INetURLObject::FSYS_DOS) },
- // DOS
- { INetURLObject::FSYS_MAC,
- INetURLObject::FSysStyle(INetURLObject::FSYS_VOS
- | INetURLObject::FSYS_UNX
- | INetURLObject::FSYS_MAC) } };
- return aMap[nNotation < ucb::FileSystemNotation::UNKNOWN_NOTATION
- || nNotation > ucb::FileSystemNotation::MAC_NOTATION ?
- 0 :
- nNotation
- - ucb::FileSystemNotation::UNKNOWN_NOTATION]
- [bAddConvenienceStyles];
-}
diff --git a/svtools/source/misc/vcldata.cxx b/svtools/source/misc/vcldata.cxx
deleted file mode 100644
index 28b2e833e974..000000000000
--- a/svtools/source/misc/vcldata.cxx
+++ /dev/null
@@ -1,57 +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: vcldata.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-#include <svtools/svtdata.hxx>
-
-//============================================================================
-//
-// class ImpSvtData
-//
-//============================================================================
-
-ResMgr * ImpSvtData::GetResMgr()
-{
- return GetResMgr(Application::GetSettings().GetUILocale());
-}
-
-ResMgr * ImpSvtData::GetPatchResMgr()
-{
- return GetPatchResMgr(Application::GetSettings().GetUILocale());
-}
-
-SvpResId::SvpResId( USHORT nId ) :
- ResId( nId, *ImpSvtData::GetSvtData().GetPatchResMgr() )
-{
-}
-
diff --git a/svtools/source/items/wallitem.cxx b/svtools/source/misc/wallitem.cxx
index 32797f69a48c..6ceb414db003 100644
--- a/svtools/source/items/wallitem.cxx
+++ b/svtools/source/misc/wallitem.cxx
@@ -52,7 +52,7 @@
#include <vcl/cvtgrf.hxx>
#include "wallitem.hxx"
-#include <svtools/cntwall.hxx>
+#include <svl/cntwall.hxx>
// -----------------------------------------------------------------------
diff --git a/svtools/source/misc1/PasswordHelper.cxx b/svtools/source/misc1/PasswordHelper.cxx
deleted file mode 100644
index 53c447bde830..000000000000
--- a/svtools/source/misc1/PasswordHelper.cxx
+++ /dev/null
@@ -1,109 +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: PasswordHelper.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-
-#ifndef GCC
-#endif
-#include "PasswordHelper.hxx"
-#include <rtl/digest.h>
-#include <tools/string.hxx>
-
-using namespace com::sun::star;
-
-void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const sal_Char* pPass, sal_uInt32 nLen)
-{
- rPassHash.realloc(RTL_DIGEST_LENGTH_SHA1);
-
- rtlDigestError aError = rtl_digest_SHA1 (pPass, nLen, reinterpret_cast<sal_uInt8*>(rPassHash.getArray()), rPassHash.getLength());
- if (aError != rtl_Digest_E_None)
- {
- rPassHash.realloc(0);
- }
-}
-
-void SvPasswordHelper::GetHashPasswordLittleEndian(uno::Sequence<sal_Int8>& rPassHash, const String& sPass)
-{
- xub_StrLen nSize(sPass.Len());
- sal_Char* pCharBuffer = new sal_Char[nSize * sizeof(sal_Unicode)];
-
- for (xub_StrLen i = 0; i < nSize; ++i)
- {
- sal_Unicode ch(sPass.GetChar(i));
- pCharBuffer[2 * i] = static_cast< sal_Char >(ch & 0xFF);
- pCharBuffer[2 * i + 1] = static_cast< sal_Char >(ch >> 8);
- }
-
- GetHashPassword(rPassHash, pCharBuffer, nSize * sizeof(sal_Unicode));
-
- delete[] pCharBuffer;
-}
-
-void SvPasswordHelper::GetHashPasswordBigEndian(uno::Sequence<sal_Int8>& rPassHash, const String& sPass)
-{
- xub_StrLen nSize(sPass.Len());
- sal_Char* pCharBuffer = new sal_Char[nSize * sizeof(sal_Unicode)];
-
- for (xub_StrLen i = 0; i < nSize; ++i)
- {
- sal_Unicode ch(sPass.GetChar(i));
- pCharBuffer[2 * i] = static_cast< sal_Char >(ch >> 8);
- pCharBuffer[2 * i + 1] = static_cast< sal_Char >(ch & 0xFF);
- }
-
- GetHashPassword(rPassHash, pCharBuffer, nSize * sizeof(sal_Unicode));
-
- delete[] pCharBuffer;
-}
-
-void SvPasswordHelper::GetHashPassword(uno::Sequence<sal_Int8>& rPassHash, const String& sPass)
-{
- GetHashPasswordLittleEndian(rPassHash, sPass);
-}
-
-bool SvPasswordHelper::CompareHashPassword(const uno::Sequence<sal_Int8>& rOldPassHash, const String& sNewPass)
-{
- bool bResult = false;
-
- uno::Sequence<sal_Int8> aNewPass(RTL_DIGEST_LENGTH_SHA1);
- GetHashPasswordLittleEndian(aNewPass, sNewPass);
- if (aNewPass == rOldPassHash)
- bResult = true;
- else
- {
- GetHashPasswordBigEndian(aNewPass, sNewPass);
- bResult = (aNewPass == rOldPassHash);
- }
-
- return bResult;
-}
-
diff --git a/svtools/source/misc1/adrparse.cxx b/svtools/source/misc1/adrparse.cxx
deleted file mode 100644
index 37c25d6c669f..000000000000
--- a/svtools/source/misc1/adrparse.cxx
+++ /dev/null
@@ -1,921 +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: adrparse.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <tools/inetmime.hxx>
-#include <adrparse.hxx>
-
-namespace unnamed_svtools_adrparse {}
-using namespace unnamed_svtools_adrparse;
- // unnamed namespaces don't work well yet
-
-//============================================================================
-namespace unnamed_svtools_adrparse {
-
-enum ElementType { ELEMENT_START, ELEMENT_DELIM, ELEMENT_ITEM, ELEMENT_END };
-
-//============================================================================
-struct ParsedAddrSpec
-{
- sal_Unicode const * m_pBegin;
- sal_Unicode const * m_pEnd;
- ElementType m_eLastElem;
- bool m_bAtFound;
- bool m_bReparse;
-
- ParsedAddrSpec() { reset(); }
-
- bool isPoorlyValid() const { return m_eLastElem >= ELEMENT_ITEM; }
-
- bool isValid() const { return isPoorlyValid() && m_bAtFound; }
-
- inline void reset();
-
- inline void finish();
-};
-
-inline void ParsedAddrSpec::reset()
-{
- m_pBegin = 0;
- m_pEnd = 0;
- m_eLastElem = ELEMENT_START;
- m_bAtFound = false;
- m_bReparse = false;
-}
-
-inline void ParsedAddrSpec::finish()
-{
- if (isPoorlyValid())
- m_eLastElem = ELEMENT_END;
- else
- reset();
-}
-
-}
-
-//============================================================================
-class SvAddressParser_Impl
-{
- enum State { BEFORE_COLON, BEFORE_LESS, AFTER_LESS, AFTER_GREATER };
-
- enum TokenType { TOKEN_QUOTED = 0x80000000, TOKEN_DOMAIN, TOKEN_COMMENT,
- TOKEN_ATOM };
-
- sal_Unicode const * m_pInputPos;
- sal_Unicode const * m_pInputEnd;
- sal_uInt32 m_nCurToken;
- sal_Unicode const * m_pCurTokenBegin;
- sal_Unicode const * m_pCurTokenEnd;
- sal_Unicode const * m_pCurTokenContentBegin;
- sal_Unicode const * m_pCurTokenContentEnd;
- bool m_bCurTokenReparse;
- ParsedAddrSpec m_aOuterAddrSpec;
- ParsedAddrSpec m_aInnerAddrSpec;
- ParsedAddrSpec * m_pAddrSpec;
- sal_Unicode const * m_pRealNameBegin;
- sal_Unicode const * m_pRealNameEnd;
- sal_Unicode const * m_pRealNameContentBegin;
- sal_Unicode const * m_pRealNameContentEnd;
- bool m_bRealNameReparse;
- bool m_bRealNameFinished;
- sal_Unicode const * m_pFirstCommentBegin;
- sal_Unicode const * m_pFirstCommentEnd;
- bool m_bFirstCommentReparse;
- State m_eState;
- TokenType m_eType;
-
- inline void resetRealNameAndFirstComment();
-
- inline void reset();
-
- inline void addTokenToAddrSpec(ElementType eTokenElem);
-
- inline void addTokenToRealName();
-
- bool readToken();
-
- static UniString reparse(sal_Unicode const * pBegin,
- sal_Unicode const * pEnd, bool bAddrSpec);
-
- static UniString reparseComment(sal_Unicode const * pBegin,
- sal_Unicode const * pEnd);
-
-public:
- SvAddressParser_Impl(SvAddressParser * pParser, UniString const & rInput);
-};
-
-inline void SvAddressParser_Impl::resetRealNameAndFirstComment()
-{
- m_pRealNameBegin = 0;
- m_pRealNameEnd = 0;
- m_pRealNameContentBegin = 0;
- m_pRealNameContentEnd = 0;
- m_bRealNameReparse = false;
- m_bRealNameFinished = false;
- m_pFirstCommentBegin = 0;
- m_pFirstCommentEnd = 0;
- m_bFirstCommentReparse = false;
-}
-
-inline void SvAddressParser_Impl::reset()
-{
- m_aOuterAddrSpec.reset();
- m_aInnerAddrSpec.reset();
- m_pAddrSpec = &m_aOuterAddrSpec;
- resetRealNameAndFirstComment();
- m_eState = BEFORE_COLON;
- m_eType = TOKEN_ATOM;
-}
-
-inline void SvAddressParser_Impl::addTokenToAddrSpec(ElementType eTokenElem)
-{
- if (!m_pAddrSpec->m_pBegin)
- m_pAddrSpec->m_pBegin = m_pCurTokenBegin;
- else if (m_pAddrSpec->m_pEnd < m_pCurTokenBegin)
- m_pAddrSpec->m_bReparse = true;
- m_pAddrSpec->m_pEnd = m_pCurTokenEnd;
- m_pAddrSpec->m_eLastElem = eTokenElem;
-}
-
-inline void SvAddressParser_Impl::addTokenToRealName()
-{
- if (!m_bRealNameFinished && m_eState != AFTER_LESS)
- {
- if (!m_pRealNameBegin)
- m_pRealNameBegin = m_pRealNameContentBegin = m_pCurTokenBegin;
- else if (m_pRealNameEnd < m_pCurTokenBegin - 1
- || (m_pRealNameEnd == m_pCurTokenBegin - 1
- && *m_pRealNameEnd != ' '))
- m_bRealNameReparse = true;
- m_pRealNameEnd = m_pRealNameContentEnd = m_pCurTokenEnd;
- }
-}
-
-//============================================================================
-//
-// SvAddressParser_Impl
-//
-//============================================================================
-
-bool SvAddressParser_Impl::readToken()
-{
- m_nCurToken = m_eType;
- m_bCurTokenReparse = false;
- switch (m_eType)
- {
- case TOKEN_QUOTED:
- {
- m_pCurTokenBegin = m_pInputPos - 1;
- m_pCurTokenContentBegin = m_pInputPos;
- bool bEscaped = false;
- for (;;)
- {
- if (m_pInputPos >= m_pInputEnd)
- return false;
- sal_Unicode cChar = *m_pInputPos++;
- if (bEscaped)
- {
- m_bCurTokenReparse = true;
- bEscaped = false;
- }
- else if (cChar == '"')
- {
- m_pCurTokenEnd = m_pInputPos;
- m_pCurTokenContentEnd = m_pInputPos - 1;
- return true;
- }
- else if (cChar == '\\')
- bEscaped = true;
- }
- }
-
- case TOKEN_DOMAIN:
- {
- m_pCurTokenBegin = m_pInputPos - 1;
- m_pCurTokenContentBegin = m_pInputPos;
- bool bEscaped = false;
- for (;;)
- {
- if (m_pInputPos >= m_pInputEnd)
- return false;
- sal_Unicode cChar = *m_pInputPos++;
- if (bEscaped)
- bEscaped = false;
- else if (cChar == ']')
- {
- m_pCurTokenEnd = m_pInputPos;
- return true;
- }
- else if (cChar == '\\')
- bEscaped = true;
- }
- }
-
- case TOKEN_COMMENT:
- {
- m_pCurTokenBegin = m_pInputPos - 1;
- m_pCurTokenContentBegin = 0;
- m_pCurTokenContentEnd = 0;
- bool bEscaped = false;
- xub_StrLen nLevel = 0;
- for (;;)
- {
- if (m_pInputPos >= m_pInputEnd)
- return false;
- sal_Unicode cChar = *m_pInputPos++;
- if (bEscaped)
- {
- m_bCurTokenReparse = true;
- m_pCurTokenContentEnd = m_pInputPos;
- bEscaped = false;
- }
- else if (cChar == '(')
- {
- if (!m_pCurTokenContentBegin)
- m_pCurTokenContentBegin = m_pInputPos - 1;
- m_pCurTokenContentEnd = m_pInputPos;
- ++nLevel;
- }
- else if (cChar == ')')
- if (nLevel)
- {
- m_pCurTokenContentEnd = m_pInputPos;
- --nLevel;
- }
- else
- return true;
- else if (cChar == '\\')
- {
- if (!m_pCurTokenContentBegin)
- m_pCurTokenContentBegin = m_pInputPos - 1;
- bEscaped = true;
- }
- else if (cChar > ' ' && cChar != 0x7F) // DEL
- {
- if (!m_pCurTokenContentBegin)
- m_pCurTokenContentBegin = m_pInputPos - 1;
- m_pCurTokenContentEnd = m_pInputPos;
- }
- }
- }
-
- default:
- {
- sal_Unicode cChar;
- for (;;)
- {
- if (m_pInputPos >= m_pInputEnd)
- return false;
- cChar = *m_pInputPos++;
- if (cChar > ' ' && cChar != 0x7F) // DEL
- break;
- }
- m_pCurTokenBegin = m_pInputPos - 1;
- if (cChar == '"' || cChar == '(' || cChar == ')' || cChar == ','
- || cChar == '.' || cChar == ':' || cChar == ';'
- || cChar == '<' || cChar == '>' || cChar == '@'
- || cChar == '[' || cChar == '\\' || cChar == ']')
- {
- m_nCurToken = cChar;
- m_pCurTokenEnd = m_pInputPos;
- return true;
- }
- else
- for (;;)
- {
- if (m_pInputPos >= m_pInputEnd)
- {
- m_pCurTokenEnd = m_pInputPos;
- return true;
- }
- cChar = *m_pInputPos++;
- if (cChar <= ' ' || cChar == '"' || cChar == '('
- || cChar == ')' || cChar == ',' || cChar == '.'
- || cChar == ':' || cChar == ';' || cChar == '<'
- || cChar == '>' || cChar == '@' || cChar == '['
- || cChar == '\\' || cChar == ']'
- || cChar == 0x7F) // DEL
- {
- m_pCurTokenEnd = --m_pInputPos;
- return true;
- }
- }
- }
- }
-}
-
-//============================================================================
-// static
-UniString SvAddressParser_Impl::reparse(sal_Unicode const * pBegin,
- sal_Unicode const * pEnd,
- bool bAddrSpec)
-{
- UniString aResult;
- TokenType eMode = TOKEN_ATOM;
- bool bEscaped = false;
- bool bEndsWithSpace = false;
- xub_StrLen nLevel = 0;
- while (pBegin < pEnd)
- {
- sal_Unicode cChar = *pBegin++;
- switch (eMode)
- {
- case TOKEN_QUOTED:
- if (bEscaped)
- {
- aResult += cChar;
- bEscaped = false;
- }
- else if (cChar == '"')
- {
- if (bAddrSpec)
- aResult += cChar;
- eMode = TOKEN_ATOM;
- }
- else if (cChar == '\\')
- {
- if (bAddrSpec)
- aResult += cChar;
- bEscaped = true;
- }
- else
- aResult += cChar;
- break;
-
- case TOKEN_DOMAIN:
- if (bEscaped)
- {
- aResult += cChar;
- bEscaped = false;
- }
- else if (cChar == ']')
- {
- aResult += cChar;
- eMode = TOKEN_ATOM;
- }
- else if (cChar == '\\')
- {
- if (bAddrSpec)
- aResult += cChar;
- bEscaped = true;
- }
- else
- aResult += cChar;
- break;
-
- case TOKEN_COMMENT:
- if (bEscaped)
- bEscaped = false;
- else if (cChar == '(')
- ++nLevel;
- else if (cChar == ')')
- if (nLevel)
- --nLevel;
- else
- eMode = TOKEN_ATOM;
- else if (cChar == '\\')
- bEscaped = true;
- break;
-
- case TOKEN_ATOM:
- if (cChar <= ' ' || cChar == 0x7F) // DEL
- {
- if (!bAddrSpec && !bEndsWithSpace)
- {
- aResult += ' ';
- bEndsWithSpace = true;
- }
- }
- else if (cChar == '(')
- {
- if (!bAddrSpec && !bEndsWithSpace)
- {
- aResult += ' ';
- bEndsWithSpace = true;
- }
- eMode = TOKEN_COMMENT;
- }
- else
- {
- bEndsWithSpace = false;
- if (cChar == '"')
- {
- if (bAddrSpec)
- aResult += cChar;
- eMode = TOKEN_QUOTED;
- }
- else if (cChar == '[')
- {
- aResult += cChar;
- eMode = TOKEN_QUOTED;
- }
- else
- aResult += cChar;
- }
- break;
- }
- }
- return aResult;
-}
-
-//============================================================================
-// static
-UniString SvAddressParser_Impl::reparseComment(sal_Unicode const * pBegin,
- sal_Unicode const * pEnd)
-{
- UniString aResult;
- while (pBegin < pEnd)
- {
- sal_Unicode cChar = *pBegin++;
- if (cChar == '\\')
- cChar = *pBegin++;
- aResult += cChar;
- }
- return aResult;
-}
-
-//============================================================================
-SvAddressParser_Impl::SvAddressParser_Impl(SvAddressParser * pParser,
- UniString const & rInput)
-{
- m_pInputPos = rInput.GetBuffer();
- m_pInputEnd = m_pInputPos + rInput.Len();
-
- reset();
- bool bDone = false;
- for (;;)
- {
- if (!readToken())
- {
- m_bRealNameFinished = true;
- if (m_eState == AFTER_LESS)
- m_nCurToken = '>';
- else
- {
- m_nCurToken = ',';
- bDone = true;
- }
- }
- switch (m_nCurToken)
- {
- case TOKEN_QUOTED:
- if (m_pAddrSpec->m_eLastElem != ELEMENT_END)
- {
- if (m_pAddrSpec->m_bAtFound
- || m_pAddrSpec->m_eLastElem <= ELEMENT_DELIM)
- m_pAddrSpec->reset();
- addTokenToAddrSpec(ELEMENT_ITEM);
- }
- if (!m_bRealNameFinished && m_eState != AFTER_LESS)
- {
- if (m_bCurTokenReparse)
- {
- if (!m_pRealNameBegin)
- m_pRealNameBegin = m_pCurTokenBegin;
- m_pRealNameEnd = m_pCurTokenEnd;
- m_bRealNameReparse = true;
- }
- else if (m_bRealNameReparse)
- m_pRealNameEnd = m_pCurTokenEnd;
- else if (!m_pRealNameBegin)
- {
- m_pRealNameBegin = m_pCurTokenBegin;
- m_pRealNameContentBegin = m_pCurTokenContentBegin;
- m_pRealNameEnd = m_pRealNameContentEnd
- = m_pCurTokenContentEnd;
- }
- else
- {
- m_pRealNameEnd = m_pCurTokenEnd;
- m_bRealNameReparse = true;
- }
- }
- m_eType = TOKEN_ATOM;
- break;
-
- case TOKEN_DOMAIN:
- if (m_pAddrSpec->m_eLastElem != ELEMENT_END)
- {
- if (m_pAddrSpec->m_bAtFound
- && m_pAddrSpec->m_eLastElem == ELEMENT_DELIM)
- addTokenToAddrSpec(ELEMENT_ITEM);
- else
- m_pAddrSpec->reset();
- }
- addTokenToRealName();
- m_eType = TOKEN_ATOM;
- break;
-
- case TOKEN_COMMENT:
- if (!m_bRealNameFinished && m_eState != AFTER_LESS
- && !m_pFirstCommentBegin && m_pCurTokenContentBegin)
- {
- m_pFirstCommentBegin = m_pCurTokenContentBegin;
- m_pFirstCommentEnd = m_pCurTokenContentEnd;
- m_bFirstCommentReparse = m_bCurTokenReparse;
- }
- m_eType = TOKEN_ATOM;
- break;
-
- case TOKEN_ATOM:
- if (m_pAddrSpec->m_eLastElem != ELEMENT_END)
- {
- if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM)
- m_pAddrSpec->reset();
- addTokenToAddrSpec(ELEMENT_ITEM);
- }
- addTokenToRealName();
- break;
-
- case '(':
- m_eType = TOKEN_COMMENT;
- break;
-
- case ')':
- case '\\':
- case ']':
- m_pAddrSpec->finish();
- addTokenToRealName();
- break;
-
- case '<':
- switch (m_eState)
- {
- case BEFORE_COLON:
- case BEFORE_LESS:
- m_aOuterAddrSpec.finish();
- if (m_pRealNameBegin)
- m_bRealNameFinished = true;
- m_pAddrSpec = &m_aInnerAddrSpec;
- m_eState = AFTER_LESS;
- break;
-
- case AFTER_LESS:
- m_aInnerAddrSpec.finish();
- break;
-
- case AFTER_GREATER:
- m_aOuterAddrSpec.finish();
- addTokenToRealName();
- break;
- }
- break;
-
- case '>':
- if (m_eState == AFTER_LESS)
- {
- m_aInnerAddrSpec.finish();
- if (m_aInnerAddrSpec.isValid())
- m_aOuterAddrSpec.m_eLastElem = ELEMENT_END;
- m_pAddrSpec = &m_aOuterAddrSpec;
- m_eState = AFTER_GREATER;
- }
- else
- {
- m_aOuterAddrSpec.finish();
- addTokenToRealName();
- }
- break;
-
- case '@':
- if (m_pAddrSpec->m_eLastElem != ELEMENT_END)
- {
- if (!m_pAddrSpec->m_bAtFound
- && m_pAddrSpec->m_eLastElem == ELEMENT_ITEM)
- {
- addTokenToAddrSpec(ELEMENT_DELIM);
- m_pAddrSpec->m_bAtFound = true;
- }
- else
- m_pAddrSpec->reset();
- }
- addTokenToRealName();
- break;
-
- case ',':
- case ';':
- if (m_eState == AFTER_LESS)
- if (m_nCurToken == ',')
- {
- if (m_aInnerAddrSpec.m_eLastElem
- != ELEMENT_END)
- m_aInnerAddrSpec.reset();
- }
- else
- m_aInnerAddrSpec.finish();
- else
- {
- m_pAddrSpec = m_aInnerAddrSpec.isValid()
- || (!m_aOuterAddrSpec.isValid()
- && m_aInnerAddrSpec.isPoorlyValid()) ?
- &m_aInnerAddrSpec :
- m_aOuterAddrSpec.isPoorlyValid() ?
- &m_aOuterAddrSpec : 0;
- if (m_pAddrSpec)
- {
- UniString aTheAddrSpec;
- if (m_pAddrSpec->m_bReparse)
- aTheAddrSpec = reparse(m_pAddrSpec->m_pBegin,
- m_pAddrSpec->m_pEnd, true);
- else
- {
- xub_StrLen nLen =
- sal::static_int_cast< xub_StrLen >(
- m_pAddrSpec->m_pEnd
- - m_pAddrSpec->m_pBegin);
- if (nLen == rInput.Len())
- aTheAddrSpec = rInput;
- else
- aTheAddrSpec
- = rInput.Copy(
- sal::static_int_cast< xub_StrLen >(
- m_pAddrSpec->m_pBegin
- - rInput.GetBuffer()),
- nLen);
- }
- UniString aTheRealName;
- if (!m_pRealNameBegin
- || (m_pAddrSpec == &m_aOuterAddrSpec
- && m_pRealNameBegin
- == m_aOuterAddrSpec.m_pBegin
- && m_pRealNameEnd == m_aOuterAddrSpec.m_pEnd
- && m_pFirstCommentBegin))
- if (!m_pFirstCommentBegin)
- aTheRealName = aTheAddrSpec;
- else if (m_bFirstCommentReparse)
- aTheRealName
- = reparseComment(m_pFirstCommentBegin,
- m_pFirstCommentEnd);
- else
- aTheRealName
- = rInput.Copy(
- sal::static_int_cast< xub_StrLen >(
- m_pFirstCommentBegin
- - rInput.GetBuffer()),
- sal::static_int_cast< xub_StrLen >(
- m_pFirstCommentEnd
- - m_pFirstCommentBegin));
- else if (m_bRealNameReparse)
- aTheRealName = reparse(m_pRealNameBegin,
- m_pRealNameEnd, false);
- else
- {
- xub_StrLen nLen =
- sal::static_int_cast< xub_StrLen >(
- m_pRealNameContentEnd
- - m_pRealNameContentBegin);
- if (nLen == rInput.Len())
- aTheRealName = rInput;
- else
- aTheRealName
- = rInput.Copy(
- sal::static_int_cast< xub_StrLen >(
- m_pRealNameContentBegin
- - rInput.GetBuffer()),
- nLen);
- }
- if (pParser->m_bHasFirst)
- pParser->m_aRest.Insert(new SvAddressEntry_Impl(
- aTheAddrSpec,
- aTheRealName),
- LIST_APPEND);
- else
- {
- pParser->m_bHasFirst = true;
- pParser->m_aFirst.m_aAddrSpec = aTheAddrSpec;
- pParser->m_aFirst.m_aRealName = aTheRealName;
- }
- }
- if (bDone)
- return;
- reset();
- }
- break;
-
- case ':':
- switch (m_eState)
- {
- case BEFORE_COLON:
- m_aOuterAddrSpec.reset();
- resetRealNameAndFirstComment();
- m_eState = BEFORE_LESS;
- break;
-
- case BEFORE_LESS:
- case AFTER_GREATER:
- m_aOuterAddrSpec.finish();
- addTokenToRealName();
- break;
-
- case AFTER_LESS:
- m_aInnerAddrSpec.reset();
- break;
- }
- break;
-
- case '"':
- m_eType = TOKEN_QUOTED;
- break;
-
- case '.':
- if (m_pAddrSpec->m_eLastElem != ELEMENT_END)
- {
- if (m_pAddrSpec->m_eLastElem != ELEMENT_DELIM)
- addTokenToAddrSpec(ELEMENT_DELIM);
- else
- m_pAddrSpec->reset();
- }
- addTokenToRealName();
- break;
-
- case '[':
- m_eType = TOKEN_DOMAIN;
- break;
- }
- }
-}
-
-//============================================================================
-//
-// SvAddressParser
-//
-//============================================================================
-
-SvAddressParser::SvAddressParser(UniString const & rInput): m_bHasFirst(false)
-{
- SvAddressParser_Impl(this, rInput);
-}
-
-//============================================================================
-SvAddressParser::~SvAddressParser()
-{
- for (ULONG i = m_aRest.Count(); i != 0;)
- delete m_aRest.Remove(--i);
-}
-
-//============================================================================
-// static
-bool SvAddressParser::createRFC822Mailbox(String const & rPhrase,
- String const & rAddrSpec,
- String & rMailbox)
-{
- String aTheAddrSpec;
- sal_Unicode const * p = rAddrSpec.GetBuffer();
- sal_Unicode const * pEnd = p + rAddrSpec.Len();
- {for (bool bSegment = false;;)
- {
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- if (p == pEnd)
- return false;
- if (bSegment)
- {
- sal_Unicode c = *p++;
- if (c == '@')
- break;
- else if (c != '.')
- return false;
- aTheAddrSpec += '.';
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- if (p == pEnd)
- return false;
- }
- else
- bSegment = true;
- if (*p == '"')
- {
- aTheAddrSpec += *p++;
- for (;;)
- {
- if (INetMIME::startsWithLineFolding(p, pEnd))
- p += 2;
- if (p == pEnd)
- return false;
- if (*p == '"')
- break;
- if (*p == '\x0D' || (*p == '\\' && ++p == pEnd)
- || !INetMIME::isUSASCII(*p))
- return false;
- if (INetMIME::needsQuotedStringEscape(*p))
- aTheAddrSpec += '\\';
- aTheAddrSpec += *p++;
- }
- aTheAddrSpec += *p++;
- }
- else if (INetMIME::isAtomChar(*p))
- while (p != pEnd && INetMIME::isAtomChar(*p))
- aTheAddrSpec += *p++;
- else
- return false;
- }}
- aTheAddrSpec += '@';
- {for (bool bSegment = false;;)
- {
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- if (p == pEnd)
- {
- if (bSegment)
- break;
- else
- return false;
- }
- if (bSegment)
- {
- if (*p++ != '.')
- return false;
- aTheAddrSpec += '.';
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- if (p == pEnd)
- return false;
- }
- else
- bSegment = true;
- if (*p == '[')
- {
- aTheAddrSpec += *p++;
- for (;;)
- {
- if (INetMIME::startsWithLineFolding(p, pEnd))
- p += 2;
- if (p == pEnd)
- return false;
- if (*p == ']')
- break;
- if (*p == '\x0D' || *p == '[' || (*p == '\\' && ++p == pEnd)
- || !INetMIME::isUSASCII(*p))
- return false;
- if (*p >= '[' && *p <= ']')
- aTheAddrSpec += '\\';
- aTheAddrSpec += *p++;
- }
- aTheAddrSpec += *p++;
- }
- else if (INetMIME::isAtomChar(*p))
- while (p != pEnd && INetMIME::isAtomChar(*p))
- aTheAddrSpec += *p++;
- else
- return false;
- }}
-
- if (rPhrase.Len() == 0)
- rMailbox = aTheAddrSpec;
- else
- {
- bool bQuotedString = false;
- p = rPhrase.GetBuffer();
- pEnd = p + rPhrase.Len();
- for (;p != pEnd; ++p)
- if (!(INetMIME::isAtomChar(*p)))
- {
- bQuotedString = true;
- break;
- }
- String aTheMailbox;
- if (bQuotedString)
- {
- aTheMailbox = '"';
- for (p = rPhrase.GetBuffer(); p != pEnd; ++p)
- {
- if (INetMIME::needsQuotedStringEscape(*p))
- aTheMailbox += '\\';
- aTheMailbox += *p;
- }
- aTheMailbox += '"';
- }
- else
- aTheMailbox = rPhrase;
- aTheMailbox.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" <"));
- aTheMailbox += aTheAddrSpec;
- aTheMailbox += '>';
- rMailbox = aTheMailbox;
- }
- return true;
-}
-
diff --git a/svtools/source/misc1/filenotation.cxx b/svtools/source/misc1/filenotation.cxx
deleted file mode 100644
index f5e5ae934e3d..000000000000
--- a/svtools/source/misc1/filenotation.cxx
+++ /dev/null
@@ -1,147 +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: filenotation.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include "filenotation.hxx"
-#include <osl/file.h>
-#include <osl/diagnose.h>
-#include <tools/urlobj.hxx>
-
-//.........................................................................
-namespace svt
-{
-//.........................................................................
-
- //=====================================================================
- //= OFileNotation
- //=====================================================================
- //---------------------------------------------------------------------
- OFileNotation::OFileNotation( const ::rtl::OUString& _rUrlOrPath )
- {
- construct( _rUrlOrPath );
- }
-
- //---------------------------------------------------------------------
- OFileNotation::OFileNotation( const ::rtl::OUString& _rUrlOrPath, NOTATION _eInputNotation )
- {
- if ( _eInputNotation == N_URL )
- {
- INetURLObject aParser( _rUrlOrPath );
- if ( aParser.GetProtocol() == INET_PROT_FILE )
- implInitWithURLNotation( _rUrlOrPath );
- else
- m_sSystem = m_sFileURL = _rUrlOrPath;
- }
- else
- implInitWithSystemNotation( _rUrlOrPath );
- }
-
- //---------------------------------------------------------------------
- bool OFileNotation::implInitWithSystemNotation( const ::rtl::OUString& _rSystemPath )
- {
- bool bSuccess = false;
-
- m_sSystem = _rSystemPath;
- if ( ( osl_File_E_None != osl_getFileURLFromSystemPath( m_sSystem.pData, &m_sFileURL.pData ) )
- && ( 0 == m_sFileURL.getLength() )
- )
- {
- if ( _rSystemPath.getLength() )
- {
- INetURLObject aSmartParser;
- aSmartParser.SetSmartProtocol( INET_PROT_FILE );
- if ( aSmartParser.SetSmartURL( _rSystemPath ) )
- {
- m_sFileURL = aSmartParser.GetMainURL( INetURLObject::NO_DECODE );
- osl_getSystemPathFromFileURL( m_sFileURL.pData, &m_sSystem.pData );
- bSuccess = true;
- }
- }
- }
- else
- bSuccess = true;
- return bSuccess;
- }
-
- //---------------------------------------------------------------------
- bool OFileNotation::implInitWithURLNotation( const ::rtl::OUString& _rURL )
- {
- m_sFileURL = _rURL;
- osl_getSystemPathFromFileURL( _rURL.pData, &m_sSystem.pData );
- return true;
- }
-
- //---------------------------------------------------------------------
- void OFileNotation::construct( const ::rtl::OUString& _rUrlOrPath )
- {
- bool bSuccess = false;
- // URL notation?
- INetURLObject aParser( _rUrlOrPath );
- switch ( aParser.GetProtocol() )
- {
- case INET_PROT_FILE:
- // file URL
- bSuccess = implInitWithURLNotation( _rUrlOrPath );
- break;
-
- case INET_PROT_NOT_VALID:
- // assume system notation
- bSuccess = implInitWithSystemNotation( _rUrlOrPath );
- break;
-
- default:
- // it's a known scheme, but no file-URL -> assume that bothe the URL representation and the
- // system representation are the URL itself
- m_sSystem = m_sFileURL = _rUrlOrPath;
- bSuccess = true;
- break;
- }
-
- OSL_ENSURE( bSuccess, "OFileNotation::OFileNotation: could not detect the format!" );
- }
-
- //---------------------------------------------------------------------
- ::rtl::OUString OFileNotation::get(NOTATION _eOutputNotation)
- {
- switch (_eOutputNotation)
- {
- case N_SYSTEM: return m_sSystem;
- case N_URL: return m_sFileURL;
- }
-
- OSL_ENSURE(sal_False, "OFileNotation::get: inavlid enum value!");
- return ::rtl::OUString();
- }
-
-//.........................................................................
-} // namespace svt
-//.........................................................................
-
diff --git a/svtools/source/misc1/folderrestriction.cxx b/svtools/source/misc1/folderrestriction.cxx
deleted file mode 100644
index 7f95bdaaa0bc..000000000000
--- a/svtools/source/misc1/folderrestriction.cxx
+++ /dev/null
@@ -1,109 +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: folderrestriction.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include "folderrestriction.hxx"
-#include "osl/process.h"
-#include "tools/urlobj.hxx"
-#include "unotools/localfilehelper.hxx"
-
-//-----------------------------------------------------------------------------
-
-static void convertStringListToUrls (
- const String& _rColonSeparatedList, ::std::vector< String >& _rTokens, bool _bFinalSlash )
-{
- const sal_Unicode s_cSeparator =
-#if defined(WNT)
- ';'
-#else
- ':'
-#endif
- ;
- xub_StrLen nTokens = _rColonSeparatedList.GetTokenCount( s_cSeparator );
- _rTokens.resize( 0 ); _rTokens.reserve( nTokens );
- for ( xub_StrLen i=0; i<nTokens; ++i )
- {
- // the current token in the list
- String sCurrentToken = _rColonSeparatedList.GetToken( i, s_cSeparator );
- if ( !sCurrentToken.Len() )
- continue;
-
- INetURLObject aCurrentURL;
-
- String sURL;
- if ( ::utl::LocalFileHelper::ConvertPhysicalNameToURL( sCurrentToken, sURL ) )
- aCurrentURL = INetURLObject( sURL );
- else
- {
- // smart URL parsing, assuming FILE protocol
- aCurrentURL = INetURLObject( sCurrentToken, INET_PROT_FILE );
- }
-
- if ( _bFinalSlash )
- aCurrentURL.setFinalSlash( );
- else
- aCurrentURL.removeFinalSlash( );
- _rTokens.push_back( aCurrentURL.GetMainURL( INetURLObject::NO_DECODE ) );
- }
-}
-
-/** retrieves the value of an environment variable
- @return <TRUE/> if and only if the retrieved string value is not empty
-*/
-static bool getEnvironmentValue( const sal_Char* _pAsciiEnvName, ::rtl::OUString& _rValue )
-{
- _rValue = ::rtl::OUString();
- ::rtl::OUString sEnvName = ::rtl::OUString::createFromAscii( _pAsciiEnvName );
- osl_getEnvironment( sEnvName.pData, &_rValue.pData );
- return _rValue.getLength() != 0;
-}
-
-//-----------------------------------------------------------------------------
-
-namespace svt
-{
-
- void getUnrestrictedFolders( ::std::vector< String >& _rFolders )
- {
- _rFolders.resize( 0 );
- ::rtl::OUString sRestrictedPathList;
- if ( getEnvironmentValue( "RestrictedPath", sRestrictedPathList ) )
- {
- // append a final slash. This ensures that when we later on check
- // for unrestricted paths, we don't allow paths like "/home/user35" just because
- // "/home/user3" is allowed - with the final slash, we make it "/home/user3/".
- convertStringListToUrls( sRestrictedPathList, _rFolders, true );
- }
- }
-
-} // namespace svt
-
diff --git a/svtools/source/misc1/fstathelper.cxx b/svtools/source/misc1/fstathelper.cxx
deleted file mode 100644
index 82480fc83473..000000000000
--- a/svtools/source/misc1/fstathelper.cxx
+++ /dev/null
@@ -1,103 +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: fstathelper.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <tools/date.hxx>
-#include <tools/time.hxx>
-#include <tools/string.hxx>
-#include <ucbhelper/content.hxx>
-#include <com/sun/star/util/DateTime.hpp>
-
-#include <fstathelper.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-using namespace ::rtl;
-
-sal_Bool FStatHelper::GetModifiedDateTimeOfFile( const UniString& rURL,
- Date* pDate, Time* pTime )
-{
- sal_Bool bRet = FALSE;
- try
- {
- ::ucbhelper::Content aTestContent( rURL,
- uno::Reference< XCommandEnvironment > ());
- uno::Any aAny = aTestContent.getPropertyValue(
- OUString::createFromAscii( "DateModified" ) );
- if( aAny.hasValue() )
- {
- bRet = sal_True;
- const util::DateTime* pDT = (util::DateTime*)aAny.getValue();
- if( pDate )
- *pDate = Date( pDT->Day, pDT->Month, pDT->Year );
- if( pTime )
- *pTime = Time( pDT->Hours, pDT->Minutes,
- pDT->Seconds, pDT->HundredthSeconds );
- }
- }
- catch(...)
- {
- }
-
- return bRet;
-}
-
-sal_Bool FStatHelper::IsDocument( const UniString& rURL )
-{
- BOOL bExist = FALSE;
- try
- {
- ::ucbhelper::Content aTestContent( rURL,
- uno::Reference< XCommandEnvironment > ());
- bExist = aTestContent.isDocument();
- }
- catch(...)
- {
- }
- return bExist;
-}
-
-sal_Bool FStatHelper::IsFolder( const UniString& rURL )
-{
- BOOL bExist = FALSE;
- try
- {
- ::ucbhelper::Content aTestContent( rURL,
- uno::Reference< XCommandEnvironment > ());
- bExist = aTestContent.isFolder();
- }
- catch(...)
- {
- }
- return bExist;
-}
-
diff --git a/svtools/source/misc1/inethist.cxx b/svtools/source/misc1/inethist.cxx
deleted file mode 100644
index 5a1a3719d7ca..000000000000
--- a/svtools/source/misc1/inethist.cxx
+++ /dev/null
@@ -1,545 +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: inethist.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <svtools/inethist.hxx>
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-#include "rtl/instance.hxx"
-#include "rtl/crc.h"
-#include "rtl/memory.h"
-#include <tools/solar.h>
-#include <tools/debug.hxx>
-#include <tools/string.hxx>
-#include <tools/urlobj.hxx>
-
-/*========================================================================
- *
- * INetURLHistory internals.
- *
- *======================================================================*/
-#define INETHIST_DEF_FTP_PORT 21
-#define INETHIST_DEF_HTTP_PORT 80
-#define INETHIST_DEF_HTTPS_PORT 443
-
-#define INETHIST_SIZE_LIMIT 1024
-#define INETHIST_MAGIC_HEAD 0x484D4849UL
-
-/*
- * INetURLHistoryHint implementation.
- */
-IMPL_PTRHINT (INetURLHistoryHint, const INetURLObject);
-
-/*========================================================================
- *
- * INetURLHistory_Impl interface.
- *
- *======================================================================*/
-class INetURLHistory_Impl
-{
- /** head_entry.
- */
- struct head_entry
- {
- /** Representation.
- */
- UINT32 m_nMagic;
- UINT16 m_nNext;
- UINT16 m_nMBZ;
-
- /** Initialization.
- */
- void initialize (void)
- {
- m_nMagic = INETHIST_MAGIC_HEAD;
- m_nNext = 0;
- m_nMBZ = 0;
- }
- };
-
- /** hash_entry.
- */
- struct hash_entry
- {
- /** Representation.
- */
- UINT32 m_nHash;
- UINT16 m_nLru;
- UINT16 m_nMBZ;
-
- /** Initialization.
- */
- void initialize (UINT16 nLru, UINT32 nHash = 0)
- {
- m_nHash = nHash;
- m_nLru = nLru;
- m_nMBZ = 0;
- }
-
- /** Comparison.
- */
- BOOL operator== (const hash_entry &rOther) const
- {
- return (m_nHash == rOther.m_nHash);
- }
- BOOL operator< (const hash_entry &rOther) const
- {
- return (m_nHash < rOther.m_nHash);
- }
-
- BOOL operator== (UINT32 nHash) const
- {
- return (m_nHash == nHash);
- }
- BOOL operator< (UINT32 nHash) const
- {
- return (m_nHash < nHash);
- }
- };
-
- /** lru_entry.
- */
- struct lru_entry
- {
- /** Representation.
- */
- UINT32 m_nHash;
- UINT16 m_nNext;
- UINT16 m_nPrev;
-
- /** Initialization.
- */
- void initialize (UINT16 nThis, UINT32 nHash = 0)
- {
- m_nHash = nHash;
- m_nNext = nThis;
- m_nPrev = nThis;
- }
- };
-
- /** Representation.
- */
- head_entry m_aHead;
- hash_entry m_pHash[INETHIST_SIZE_LIMIT];
- lru_entry m_pList[INETHIST_SIZE_LIMIT];
-
- /** Initialization.
- */
- void initialize (void);
-
- void downheap (hash_entry a[], UINT16 n, UINT16 k);
- void heapsort (hash_entry a[], UINT16 n);
-
- /** capacity.
- */
- UINT16 capacity (void) const
- {
- return (UINT16)(INETHIST_SIZE_LIMIT);
- }
-
- /** crc32.
- */
- UINT32 crc32 (UniString const & rData) const
- {
- return rtl_crc32 (0, rData.GetBuffer(), rData.Len() * sizeof(sal_Unicode));
- }
-
- /** find.
- */
- UINT16 find (UINT32 nHash) const;
-
- /** move.
- */
- void move (UINT16 nSI, UINT16 nDI);
-
- /** backlink.
- */
- void backlink (UINT16 nThis, UINT16 nTail)
- {
- register lru_entry &rThis = m_pList[nThis];
- register lru_entry &rTail = m_pList[nTail];
-
- rTail.m_nNext = nThis;
- rTail.m_nPrev = rThis.m_nPrev;
- rThis.m_nPrev = nTail;
- m_pList[rTail.m_nPrev].m_nNext = nTail;
- }
-
- /** unlink.
- */
- void unlink (UINT16 nThis)
- {
- register lru_entry &rThis = m_pList[nThis];
-
- m_pList[rThis.m_nPrev].m_nNext = rThis.m_nNext;
- m_pList[rThis.m_nNext].m_nPrev = rThis.m_nPrev;
- rThis.m_nNext = nThis;
- rThis.m_nPrev = nThis;
- }
-
- /** Not implemented.
- */
- INetURLHistory_Impl (const INetURLHistory_Impl&);
- INetURLHistory_Impl& operator= (const INetURLHistory_Impl&);
-
-public:
- INetURLHistory_Impl (void);
- ~INetURLHistory_Impl (void);
-
- /** putUrl/queryUrl.
- */
- void putUrl (const String &rUrl);
- BOOL queryUrl (const String &rUrl);
-};
-
-/*========================================================================
- *
- * INetURLHistory_Impl implementation.
- *
- *======================================================================*/
-/*
- * INetURLHistory_Impl.
- */
-INetURLHistory_Impl::INetURLHistory_Impl (void)
-{
- initialize();
-}
-
-/*
- * ~INetURLHistory_Impl.
- */
-INetURLHistory_Impl::~INetURLHistory_Impl (void)
-{
-}
-
-/*
- * initialize.
- */
-void INetURLHistory_Impl::initialize (void)
-{
- m_aHead.initialize();
-
- USHORT i, n = capacity();
- for (i = 0; i < n; i++)
- m_pHash[i].initialize(i);
- for (i = 0; i < n; i++)
- m_pList[i].initialize(i);
- for (i = 1; i < n; i++)
- backlink (m_aHead.m_nNext, i);
-}
-
-/*
- * downheap.
- */
-void INetURLHistory_Impl::downheap (hash_entry a[], UINT16 n, UINT16 k)
-{
- hash_entry h = a[k];
- while (k < n / 2)
- {
- UINT16 i = k + k + 1;
- if (((i + 1) < n) && (a[i] < a[i + 1])) i++;
- if (!(h < a[i])) break;
- a[k] = a[i];
- k = i;
- }
- a[k] = h;
-}
-
-/*
- * heapsort.
- */
-void INetURLHistory_Impl::heapsort (hash_entry a[], UINT16 n)
-{
- hash_entry h;
-
- for (UINT16 k = (n - 1) / 2 + 1; k > 0; k--)
- downheap (a, n, k - 1);
-
- while (n > 0)
- {
- h = a[0 ];
- a[0 ] = a[n - 1];
- a[n - 1] = h;
- downheap (a, --n, 0);
- }
-}
-
-/*
- * find.
- */
-UINT16 INetURLHistory_Impl::find (UINT32 nHash) const
-{
- UINT16 l = 0;
- UINT16 r = capacity() - 1;
- UINT16 c = capacity();
-
- while ((l < r) && (r < c))
- {
- UINT16 m = (l + r) / 2;
- if (m_pHash[m] == nHash)
- return m;
-
- if (m_pHash[m] < nHash)
- l = m + 1;
- else
- r = m - 1;
- }
- return l;
-}
-
-/*
- * move.
- */
-void INetURLHistory_Impl::move (UINT16 nSI, UINT16 nDI)
-{
- hash_entry e = m_pHash[nSI];
- if (nSI < nDI)
- {
- // shift left.
- rtl_moveMemory (
- &m_pHash[nSI ],
- &m_pHash[nSI + 1],
- (nDI - nSI) * sizeof(hash_entry));
- }
- if (nSI > nDI)
- {
- // shift right.
- rtl_moveMemory (
- &m_pHash[nDI + 1],
- &m_pHash[nDI ],
- (nSI - nDI) * sizeof(hash_entry));
- }
- m_pHash[nDI] = e;
-}
-
-/*
- * putUrl.
- */
-void INetURLHistory_Impl::putUrl (const String &rUrl)
-{
- UINT32 h = crc32 (rUrl);
- UINT16 k = find (h);
- if ((k < capacity()) && (m_pHash[k] == h))
- {
- // Cache hit.
- UINT16 nMRU = m_pHash[k].m_nLru;
- if (nMRU != m_aHead.m_nNext)
- {
- // Update LRU chain.
- unlink (nMRU);
- backlink (m_aHead.m_nNext, nMRU);
-
- // Rotate LRU chain.
- m_aHead.m_nNext = m_pList[m_aHead.m_nNext].m_nPrev;
- }
- }
- else
- {
- // Cache miss. Obtain least recently used.
- UINT16 nLRU = m_pList[m_aHead.m_nNext].m_nPrev;
-
- UINT16 nSI = find (m_pList[nLRU].m_nHash);
- if (!(nLRU == m_pHash[nSI].m_nLru))
- {
- // Update LRU chain.
- nLRU = m_pHash[nSI].m_nLru;
- unlink (nLRU);
- backlink (m_aHead.m_nNext, nLRU);
- }
-
- // Rotate LRU chain.
- m_aHead.m_nNext = m_pList[m_aHead.m_nNext].m_nPrev;
-
- // Check source and destination.
- UINT16 nDI = std::min (k, UINT16(capacity() - 1));
- if (nSI < nDI)
- {
- if (!(m_pHash[nDI] < h))
- nDI -= 1;
- }
- if (nDI < nSI)
- {
- if (m_pHash[nDI] < h)
- nDI += 1;
- }
-
- // Assign data.
- m_pList[m_aHead.m_nNext].m_nHash = m_pHash[nSI].m_nHash = h;
- move (nSI, nDI);
- }
-}
-
-/*
- * queryUrl.
- */
-BOOL INetURLHistory_Impl::queryUrl (const String &rUrl)
-{
- UINT32 h = crc32 (rUrl);
- UINT16 k = find (h);
- if ((k < capacity()) && (m_pHash[k] == h))
- {
- // Cache hit.
- return TRUE;
- }
- else
- {
- // Cache miss.
- return FALSE;
- }
-}
-
-/*========================================================================
- *
- * INetURLHistory::StaticInstance implementation.
- *
- *======================================================================*/
-INetURLHistory * INetURLHistory::StaticInstance::operator ()()
-{
- static INetURLHistory g_aInstance;
- return &g_aInstance;
-}
-
-/*========================================================================
- *
- * INetURLHistory implementation.
- *
- *======================================================================*/
-/*
- * INetURLHistory.
- */
-INetURLHistory::INetURLHistory() : m_pImpl (new INetURLHistory_Impl())
-{
-}
-
-/*
- * ~INetURLHistory.
- */
-INetURLHistory::~INetURLHistory()
-{
- DELETEZ (m_pImpl);
-}
-
-/*
- * GetOrCreate.
- */
-INetURLHistory* INetURLHistory::GetOrCreate()
-{
- return rtl_Instance<
- INetURLHistory, StaticInstance,
- osl::MutexGuard, osl::GetGlobalMutex >::create (
- StaticInstance(), osl::GetGlobalMutex());
-}
-
-/*
- * NormalizeUrl_Impl.
- */
-void INetURLHistory::NormalizeUrl_Impl (INetURLObject &rUrl)
-{
- switch (rUrl.GetProtocol())
- {
- case INET_PROT_FILE:
- if (!rUrl.IsCaseSensitive())
- {
- String aPath (rUrl.GetURLPath(INetURLObject::NO_DECODE));
- aPath.ToLowerAscii();
- rUrl.SetURLPath (aPath, INetURLObject::NOT_CANONIC);
- }
- break;
-
- case INET_PROT_FTP:
- if (!rUrl.HasPort())
- rUrl.SetPort (INETHIST_DEF_FTP_PORT);
- break;
-
- case INET_PROT_HTTP:
- if (!rUrl.HasPort())
- rUrl.SetPort (INETHIST_DEF_HTTP_PORT);
- if (!rUrl.HasURLPath())
- rUrl.SetURLPath ("/");
- break;
-
- case INET_PROT_HTTPS:
- if (!rUrl.HasPort())
- rUrl.SetPort (INETHIST_DEF_HTTPS_PORT);
- if (!rUrl.HasURLPath())
- rUrl.SetURLPath ("/");
- break;
-
- default:
- break;
- }
-}
-
-/*
- * PutUrl_Impl.
- */
-void INetURLHistory::PutUrl_Impl (const INetURLObject &rUrl)
-{
- DBG_ASSERT (m_pImpl, "PutUrl_Impl(): no Implementation");
- if (m_pImpl)
- {
- INetURLObject aHistUrl (rUrl);
- NormalizeUrl_Impl (aHistUrl);
-
- m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE));
- Broadcast (INetURLHistoryHint (&rUrl));
-
- if (aHistUrl.HasMark())
- {
- aHistUrl.SetURL (aHistUrl.GetURLNoMark(INetURLObject::NO_DECODE),
- INetURLObject::NOT_CANONIC);
-
- m_pImpl->putUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE));
- Broadcast (INetURLHistoryHint (&aHistUrl));
- }
- }
-}
-
-/*
- * QueryUrl_Impl.
- */
-BOOL INetURLHistory::QueryUrl_Impl (const INetURLObject &rUrl)
-{
- DBG_ASSERT (m_pImpl, "QueryUrl_Impl(): no Implementation");
- if (m_pImpl)
- {
- INetURLObject aHistUrl (rUrl);
- NormalizeUrl_Impl (aHistUrl);
-
- return m_pImpl->queryUrl (aHistUrl.GetMainURL(INetURLObject::NO_DECODE));
- }
- return FALSE;
-}
-
-
diff --git a/svtools/source/misc1/inettype.cxx b/svtools/source/misc1/inettype.cxx
deleted file mode 100644
index ce62d7f3b2fc..000000000000
--- a/svtools/source/misc1/inettype.cxx
+++ /dev/null
@@ -1,1348 +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: inettype.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <tools/table.hxx>
-#include <tools/wldcrd.hxx>
-#include <svtools/inettype.hxx>
-#include <svtools/svtdata.hxx>
-#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
-#endif
-
-#ifndef _SVSTDARR_STRINGSSORT_DECL
-#define _SVSTDARR_STRINGSSORT
-#include <svtools/svstdarr.hxx>
-#undef _SVSTDARR_STRINGSSORT
-#endif
-
-namespace unnamed_svtools_inettype {}
-using namespace unnamed_svtools_inettype;
- // unnamed namespaces don't work well yet
-
-//============================================================================
-namespace unnamed_svtools_inettype {
-
-//============================================================================
-struct MediaTypeEntry
-{
- sal_Char const * m_pTypeName;
- INetContentType m_eTypeID;
- sal_Char const * m_pExtension;
-};
-
-//============================================================================
-struct TypeIDMapEntry
-{
- UniString m_aTypeName;
- UniString m_aPresentation;
- UniString m_aSystemFileType;
-};
-
-//============================================================================
-struct TypeNameMapEntry: public UniString
-{
- UniString m_aExtension;
- INetContentType m_eTypeID;
-
- TypeNameMapEntry(const UniString & rType):
- UniString(rType), m_eTypeID(CONTENT_TYPE_UNKNOWN) {}
-};
-
-//============================================================================
-struct ExtensionMapEntry: public UniString
-{
- INetContentType m_eTypeID;
-
- ExtensionMapEntry(const UniString & rExt):
- UniString(rExt), m_eTypeID(CONTENT_TYPE_UNKNOWN) {}
-};
-
-//============================================================================
-class Registration
-{
- static Registration * m_pRegistration;
-
- Table m_aTypeIDMap; // map TypeID to TypeName, Presentation
- SvStringsSort m_aTypeNameMap; // map TypeName to TypeID, Extension
- SvStringsSort m_aExtensionMap; // map Extension to TypeID
- sal_uInt32 m_nNextDynamicID;
-
-public:
- Registration(): m_nNextDynamicID(CONTENT_TYPE_LAST + 1) {}
-
- ~Registration();
-
- static inline void deinitialize();
-
- static inline TypeIDMapEntry * getEntry(INetContentType eTypeID);
-
- static TypeNameMapEntry * getExtensionEntry(UniString const & rTypeName);
-
- static INetContentType RegisterContentType(UniString const & rTypeName,
- UniString const &
- rPresentation,
- UniString const * pExtension,
- UniString const *
- pSystemFileType);
-
- static INetContentType GetContentType(UniString const & rTypeName);
-
- static UniString GetContentType(INetContentType eTypeID);
-
- static UniString GetPresentation(INetContentType eTypeID);
-
- static UniString GetExtension(const UniString & rTypeName);
-
- static INetContentType GetContentType4Extension(UniString const &
- rExtension);
-
-};
-
-// static
-inline void Registration::deinitialize()
-{
- delete m_pRegistration;
- m_pRegistration = 0;
-}
-
-// static
-inline TypeIDMapEntry * Registration::getEntry(INetContentType eTypeID)
-{
- return
- m_pRegistration ?
- static_cast< TypeIDMapEntry * >(m_pRegistration->
- m_aTypeIDMap.Get(eTypeID)) :
- 0;
-}
-
-//============================================================================
-MediaTypeEntry const * seekEntry(UniString const & rTypeName,
- MediaTypeEntry const * pMap, sal_Size nSize);
-
-//============================================================================
-/** A mapping from type names to type ids and extensions. Sorted by type
- name.
- */
-MediaTypeEntry const aStaticTypeNameMap[CONTENT_TYPE_LAST + 1]
- = { { " ", CONTENT_TYPE_UNKNOWN, "" },
- { CONTENT_TYPE_STR_X_CNT_DOCUMENT, CONTENT_TYPE_X_CNT_DOCUMENT,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FSYSBOX, CONTENT_TYPE_X_CNT_FSYSBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_CDROM_VOLUME,
- CONTENT_TYPE_X_CNT_CDROM_VOLUME, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_DISK_35, CONTENT_TYPE_X_CNT_DISK_35, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_DISK_525, CONTENT_TYPE_X_CNT_DISK_525,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FSYSFILE, CONTENT_TYPE_X_CNT_FSYSFILE,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FIXED_VOLUME,
- CONTENT_TYPE_X_CNT_FIXED_VOLUME, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FSYSFOLDER, CONTENT_TYPE_X_CNT_FSYSFOLDER,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_RAM_VOLUME, CONTENT_TYPE_X_CNT_RAM_VOLUME,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_REMOTE_VOLUME,
- CONTENT_TYPE_X_CNT_REMOTE_VOLUME, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_REMOVEABLE_VOLUME,
- CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFILE,
- CONTENT_TYPE_X_CNT_FSYSSPECIALFILE, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FSYSSPECIALFOLDER,
- CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_TAPEDRIVE, CONTENT_TYPE_X_CNT_TAPEDRIVE,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FSYSURLFILE, CONTENT_TYPE_X_CNT_FSYSURLFILE,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FTPBOX, CONTENT_TYPE_X_CNT_FTPBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FTPFILE, CONTENT_TYPE_X_CNT_FTPFILE, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FTPFOLDER, CONTENT_TYPE_X_CNT_FTPFOLDER,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_FTPLINK, CONTENT_TYPE_X_CNT_FTPLINK, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_HTTPBOX, CONTENT_TYPE_X_CNT_HTTPBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_HTTPFILE, CONTENT_TYPE_X_CNT_HTTPFILE,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_IMAPBOX, CONTENT_TYPE_X_CNT_IMAPBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_IMAPFOLDER, CONTENT_TYPE_X_CNT_IMAPFOLDER,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_MESSAGE, CONTENT_TYPE_X_CNT_MESSAGE, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_NEWSBOX, CONTENT_TYPE_X_CNT_NEWSBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_NEWSGROUP, CONTENT_TYPE_X_CNT_NEWSGROUP,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_OUTBOX, CONTENT_TYPE_X_CNT_OUTBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_POP3BOX, CONTENT_TYPE_X_CNT_POP3BOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_PUBLISHBOX, CONTENT_TYPE_X_CNT_PUBLISHBOX,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_SEARCHBOX, CONTENT_TYPE_X_CNT_SEARCHBOX,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_SEPARATOR, CONTENT_TYPE_X_CNT_SEPARATOR,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_BOOKMARK, CONTENT_TYPE_X_CNT_BOOKMARK,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_SUBSCRIBEBOX,
- CONTENT_TYPE_X_CNT_SUBSCRIBEBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_CDF, CONTENT_TYPE_X_CNT_CDF, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_CDFITEM, CONTENT_TYPE_X_CNT_CDFITEM, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_CDFSUB, CONTENT_TYPE_X_CNT_CDFSUB, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_STARCHANNEL, CONTENT_TYPE_X_CNT_STARCHANNEL,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_TRASHBOX, CONTENT_TYPE_X_CNT_TRASHBOX,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_TRASH, CONTENT_TYPE_X_CNT_TRASH, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_VIMBBOARD, CONTENT_TYPE_X_CNT_VIMBBOARD,
- "tmp" },
- { CONTENT_TYPE_STR_X_CNT_VIMBBOARDBOX,
- CONTENT_TYPE_X_CNT_VIMBBOARDBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_VIMBOX, CONTENT_TYPE_X_CNT_VIMBOX, "tmp" },
- { CONTENT_TYPE_STR_X_CNT_VIMINBOX, CONTENT_TYPE_X_CNT_VIMINBOX,
- "tmp" },
- { CONTENT_TYPE_STR_APP_OCTSTREAM, CONTENT_TYPE_APP_OCTSTREAM, "tmp" },
- { CONTENT_TYPE_STR_APP_PDF, CONTENT_TYPE_APP_PDF, "pdf" },
- { CONTENT_TYPE_STR_APP_RTF, CONTENT_TYPE_APP_RTF, "rtf" },
- { CONTENT_TYPE_STR_APP_VND_CALC, CONTENT_TYPE_APP_VND_CALC, "sdc" },
- { CONTENT_TYPE_STR_APP_VND_CHART, CONTENT_TYPE_APP_VND_CHART, "sds" },
- { CONTENT_TYPE_STR_APP_VND_DRAW, CONTENT_TYPE_APP_VND_DRAW, "sda" },
- { CONTENT_TYPE_STR_APP_VND_IMAGE, CONTENT_TYPE_APP_VND_IMAGE, "sim" },
- { CONTENT_TYPE_STR_APP_VND_IMPRESS, CONTENT_TYPE_APP_VND_IMPRESS,
- "sdd" },
- { CONTENT_TYPE_STR_APP_VND_IMPRESSPACKED,
- CONTENT_TYPE_APP_VND_IMPRESSPACKED, "sdp" },
- { CONTENT_TYPE_STR_APP_VND_MAIL, CONTENT_TYPE_APP_VND_MAIL, "sdm" },
- { CONTENT_TYPE_STR_APP_VND_MATH, CONTENT_TYPE_APP_VND_MATH, "smf" },
- { CONTENT_TYPE_STR_APP_VND_NEWS, CONTENT_TYPE_APP_VND_NEWS, "sdm" },
- { CONTENT_TYPE_STR_APP_VND_OUTTRAY, CONTENT_TYPE_APP_VND_OUTTRAY,
- "sdm" },
- { CONTENT_TYPE_STR_APP_VND_TEMPLATE, CONTENT_TYPE_APP_VND_TEMPLATE,
- "vor" },
- { CONTENT_TYPE_STR_APP_VND_WRITER, CONTENT_TYPE_APP_VND_WRITER,
- "sdw" },
- { CONTENT_TYPE_STR_APP_VND_WRITER_GLOBAL,
- CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "sgl" },
- { CONTENT_TYPE_STR_APP_VND_WRITER_WEB,
- CONTENT_TYPE_APP_VND_WRITER_WEB, "htm" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_CALC, CONTENT_TYPE_APP_VND_SUN_XML_CALC, "sxc" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_CHART, CONTENT_TYPE_APP_VND_SUN_XML_CHART, "sxs" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_DRAW, CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "sxd" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESS, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "sxi" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_IMPRESSPACKED, CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, "sxp" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_MATH, CONTENT_TYPE_APP_VND_SUN_XML_MATH, "sxm" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER, CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "sxw" },
- { CONTENT_TYPE_STR_APP_VND_SUN_XML_WRITER_GLOBAL, CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, "sxg" },
- { CONTENT_TYPE_STR_APP_FRAMESET, CONTENT_TYPE_APP_FRAMESET, "sfs" },
- { CONTENT_TYPE_STR_APP_GALLERY, CONTENT_TYPE_APP_GALLERY, "gal" },
- { CONTENT_TYPE_STR_APP_GALLERY_THEME, CONTENT_TYPE_APP_GALLERY_THEME,
- "thm" },
- { CONTENT_TYPE_STR_APP_JAR, CONTENT_TYPE_APP_JAR, "jar" },
- { CONTENT_TYPE_STR_APP_MACRO, CONTENT_TYPE_APP_MACRO, "tmp" },
- { CONTENT_TYPE_STR_APP_MSEXCEL, CONTENT_TYPE_APP_MSEXCEL, "xls" },
- { CONTENT_TYPE_STR_APP_MSEXCEL_TEMPL, CONTENT_TYPE_APP_MSEXCEL_TEMPL,
- "xlt" },
- { CONTENT_TYPE_STR_APP_MSPPOINT, CONTENT_TYPE_APP_MSPPOINT, "ppt" },
- { CONTENT_TYPE_STR_APP_MSPPOINT_TEMPL,
- CONTENT_TYPE_APP_MSPPOINT_TEMPL, "pot" },
- { CONTENT_TYPE_STR_APP_MSWORD, CONTENT_TYPE_APP_MSWORD, "doc" },
- { CONTENT_TYPE_STR_APP_MSWORD_TEMPL, CONTENT_TYPE_APP_MSWORD_TEMPL,
- "dot" },
- { CONTENT_TYPE_STR_APP_SCHEDULE_CMB, CONTENT_TYPE_APP_SCHEDULE,
- "tmp" },
- { CONTENT_TYPE_STR_APP_SCHEDULE_EVT, CONTENT_TYPE_APP_SCHEDULE_EVT,
- "tmp" },
- { CONTENT_TYPE_STR_APP_SCHEDULE_FEVT,
- CONTENT_TYPE_APP_SCHEDULE_FORM_EVT, "tmp" },
- { CONTENT_TYPE_STR_APP_SCHEDULE_FTASK,
- CONTENT_TYPE_APP_SCHEDULE_FORM_TASK, "tmp" },
- { CONTENT_TYPE_STR_APP_SCHEDULE_TASK, CONTENT_TYPE_APP_SCHEDULE_TASK,
- "tmp" },
- { CONTENT_TYPE_STR_APP_STARCALC, CONTENT_TYPE_APP_STARCALC, "sdc" },
- { CONTENT_TYPE_STR_APP_STARCHART, CONTENT_TYPE_APP_STARCHART, "sds" },
- { CONTENT_TYPE_STR_APP_STARDRAW, CONTENT_TYPE_APP_STARDRAW, "sda" },
- { CONTENT_TYPE_STR_APP_STARHELP, CONTENT_TYPE_APP_STARHELP, "svh" },
- { CONTENT_TYPE_STR_APP_STARIMAGE, CONTENT_TYPE_APP_STARIMAGE, "sim" },
- { CONTENT_TYPE_STR_APP_STARIMPRESS, CONTENT_TYPE_APP_STARIMPRESS,
- "sdd" },
- { CONTENT_TYPE_STR_APP_STARMAIL_SDM, CONTENT_TYPE_APP_STARMAIL_SDM,
- "sdm" },
- { CONTENT_TYPE_STR_APP_STARMAIL_SMD, CONTENT_TYPE_APP_STARMAIL_SMD,
- "smd" },
- { CONTENT_TYPE_STR_APP_STARMATH, CONTENT_TYPE_APP_STARMATH, "smf" },
- { CONTENT_TYPE_STR_APP_STARWRITER, CONTENT_TYPE_APP_STARWRITER,
- "sdw" },
- { CONTENT_TYPE_STR_APP_STARWRITER_GLOB,
- CONTENT_TYPE_APP_STARWRITER_GLOB, "sgl" },
- { CONTENT_TYPE_STR_APP_CDE_CALENDAR_APP,
- CONTENT_TYPE_APP_CDE_CALENDAR_APP, "appt" },
- { CONTENT_TYPE_STR_APP_ZIP, CONTENT_TYPE_APP_ZIP, "zip" },
- { CONTENT_TYPE_STR_AUDIO_AIFF, CONTENT_TYPE_AUDIO_AIFF, "aif" },
- { CONTENT_TYPE_STR_AUDIO_BASIC, CONTENT_TYPE_AUDIO_BASIC, "au" },
- { CONTENT_TYPE_STR_AUDIO_MIDI, CONTENT_TYPE_AUDIO_MIDI, "mid" },
- { CONTENT_TYPE_STR_AUDIO_WAV, CONTENT_TYPE_AUDIO_WAV, "wav" },
- { CONTENT_TYPE_STR_IMAGE_GENERIC, CONTENT_TYPE_IMAGE_GENERIC, "tmp" },
- { CONTENT_TYPE_STR_IMAGE_GIF, CONTENT_TYPE_IMAGE_GIF, "gif" },
- { CONTENT_TYPE_STR_IMAGE_JPEG, CONTENT_TYPE_IMAGE_JPEG, "jpg" },
- { CONTENT_TYPE_STR_IMAGE_PCX, CONTENT_TYPE_IMAGE_PCX, "pcx" },
- { CONTENT_TYPE_STR_IMAGE_PNG, CONTENT_TYPE_IMAGE_PNG, "png" },
- { CONTENT_TYPE_STR_IMAGE_TIFF, CONTENT_TYPE_IMAGE_TIFF, "tif" },
- { CONTENT_TYPE_STR_IMAGE_BMP, CONTENT_TYPE_IMAGE_BMP, "bmp" },
- { CONTENT_TYPE_STR_INET_MSG_RFC822, CONTENT_TYPE_INET_MESSAGE_RFC822,
- "tmp" },
- { CONTENT_TYPE_STR_INET_MULTI_ALTERNATIVE,
- CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE, "tmp" },
- { CONTENT_TYPE_STR_INET_MULTI_DIGEST,
- CONTENT_TYPE_INET_MULTIPART_DIGEST, "tmp" },
- { CONTENT_TYPE_STR_INET_MULTI_MIXED,
- CONTENT_TYPE_INET_MULTIPART_MIXED, "tmp" },
- { CONTENT_TYPE_STR_INET_MULTI_PARALLEL,
- CONTENT_TYPE_INET_MULTIPART_PARALLEL, "tmp" },
- { CONTENT_TYPE_STR_INET_MULTI_RELATED,
- CONTENT_TYPE_INET_MULTIPART_RELATED, "tmp" },
- { CONTENT_TYPE_STR_TEXT_ICALENDAR, CONTENT_TYPE_TEXT_ICALENDAR,
- "ics" },
- { CONTENT_TYPE_STR_TEXT_HTML, CONTENT_TYPE_TEXT_HTML, "htm" },
- { CONTENT_TYPE_STR_TEXT_PLAIN, CONTENT_TYPE_TEXT_PLAIN, "txt" },
- { CONTENT_TYPE_STR_TEXT_XMLICALENDAR, CONTENT_TYPE_TEXT_XMLICALENDAR,
- "xcs" },
- { CONTENT_TYPE_STR_TEXT_URL, CONTENT_TYPE_TEXT_URL, "url" },
- { CONTENT_TYPE_STR_TEXT_VCALENDAR, CONTENT_TYPE_TEXT_VCALENDAR,
- "vcs" },
- { CONTENT_TYPE_STR_TEXT_VCARD, CONTENT_TYPE_TEXT_VCARD, "vcf" },
- { CONTENT_TYPE_STR_VIDEO_VDO, CONTENT_TYPE_VIDEO_VDO, "vdo" },
- { CONTENT_TYPE_STR_VIDEO_MSVIDEO, CONTENT_TYPE_VIDEO_MSVIDEO, "avi" },
- { CONTENT_TYPE_STR_X_STARMAIL, CONTENT_TYPE_X_STARMAIL, "smd" },
- { CONTENT_TYPE_STR_X_VRML, CONTENT_TYPE_X_VRML, "wrl" }
-};
-
-//============================================================================
-/** A mapping from type IDs to presentation resource IDs. Sorted by type ID.
- */
-USHORT const aStaticResourceIDMap[CONTENT_TYPE_LAST + 1]
- = { STR_SVT_MIMETYPE_APP_OCTSTREAM, // CONTENT_TYPE_UNKNOWN
- STR_SVT_MIMETYPE_APP_OCTSTREAM, // CONTENT_TYPE_APP_OCTSTREAM
- STR_SVT_MIMETYPE_APP_PDF, // CONTENT_TYPE_APP_PDF
- STR_SVT_MIMETYPE_APP_RTF, // CONTENT_TYPE_APP_RTF
- STR_SVT_MIMETYPE_APP_MSWORD, // CONTENT_TYPE_APP_MSWORD
- STR_SVT_MIMETYPE_APP_MSWORD, // CONTENT_TYPE_APP_MSWORD_TEMPL //@todo new presentation string?
- STR_SVT_MIMETYPE_APP_STARCALC, // CONTENT_TYPE_APP_STARCALC
- STR_SVT_MIMETYPE_APP_STARCHART, // CONTENT_TYPE_APP_STARCHART
- STR_SVT_MIMETYPE_APP_STARDRAW, // CONTENT_TYPE_APP_STARDRAW
- STR_SVT_MIMETYPE_APP_STARHELP, // CONTENT_TYPE_APP_STARHELP
- STR_SVT_MIMETYPE_APP_STARIMAGE, // CONTENT_TYPE_APP_STARIMAGE
- STR_SVT_MIMETYPE_APP_STARIMPRESS, // CONTENT_TYPE_APP_STARIMPRESS
- STR_SVT_MIMETYPE_APP_STARMATH, // CONTENT_TYPE_APP_STARMATH
- STR_SVT_MIMETYPE_APP_STARWRITER, // CONTENT_TYPE_APP_STARWRITER
- STR_SVT_MIMETYPE_APP_ZIP, // CONTENT_TYPE_APP_ZIP
- STR_SVT_MIMETYPE_AUDIO_AIFF, // CONTENT_TYPE_AUDIO_AIFF
- STR_SVT_MIMETYPE_AUDIO_BASIC, // CONTENT_TYPE_AUDIO_BASIC
- STR_SVT_MIMETYPE_AUDIO_MIDI, // CONTENT_TYPE_AUDIO_MIDI
- STR_SVT_MIMETYPE_AUDIO_WAV, // CONTENT_TYPE_AUDIO_WAV
- STR_SVT_MIMETYPE_IMAGE_GIF, // CONTENT_TYPE_IMAGE_GIF
- STR_SVT_MIMETYPE_IMAGE_JPEG, // CONTENT_TYPE_IMAGE_JPEG
- STR_SVT_MIMETYPE_IMAGE_PCX, // CONTENT_TYPE_IMAGE_PCX
- STR_SVT_MIMETYPE_IMAGE_PNG, // CONTENT_TYPE_IMAGE_PNG
- STR_SVT_MIMETYPE_IMAGE_TIFF, // CONTENT_TYPE_IMAGE_TIFF
- STR_SVT_MIMETYPE_IMAGE_BMP, // CONTENT_TYPE_IMAGE_BMP
- STR_SVT_MIMETYPE_TEXT_HTML, // CONTENT_TYPE_TEXT_HTML
- STR_SVT_MIMETYPE_TEXT_PLAIN, // CONTENT_TYPE_TEXT_PLAIN
- STR_SVT_MIMETYPE_TEXT_URL, // CONTENT_TYPE_TEXT_URL
- STR_SVT_MIMETYPE_TEXT_VCARD, // CONTENT_TYPE_TEXT_VCARD
- STR_SVT_MIMETYPE_VIDEO_VDO, // CONTENT_TYPE_VIDEO_VDO
- STR_SVT_MIMETYPE_VIDEO_MSVIDEO, // CONTENT_TYPE_VIDEO_MSVIDEO
- STR_SVT_MIMETYPE_CNT_MSG, // CONTENT_TYPE_X_CNT_MESSAGE
- STR_SVT_MIMETYPE_CNT_DOCUMENT, // CONTENT_TYPE_X_CNT_DOCUMENT
- STR_SVT_MIMETYPE_CNT_POP3BOX, // CONTENT_TYPE_X_CNT_POP3BOX
- STR_SVT_MIMETYPE_CNT_IMAPBOX, // CONTENT_TYPE_X_CNT_IMAPBOX
- STR_SVT_MIMETYPE_CNT_IMAPFLD, // CONTENT_TYPE_X_CNT_IMAPFOLDER
- STR_SVT_MIMETYPE_CNT_VIMBOX, // CONTENT_TYPE_X_CNT_VIMBOX
- STR_SVT_MIMETYPE_CNT_VIMINBOX, // CONTENT_TYPE_X_CNT_VIMINBOX
- STR_SVT_MIMETYPE_CNT_BBBOX, // CONTENT_TYPE_X_CNT_VIMBBOARDBOX
- STR_SVT_MIMETYPE_CNT_VIM_BB, // CONTENT_TYPE_X_CNT_VIMBBOARD
- STR_SVT_MIMETYPE_CNT_NEWSBOX, // CONTENT_TYPE_X_CNT_NEWSBOX
- STR_SVT_MIMETYPE_CNT_NEWSGRP, // CONTENT_TYPE_X_CNT_NEWSGROUP
- STR_SVT_MIMETYPE_CNT_OUTBOX, // CONTENT_TYPE_X_CNT_OUTBOX
- STR_SVT_MIMETYPE_CNT_FTPBOX, // CONTENT_TYPE_X_CNT_FTPBOX
- STR_SVT_MIMETYPE_CNT_FTPFLD, // CONTENT_TYPE_X_CNT_FTPFOLDER
- STR_SVT_MIMETYPE_CNT_FTPFILE, // CONTENT_TYPE_X_CNT_FTPFILE
- STR_SVT_MIMETYPE_CNT_FTPLINK, // CONTENT_TYPE_X_CNT_FTPLINK
- STR_SVT_MIMETYPE_CNT_HTTPBOX, // CONTENT_TYPE_X_CNT_HTTPBOX
- STR_SVT_MIMETYPE_CNT_FSYSBOX, // CONTENT_TYPE_X_CNT_FSYSBOX
- STR_SVT_MIMETYPE_CNT_FSYSFLD, // CONTENT_TYPE_X_CNT_FSYSFOLDER
- STR_SVT_MIMETYPE_CNT_FSYSFILE, // CONTENT_TYPE_X_CNT_FSYSFILE
- STR_SVT_MIMETYPE_CNT_FSYSURLFILE, // CONTENT_TYPE_X_CNT_FSYSURLFILE
- STR_SVT_MIMETYPE_CNT_PUBLBOX, // CONTENT_TYPE_X_CNT_PUBLISHBOX
- STR_SVT_MIMETYPE_CNT_SRCHBOX, // CONTENT_TYPE_X_CNT_SEARCHBOX
- STR_SVT_MIMETYPE_CNT_SUBSCRBOX, // CONTENT_TYPE_X_CNT_SUBSCRIBEBOX
- STR_SVT_MIMETYPE_CNT_BOOKMARK, // CONTENT_TYPE_X_CNT_BOOKMARK
- STR_SVT_MIMETYPE_CNT_CDF, // CONTENT_TYPE_X_CNT_CDF
- STR_SVT_MIMETYPE_CNT_CDFSUB, // CONTENT_TYPE_X_CNT_CDFSUB
- STR_SVT_MIMETYPE_CNT_CDFITEM, // CONTENT_TYPE_X_CNT_CDFITEM
- STR_SVT_MIMETYPE_CNT_TRASHBOX, // CONTENT_TYPE_X_CNT_TRASHBOX
- STR_SVT_MIMETYPE_CNT_TRASH, // CONTENT_TYPE_X_CNT_TRASH
- STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_X_STARMAIL
- STR_SVT_MIMETYPE_X_VRML, // CONTENT_TYPE_X_VRML
- STR_SVT_MIMETYPE_CNT_REMOV_VOL,
- // CONTENT_TYPE_X_CNT_REMOVEABLE_VOLUME
- STR_SVT_MIMETYPE_CNT_FIX_VOL, // CONTENT_TYPE_X_CNT_FIXED_VOLUME
- STR_SVT_MIMETYPE_CNT_REM_VOL, // CONTENT_TYPE_X_CNT_REMOTE_VOLUME
- STR_SVT_MIMETYPE_CNT_RAM_VOL, // CONTENT_TYPE_X_CNT_RAM_VOLUME
- STR_SVT_MIMETYPE_CNT_CDROM, // CONTENT_TYPE_X_CNT_CDROM_VOLUME
- STR_SVT_MIMETYPE_CNT_DISK_35, // CONTENT_TYPE_X_CNT_DISK_35
- STR_SVT_MIMETYPE_CNT_DISK_525, // CONTENT_TYPE_X_CNT_DISK_525
- STR_SVT_MIMETYPE_CNT_TAPEDRIVE, // CONTENT_TYPE_X_CNT_TAPEDRIVE
- STR_SVT_MIMETYPE_APP_GAL, // CONTENT_TYPE_APP_GALLERY
- STR_SVT_MIMETYPE_APP_GAL_THEME, // CONTENT_TYPE_APP_GALLERY_THEME
- STR_SVT_MIMETYPE_CNT_STARCHANNEL, // CONTENT_TYPE_X_CNT_STARCHANNEL
- STR_SVT_MIMETYPE_CNT_SEPARATOR, // CONTENT_TYPE_X_CNT_SEPARATOR
- STR_SVT_MIMETYPE_APP_STARW_GLOB, // CONTENT_TYPE_APP_STARWRITER_GLOB
- STR_SVT_MIMETYPE_APP_SDM, // CONTENT_TYPE_APP_STARMAIL_SDM
- STR_SVT_MIMETYPE_APP_SMD, // CONTENT_TYPE_APP_STARMAIL_SMD
- STR_SVT_MIMETYPE_APP_STARCALC, // CONTENT_TYPE_APP_VND_CALC
- STR_SVT_MIMETYPE_APP_STARCHART, // CONTENT_TYPE_APP_VND_CHART
- STR_SVT_MIMETYPE_APP_STARDRAW, // CONTENT_TYPE_APP_VND_DRAW
- STR_SVT_MIMETYPE_APP_STARIMAGE, // CONTENT_TYPE_APP_VND_IMAGE
- STR_SVT_MIMETYPE_APP_STARIMPRESS, // CONTENT_TYPE_APP_VND_IMPRESS
- STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_MAIL
- STR_SVT_MIMETYPE_APP_STARMATH, // CONTENT_TYPE_APP_VND_MATH
- STR_SVT_MIMETYPE_APP_STARWRITER, // CONTENT_TYPE_APP_VND_WRITER
- STR_SVT_MIMETYPE_APP_STARW_GLOB, // CONTENT_TYPE_APP_VND_WRITER_GLOBAL
- STR_SVT_MIMETYPE_APP_STARW_WEB, // CONTENT_TYPE_APP_VND_WRITER_WEB
- STR_SVT_MIMETYPE_SCHEDULE, // CONTENT_TYPE_APP_SCHEDULE
- STR_SVT_MIMETYPE_SCHEDULE_EVT, // CONTENT_TYPE_APP_SCHEDULE_EVT
- STR_SVT_MIMETYPE_SCHEDULE_TASK, // CONTENT_TYPE_APP_SCHEDULE_TASK
- STR_SVT_MIMETYPE_SCHEDULE_FEVT, // CONTENT_TYPE_APP_SCHEDULE_FORM_EVT
- STR_SVT_MIMETYPE_SCHEDULE_FTASK,
- // CONTENT_TYPE_APP_SCHEDULE_FORM_TASK
- STR_SVT_MIMETYPE_FRAMESET, // CONTENT_TYPE_APP_FRAMESET
- STR_SVT_MIMETYPE_MACRO, // CONTENT_TYPE_APP_MACRO
- STR_SVT_MIMETYPE_CNT_SFSYSFOLDER,
- // CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER
- STR_SVT_MIMETYPE_CNT_SFSYSFILE, // CONTENT_TYPE_X_CNT_FSYSSPECIALFILE
- STR_SVT_MIMETYPE_APP_TEMPLATE, // CONTENT_TYPE_APP_VND_TEMPLATE
- STR_SVT_MIMETYPE_IMAGE_GENERIC, // CONTENT_TYPE_IMAGE_GENERIC
- STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_NEWS
- STR_SVT_MIMETYPE_X_STARMAIL, // CONTENT_TYPE_APP_VND_OUTTRAY
- STR_SVT_MIMETYPE_TEXT_HTML, // CONTENT_TYPE_X_CNT_HTTPFILE
- STR_SVT_MIMETYPE_APP_MSEXCEL, // CONTENT_TYPE_APP_MSEXCEL
- STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL, // CONTENT_TYPE_APP_MSEXCEL_TEMPL
- STR_SVT_MIMETYPE_APP_MSPPOINT, // CONTENT_TYPE_APP_MSPPOINT
- STR_SVT_MIMETYPE_APP_MSPPOINT, // CONTENT_TYPE_APP_MSPPOINT_TEMPL //@todo new presentation string?
- STR_SVT_MIMETYPE_TEXT_VCALENDAR, // CONTENT_TYPE_TEXT_VCALENDAR
- STR_SVT_MIMETYPE_TEXT_ICALENDAR, // CONTENT_TYPE_TEXT_ICALENDAR
- STR_SVT_MIMETYPE_TEXT_XMLICALENDAR, // CONTENT_TYPE_TEXT_XMLICALENDAR
- STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP,
- // CONTENT_TYPE_APP_CDE_CALENDAR_APP
- STR_SVT_MIMETYPE_INET_MSG_RFC822, // CONTENT_TYPE_INET_MESSAGE_RFC822
- STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE,
- // CONTENT_TYPE_INET_MULTIPART_ALTERNATIVE
- STR_SVT_MIMETYPE_INET_MULTI_DIGEST,
- // CONTENT_TYPE_INET_MULTIPART_DIGEST
- STR_SVT_MIMETYPE_INET_MULTI_PARALLEL,
- // CONTENT_TYPE_INET_MULTIPART_PARALLEL
- STR_SVT_MIMETYPE_INET_MULTI_RELATED,
- // CONTENT_TYPE_INET_MULTIPART_RELATED
- STR_SVT_MIMETYPE_INET_MULTI_MIXED,
- // CONTENT_TYPE_INET_MULTIPART_MIXED
- STR_SVT_MIMETYPE_APP_IMPRESSPACKED,
- // CONTENT_TYPE_APP_VND_IMPRESSPACKED
- STR_SVT_MIMETYPE_APP_JAR, // CONTENT_TYPE_APP_JAR
- STR_SVT_MIMETYPE_APP_SXWRITER, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER
- STR_SVT_MIMETYPE_APP_SXCALC, // CONTENT_TYPE_APP_VND_SUN_XML_CALC
- STR_SVT_MIMETYPE_APP_SXIMPRESS, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS
- STR_SVT_MIMETYPE_APP_SXDRAW, // CONTENT_TYPE_APP_VND_SUN_XML_DRAW
- STR_SVT_MIMETYPE_APP_SXCHART, // CONTENT_TYPE_APP_VND_SUN_XML_CHART
- STR_SVT_MIMETYPE_APP_SXMATH, // CONTENT_TYPE_APP_VND_SUN_XML_MATH
- STR_SVT_MIMETYPE_APP_SXGLOBAL, // CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL
- STR_SVT_MIMETYPE_APP_SXIPACKED, // CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED
- };
-
-//============================================================================
-/** A mapping from extensions to type IDs. Sorted by extension.
- */
-MediaTypeEntry const aStaticExtensionMap[]
- = { { "aif", CONTENT_TYPE_AUDIO_AIFF, "" },
- { "aiff", CONTENT_TYPE_AUDIO_AIFF, "" },
- { "appt", CONTENT_TYPE_APP_CDE_CALENDAR_APP, "" },
- { "au", CONTENT_TYPE_AUDIO_BASIC, "" },
- { "avi", CONTENT_TYPE_VIDEO_MSVIDEO, "" },
- { "bmp", CONTENT_TYPE_IMAGE_BMP, "" },
- { "cgm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "doc", CONTENT_TYPE_APP_MSWORD, "" },
- { "dot", CONTENT_TYPE_APP_MSWORD_TEMPL, "" },
- { "dxf", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "eps", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "gal", CONTENT_TYPE_APP_GALLERY, "" },
- { "gif", CONTENT_TYPE_IMAGE_GIF, "" },
- { "htm", CONTENT_TYPE_TEXT_HTML, "" },
- { "html", CONTENT_TYPE_TEXT_HTML, "" },
- { "ics", CONTENT_TYPE_TEXT_ICALENDAR, "" },
- { "jar", CONTENT_TYPE_APP_JAR, "" },
- { "jpeg", CONTENT_TYPE_IMAGE_JPEG, "" },
- { "jpg", CONTENT_TYPE_IMAGE_JPEG, "" },
- { "met", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "mid", CONTENT_TYPE_AUDIO_MIDI, "" },
- { "midi", CONTENT_TYPE_AUDIO_MIDI, "" },
- { "pbm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "pcd", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "pct", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "pcx", CONTENT_TYPE_IMAGE_PCX, "" },
- { "pdf", CONTENT_TYPE_APP_PDF, "" },
- { "pgm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "png", CONTENT_TYPE_IMAGE_PNG, "" },
- { "pot", CONTENT_TYPE_APP_MSPPOINT_TEMPL, "" },
- { "ppm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "ppt", CONTENT_TYPE_APP_MSPPOINT, "" },
- { "psd", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "ras", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "rtf", CONTENT_TYPE_APP_RTF, "" },
- { "sda", CONTENT_TYPE_APP_VND_DRAW, "" },
- { "sdc", CONTENT_TYPE_APP_VND_CALC, "" },
- { "sdd", CONTENT_TYPE_APP_VND_IMPRESS, "" },
- { "sdm", CONTENT_TYPE_APP_VND_MAIL, "" },
- { "sdp", CONTENT_TYPE_APP_VND_IMPRESSPACKED, "" },
- { "sds", CONTENT_TYPE_APP_VND_CHART, "" },
- { "sdw", CONTENT_TYPE_APP_VND_WRITER, "" },
- { "sd~", CONTENT_TYPE_X_STARMAIL, "" },
- { "sfs", CONTENT_TYPE_APP_FRAMESET , "" },
- { "sgl", CONTENT_TYPE_APP_VND_WRITER_GLOBAL , "" },
- { "sim", CONTENT_TYPE_APP_VND_IMAGE, "" },
- { "smd", CONTENT_TYPE_APP_STARMAIL_SMD, "" }, //CONTENT_TYPE_X_STARMAIL
- { "smf", CONTENT_TYPE_APP_VND_MATH, "" },
- { "svh", CONTENT_TYPE_APP_STARHELP, "" },
- { "svm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "sxc", CONTENT_TYPE_APP_VND_SUN_XML_CALC, "" },
- { "sxd", CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "" },
- { "sxg", CONTENT_TYPE_APP_VND_SUN_XML_WRITER_GLOBAL, "" },
- { "sxi", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "" },
- { "sxm", CONTENT_TYPE_APP_VND_SUN_XML_MATH, "" },
- { "sxp", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESSPACKED, "" },
- { "sxs", CONTENT_TYPE_APP_VND_SUN_XML_CHART, "" },
- { "sxw", CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "" },
- { "tga", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "thm", CONTENT_TYPE_APP_GALLERY_THEME, "" },
- { "tif", CONTENT_TYPE_IMAGE_TIFF, "" },
- { "tiff", CONTENT_TYPE_IMAGE_TIFF, "" },
- { "txt", CONTENT_TYPE_TEXT_PLAIN, "" },
- { "url", CONTENT_TYPE_TEXT_URL, "" },
- { "vcf", CONTENT_TYPE_TEXT_VCARD, "" },
- { "vcs", CONTENT_TYPE_TEXT_VCALENDAR, "" },
- { "vdo", CONTENT_TYPE_VIDEO_VDO, "" },
- { "vor", CONTENT_TYPE_APP_VND_TEMPLATE, "" },
- { "wav", CONTENT_TYPE_AUDIO_WAV, "" },
- { "wmf", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "wrl", CONTENT_TYPE_X_VRML, "" },
- { "xbm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "xcs", CONTENT_TYPE_TEXT_XMLICALENDAR, "" },
- { "xls", CONTENT_TYPE_APP_MSEXCEL, "" },
- { "xlt", CONTENT_TYPE_APP_MSEXCEL_TEMPL, "" },
- { "xlw", CONTENT_TYPE_APP_MSEXCEL, "" },
- { "xpm", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "zip", CONTENT_TYPE_APP_ZIP, "" } };
-
-//============================================================================
-/** A mapping from presentations to type IDs. Sorted by presentations.
- */
-MediaTypeEntry const aStaticPresentationMap[]
- = { { "Binary Data", CONTENT_TYPE_APP_OCTSTREAM, "" },
- { "Bitmap", CONTENT_TYPE_IMAGE_BMP, "" },
- { "DOS Command File", CONTENT_TYPE_APP_OCTSTREAM, "" },
- { "Digital Video", CONTENT_TYPE_VIDEO_MSVIDEO, "" },
- { "Executable", CONTENT_TYPE_APP_OCTSTREAM, "" },
- { "Grafik", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "HTM", CONTENT_TYPE_TEXT_HTML, "" },
- { "HTML", CONTENT_TYPE_TEXT_HTML, "" },
- { "Hypertext", CONTENT_TYPE_TEXT_HTML, "" },
- { "Icon", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "Image File", CONTENT_TYPE_IMAGE_GENERIC, "" },
- { "MIDI", CONTENT_TYPE_AUDIO_MIDI, "" },
- { "Master Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" },
- { "Plain Text", CONTENT_TYPE_TEXT_PLAIN, "" },
- { "StarCalc", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarCalc 3.0", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarCalc 4.0", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarCalc 5.0", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarCalc Datei", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarCalc Document", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarCalc File", CONTENT_TYPE_APP_VND_CALC, "" },
- { "StarChart 3.0", CONTENT_TYPE_APP_VND_CHART, "" },
- { "StarChart 4.0", CONTENT_TYPE_APP_VND_CHART, "" },
- { "StarChart 5.0", CONTENT_TYPE_APP_VND_CHART, "" },
- { "StarChart Document", CONTENT_TYPE_APP_VND_CHART, "" },
- { "StarDraw 3.0", CONTENT_TYPE_APP_VND_DRAW, "" },
- { "StarDraw 5.0", CONTENT_TYPE_APP_VND_DRAW, "" },
- { "StarDraw", CONTENT_TYPE_APP_VND_DRAW, "" },
- { "StarDraw Document", CONTENT_TYPE_APP_VND_DRAW, "" },
- { "StarImpress 4.0", CONTENT_TYPE_APP_VND_IMPRESS, "" },
- { "StarImpress 5.0 (packed)", CONTENT_TYPE_APP_VND_IMPRESSPACKED, "" },
- { "StarImpress 5.0", CONTENT_TYPE_APP_VND_IMPRESS, "" },
- { "StarImpress Document", CONTENT_TYPE_APP_VND_IMPRESS, "" },
- { "StarMath 3.0", CONTENT_TYPE_APP_VND_MATH, "" },
- { "StarMath 4.0", CONTENT_TYPE_APP_VND_MATH, "" },
- { "StarMath 5.0", CONTENT_TYPE_APP_VND_MATH, "" },
- { "StarMath Document", CONTENT_TYPE_APP_VND_MATH, "" },
- { "StarMessage5", CONTENT_TYPE_APP_VND_MAIL, "" },
- { "StarOffice XML (Calc)", CONTENT_TYPE_APP_VND_SUN_XML_CALC, "" },
- { "StarOffice XML (Impress)", CONTENT_TYPE_APP_VND_SUN_XML_IMPRESS, "" },
- { "StarOffice XML (Draw)", CONTENT_TYPE_APP_VND_SUN_XML_DRAW, "" },
- { "StarOffice XML (Chart)", CONTENT_TYPE_APP_VND_SUN_XML_CHART, "" },
- { "StarOffice XML (Writer)", CONTENT_TYPE_APP_VND_SUN_XML_WRITER, "" },
- { "StarWriter", CONTENT_TYPE_APP_VND_WRITER, "" },
- { "StarWriter 3.0", CONTENT_TYPE_APP_VND_WRITER, "" },
- { "StarWriter 4.0", CONTENT_TYPE_APP_VND_WRITER, "" },
- { "StarWriter 5.0", CONTENT_TYPE_APP_VND_WRITER, "" },
- { "StarWriter Document", CONTENT_TYPE_APP_VND_WRITER, "" },
- { "StarWriter/Global 5.0", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" },
- { "StarWriter/Global Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" },
- { "StarWriter/Web 5.0", CONTENT_TYPE_APP_VND_WRITER_WEB, "" },
- { "StarWriterGlobal Document", CONTENT_TYPE_APP_VND_WRITER_GLOBAL, "" },
- { "StarWriterHtml Document", CONTENT_TYPE_APP_VND_WRITER_WEB, "" },
- { "UniformResourceLocator", CONTENT_TYPE_TEXT_URL, "" },
- { "text/html", CONTENT_TYPE_TEXT_HTML, "" } };
-
-}
-
-//============================================================================
-//
-// Registration
-//
-//============================================================================
-
-// static
-Registration * Registration::m_pRegistration = 0;
-
-//============================================================================
-Registration::~Registration()
-{
- {for (ULONG i = 0; i < m_aTypeIDMap.Count(); ++i)
- delete static_cast< TypeIDMapEntry * >(m_aTypeIDMap.GetObject(i));
- }
- m_aTypeIDMap.Clear();
- {for (USHORT i = 0; i < m_aTypeNameMap.Count(); ++i)
- delete static_cast< TypeNameMapEntry * >(m_aTypeNameMap.GetObject(i));
- }
- m_aTypeNameMap.Remove(USHORT(0), m_aTypeNameMap.Count());
- {for (USHORT i = 0; i < m_aExtensionMap.Count(); ++i)
- delete
- static_cast< ExtensionMapEntry * >(m_aExtensionMap.GetObject(i));
- }
- m_aExtensionMap.Remove(USHORT(0), m_aExtensionMap.Count());
-}
-
-//============================================================================
-// static
-TypeNameMapEntry * Registration::getExtensionEntry(UniString const &
- rTypeName)
-{
- if (m_pRegistration)
- {
- UniString aTheTypeName = rTypeName;
- aTheTypeName.ToLowerAscii();
- USHORT nPos;
- if (m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos))
- return static_cast< TypeNameMapEntry * >(m_pRegistration->
- m_aTypeNameMap.
- GetObject(nPos));
- }
- return 0;
-}
-
-//============================================================================
-// static
-INetContentType Registration::RegisterContentType(UniString const & rTypeName,
- UniString const &
- rPresentation,
- UniString const *
- pExtension,
- UniString const *
- pSystemFileType)
-{
- if (!m_pRegistration)
- m_pRegistration = new Registration;
-
- DBG_ASSERT(GetContentType(rTypeName) == CONTENT_TYPE_UNKNOWN,
- "Registration::RegisterContentType(): Already registered");
-
- INetContentType eTypeID
- = INetContentType(m_pRegistration->m_nNextDynamicID++);
- UniString aTheTypeName = rTypeName;
- aTheTypeName.ToLowerAscii();
-
- TypeIDMapEntry * pTypeIDMapEntry = new TypeIDMapEntry;
- pTypeIDMapEntry->m_aTypeName = aTheTypeName;
- pTypeIDMapEntry->m_aPresentation = rPresentation;
- if (pSystemFileType)
- pTypeIDMapEntry->m_aSystemFileType = *pSystemFileType;
- m_pRegistration->m_aTypeIDMap.Insert(eTypeID, pTypeIDMapEntry);
-
- TypeNameMapEntry * pTypeNameMapEntry = new TypeNameMapEntry(aTheTypeName);
- if (pExtension)
- pTypeNameMapEntry->m_aExtension = *pExtension;
- pTypeNameMapEntry->m_eTypeID = eTypeID;
- m_pRegistration->m_aTypeNameMap.Insert(pTypeNameMapEntry);
-
- if (pExtension)
- {
- ExtensionMapEntry * pExtensionMapEntry
- = new ExtensionMapEntry(*pExtension);
- pExtensionMapEntry->m_eTypeID = eTypeID;
- m_pRegistration->m_aExtensionMap.Insert(pExtensionMapEntry);
- }
-
- return eTypeID;
-}
-
-//============================================================================
-// static
-INetContentType Registration::GetContentType(UniString const & rTypeName)
-{
- if (!m_pRegistration)
- m_pRegistration = new Registration;
-
- UniString aTheTypeName = rTypeName;
- aTheTypeName.ToLowerAscii();
- USHORT nPos;
- return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ?
- static_cast< TypeNameMapEntry * >(m_pRegistration->
- m_aTypeNameMap.
- GetObject(nPos))->
- m_eTypeID :
- CONTENT_TYPE_UNKNOWN;
-}
-
-//============================================================================
-// static
-UniString Registration::GetContentType(INetContentType eTypeID)
-{
- if (!m_pRegistration)
- m_pRegistration = new Registration;
-
- TypeIDMapEntry * pEntry
- = static_cast< TypeIDMapEntry * >(m_pRegistration->
- m_aTypeIDMap.Get(eTypeID));
- return pEntry ? pEntry->m_aTypeName : UniString();
-}
-
-//============================================================================
-// static
-UniString Registration::GetPresentation(INetContentType eTypeID)
-{
- if (!m_pRegistration)
- m_pRegistration = new Registration;
-
- TypeIDMapEntry * pEntry
- = static_cast< TypeIDMapEntry * >(m_pRegistration->
- m_aTypeIDMap.Get(eTypeID));
- return pEntry ? pEntry->m_aPresentation : UniString();
-}
-
-//============================================================================
-// static
-UniString Registration::GetExtension(UniString const & rTypeName)
-{
- if (!m_pRegistration)
- m_pRegistration = new Registration;
-
- UniString aTheTypeName = rTypeName;
- aTheTypeName.ToLowerAscii();
- USHORT nPos;
- return m_pRegistration->m_aTypeNameMap.Seek_Entry(&aTheTypeName, &nPos) ?
- static_cast< TypeNameMapEntry * >(m_pRegistration->
- m_aTypeNameMap.
- GetObject(nPos))->
- m_aExtension :
- UniString();
-}
-
-//============================================================================
-// static
-INetContentType Registration::GetContentType4Extension(UniString const &
- rExtension)
-{
- if (!m_pRegistration)
- m_pRegistration = new Registration;
-
- USHORT nPos;
- return m_pRegistration->
- m_aExtensionMap.
- Seek_Entry(const_cast< UniString * >(&rExtension),
- &nPos) ?
- static_cast< ExtensionMapEntry * >(m_pRegistration->
- m_aExtensionMap.
- GetObject(nPos))->
- m_eTypeID :
- CONTENT_TYPE_UNKNOWN;
-}
-
-//============================================================================
-//
-// seekEntry
-//
-//============================================================================
-
-namespace unnamed_svtools_inettype {
-
-MediaTypeEntry const * seekEntry(UniString const & rTypeName,
- MediaTypeEntry const * pMap, sal_Size nSize)
-{
-#if defined DBG_UTIL || defined INETTYPE_DEBUG
- static bool bChecked = false;
- if (!bChecked)
- {
- for (sal_Size i = 0; i < nSize - 1; ++i)
- DBG_ASSERT(pMap[i].m_pTypeName < pMap[i + 1].m_pTypeName,
- "seekEntry(): Bad map");
- bChecked = true;
- }
-#endif // DBG_UTIL, INETTYPE_DEBUG
-
- sal_Size nLow = 0;
- sal_Size nHigh = nSize;
- while (nLow != nHigh)
- {
- sal_Size nMiddle = (nLow + nHigh) / 2;
- MediaTypeEntry const * pEntry = pMap + nMiddle;
- switch (rTypeName.CompareIgnoreCaseToAscii(pEntry->m_pTypeName))
- {
- case COMPARE_LESS:
- nHigh = nMiddle;
- break;
-
- case COMPARE_EQUAL:
- return pEntry;
-
- case COMPARE_GREATER:
- nLow = nMiddle + 1;
- break;
- }
- }
- return 0;
-}
-
-}
-
-//============================================================================
-//
-// INetContentTypes
-//
-//============================================================================
-
-//static
-void INetContentTypes::Uninitialize()
-{
- Registration::deinitialize();
-}
-
-//============================================================================
-//static
-INetContentType INetContentTypes::RegisterContentType(UniString const &
- rTypeName,
- UniString const &
- rPresentation,
- UniString const *
- pExtension,
- UniString const *
- pSystemFileType)
-{
- INetContentType eTypeID = GetContentType(rTypeName);
- if (eTypeID == CONTENT_TYPE_UNKNOWN)
- eTypeID = Registration::RegisterContentType(rTypeName, rPresentation,
- pExtension,
- pSystemFileType);
- else if (eTypeID > CONTENT_TYPE_LAST)
- {
- TypeIDMapEntry * pTypeEntry = Registration::getEntry(eTypeID);
- if (pTypeEntry)
- {
- if (rPresentation.Len() != 0)
- pTypeEntry->m_aPresentation = rPresentation;
- if (pSystemFileType)
- pTypeEntry->m_aSystemFileType = *pSystemFileType;
- }
- if (pExtension)
- {
- TypeNameMapEntry * pEntry
- = Registration::getExtensionEntry(rTypeName);
- if (pEntry)
- pEntry->m_aExtension = *pExtension;
- }
- }
- return eTypeID;
-}
-
-//============================================================================
-// static
-INetContentType INetContentTypes::GetContentType(UniString const & rTypeName)
-{
- UniString aType;
- UniString aSubType;
- if (parse(rTypeName, aType, aSubType))
- {
- aType += '/';
- aType += aSubType;
- MediaTypeEntry const * pEntry = seekEntry(aType, aStaticTypeNameMap,
- CONTENT_TYPE_LAST + 1);
- return pEntry ? pEntry->m_eTypeID :
- Registration::GetContentType(aType);
- }
- else
- return
- rTypeName.EqualsIgnoreCaseAscii(CONTENT_TYPE_STR_X_STARMAIL) ?
- CONTENT_TYPE_X_STARMAIL : CONTENT_TYPE_UNKNOWN;
- // the content type "x-starmail" has no sub type
-}
-
-//============================================================================
-//static
-UniString INetContentTypes::GetContentType(INetContentType eTypeID)
-{
- static sal_Char const * aMap[CONTENT_TYPE_LAST + 1];
- static bool bInitialized = false;
- if (!bInitialized)
- {
- for (sal_Size i = 0; i <= CONTENT_TYPE_LAST; ++i)
- aMap[aStaticTypeNameMap[i].m_eTypeID]
- = aStaticTypeNameMap[i].m_pTypeName;
- aMap[CONTENT_TYPE_UNKNOWN] = CONTENT_TYPE_STR_APP_OCTSTREAM;
- aMap[CONTENT_TYPE_TEXT_PLAIN] = CONTENT_TYPE_STR_TEXT_PLAIN
- "; charset=iso-8859-1";
- bInitialized = true;
- }
-
- UniString aTypeName = eTypeID <= CONTENT_TYPE_LAST ?
- UniString::CreateFromAscii(aMap[eTypeID]) :
- Registration::GetContentType(eTypeID);
- if (aTypeName.Len() == 0)
- {
- DBG_ERROR("INetContentTypes::GetContentType(): Bad ID");
- return
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(
- CONTENT_TYPE_STR_APP_OCTSTREAM));
- }
- return aTypeName;
-}
-
-//============================================================================
-//static
-UniString INetContentTypes::GetPresentation(INetContentType eTypeID,
- const ::com::sun::star::lang::Locale& aLocale)
-{
- USHORT nResID = USHORT();
- if (eTypeID <= CONTENT_TYPE_LAST)
- nResID = aStaticResourceIDMap[eTypeID];
- else
- {
- UniString aPresentation = Registration::GetPresentation(eTypeID);
- if (aPresentation.Len() == 0)
- nResID = STR_SVT_MIMETYPE_APP_OCTSTREAM;
- else
- return aPresentation;
- }
- return SvtSimpleResId(nResID, aLocale);
-}
-
-//============================================================================
-//static
-UniString INetContentTypes::GetExtension(UniString const & rTypeName)
-{
- MediaTypeEntry const * pEntry = seekEntry(rTypeName, aStaticTypeNameMap,
- CONTENT_TYPE_LAST + 1);
- if (pEntry)
- return UniString::CreateFromAscii(pEntry->m_pExtension);
-
- UniString aExtension = Registration::GetExtension(rTypeName);
- if (aExtension.Len() != 0)
- return aExtension;
- // special handling of text types, which come in uncounted variations:
- return rTypeName.EqualsIgnoreCaseAscii("text", 0,
- RTL_CONSTASCII_LENGTH("text")) ?
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("txt")) :
- UniString::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("tmp"));
-}
-
-//============================================================================
-//static
-INetContentType INetContentTypes::GetContentType4Extension(UniString const &
- rExtension)
-{
- MediaTypeEntry const * pEntry = seekEntry(rExtension, aStaticExtensionMap,
- sizeof aStaticExtensionMap
- / sizeof (MediaTypeEntry));
- if (pEntry)
- return pEntry->m_eTypeID;
- INetContentType eTypeID
- = Registration::GetContentType4Extension(rExtension);
- return eTypeID == CONTENT_TYPE_UNKNOWN ? CONTENT_TYPE_APP_OCTSTREAM :
- eTypeID;
-}
-
-//============================================================================
-//static
-INetContentType INetContentTypes::GetContentTypeFromURL(UniString const &
- rURL)
-{
- INetContentType eTypeID = CONTENT_TYPE_UNKNOWN;
- UniString aToken = rURL.GetToken(0, ':');
- if (aToken.Len() != 0)
- {
- if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_FILE))
- if (rURL.GetChar(rURL.Len() - 1) == '/') // folder
- if (rURL.Len() > RTL_CONSTASCII_LENGTH("file:///"))
- if (WildCard(UniString(RTL_CONSTASCII_USTRINGPARAM(
- "*/{*}/"))).
- Matches(rURL)) // special folder
- eTypeID = CONTENT_TYPE_X_CNT_FSYSSPECIALFOLDER;
- else
- // drive? -> "file:///?|/"
- if (rURL.Len() == 11
- && rURL.GetChar(rURL.Len() - 2) == '|')
- {
- // Drives need further processing, because of
- // dynamic type according to underlying volume,
- // which cannot be determined here.
- }
- else // normal folder
- eTypeID = CONTENT_TYPE_X_CNT_FSYSFOLDER;
- else // file system root
- eTypeID = CONTENT_TYPE_X_CNT_FSYSBOX;
- else // file
- {
- //@@@
- }
- else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTP)
- || aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_HTTPS))
- eTypeID = CONTENT_TYPE_TEXT_HTML;
- else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_PRIVATE))
- {
- UniString aSecondPart = rURL.GetToken(1, ':');
- aToken = aSecondPart.GetToken(0, '/');
- if (aToken.EqualsAscii(INETTYPE_URL_SUB_FACTORY))
- {
- aToken = aSecondPart.GetToken(1, '/');
- if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SWRITER))
- {
- aToken = aSecondPart.GetToken(2, '/');
- eTypeID = aToken.EqualsAscii(INETTYPE_URL_SSSUB_WEB) ?
- CONTENT_TYPE_APP_VND_WRITER_WEB :
- aToken.EqualsAscii(INETTYPE_URL_SSSUB_GLOB) ?
- CONTENT_TYPE_APP_VND_WRITER_GLOBAL :
- CONTENT_TYPE_APP_VND_WRITER;
- }
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCALC))
- eTypeID = CONTENT_TYPE_APP_VND_CALC;
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SDRAW))
- eTypeID = CONTENT_TYPE_APP_VND_DRAW;
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMPRESS))
- eTypeID = CONTENT_TYPE_APP_VND_IMPRESS;
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SCHART))
- eTypeID = CONTENT_TYPE_APP_VND_CHART;
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SIMAGE))
- eTypeID = CONTENT_TYPE_APP_VND_IMAGE;
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SMATH))
- eTypeID = CONTENT_TYPE_APP_VND_MATH;
- else if (aToken.EqualsAscii(INETTYPE_URL_SSUB_FRAMESET))
- eTypeID = CONTENT_TYPE_APP_FRAMESET;
- }
- else if (aToken.EqualsAscii(INETTYPE_URL_SUB_HELPID))
- eTypeID = CONTENT_TYPE_APP_STARHELP;
- }
- else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_COMPONENT))
- {
- aToken = rURL.GetToken(1, ':'); // aToken now equals ss / *
- aToken = aToken.GetToken(0, '/');
- if (aToken.EqualsAscii(INETTYPE_URL_SSUB_SS))
- eTypeID = rURL.SearchAscii(INETTYPE_URL_SCHED_CMB)
- == STRING_NOTFOUND
- && rURL.SearchAscii(INETTYPE_URL_SCHED_FORM)
- == STRING_NOTFOUND ?
- CONTENT_TYPE_APP_SCHEDULE :
- rURL.SearchAscii(INETTYPE_URL_SCHED_TASK)
- == STRING_NOTFOUND ?
- CONTENT_TYPE_APP_SCHEDULE_EVT :
- CONTENT_TYPE_APP_SCHEDULE_TASK;
- }
- else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MAILTO))
- eTypeID = CONTENT_TYPE_APP_VND_OUTTRAY;
- else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_MACRO))
- eTypeID = CONTENT_TYPE_APP_MACRO;
- else if (aToken.EqualsIgnoreCaseAscii(INETTYPE_URL_PROT_DATA))
- {
- UniString aSecondPart = rURL.GetToken(1, ':');
- aToken = aSecondPart.GetToken(0, ',');
- eTypeID = GetContentType(aToken);
- }
- }
- if (eTypeID == CONTENT_TYPE_UNKNOWN)
- {
- UniString aExtension;
- if (GetExtensionFromURL(rURL, aExtension))
- eTypeID = GetContentType4Extension(aExtension);
- }
- return eTypeID;
-}
-
-//============================================================================
-//static
-bool INetContentTypes::GetExtensionFromURL(UniString const & rURL,
- UniString & rExtension)
-{
- xub_StrLen nSlashPos = 0;
- xub_StrLen i = 0;
- while (i != STRING_NOTFOUND)
- {
- nSlashPos = i;
- i = rURL.Search('/', i + 1);
- }
- if (nSlashPos != 0)
- {
- xub_StrLen nLastDotPos = i = rURL.Search('.', nSlashPos);
- while (i != STRING_NOTFOUND)
- {
- nLastDotPos = i;
- i = rURL.Search('.', i + 1);
- }
- if (nLastDotPos != STRING_NOTFOUND)
- rExtension = rURL.Copy(nLastDotPos + 1);
- return true;
- }
- return false;
-}
-
-//============================================================================
-//static
-INetContentType INetContentTypes::MapStringToContentType(UniString const &
- rPresentation)
-{
- MediaTypeEntry const * pEntry = seekEntry(rPresentation,
- aStaticPresentationMap,
- sizeof aStaticPresentationMap
- / sizeof (MediaTypeEntry));
- return pEntry ? pEntry->m_eTypeID : CONTENT_TYPE_UNKNOWN;
-}
-
-//============================================================================
-// static
-bool INetContentTypes::parse(ByteString const & rMediaType,
- ByteString & rType, ByteString & rSubType,
- INetContentTypeParameterList * pParameters)
-{
- sal_Char const * p = rMediaType.GetBuffer();
- sal_Char const * pEnd = p + rMediaType.Len();
-
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- sal_Char const * pToken = p;
- bool bDowncase = false;
- while (p != pEnd && INetMIME::isTokenChar(*p))
- {
- bDowncase = bDowncase || INetMIME::isUpperCase(*p);
- ++p;
- }
- if (p == pToken)
- return false;
- rType = ByteString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken));
- if (bDowncase)
- rType.ToLowerAscii();
-
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- if (p == pEnd || *p++ != '/')
- return false;
-
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- pToken = p;
- bDowncase = false;
- while (p != pEnd && INetMIME::isTokenChar(*p))
- {
- bDowncase = bDowncase || INetMIME::isUpperCase(*p);
- ++p;
- }
- if (p == pToken)
- return false;
- rSubType = ByteString(
- pToken, sal::static_int_cast< xub_StrLen >(p - pToken));
- if (bDowncase)
- rSubType.ToLowerAscii();
-
- return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd;
-}
-
-//============================================================================
-// static
-bool INetContentTypes::parse(UniString const & rMediaType,
- UniString & rType, UniString & rSubType,
- INetContentTypeParameterList * pParameters)
-{
- sal_Unicode const * p = rMediaType.GetBuffer();
- sal_Unicode const * pEnd = p + rMediaType.Len();
-
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- sal_Unicode const * pToken = p;
- bool bDowncase = false;
- while (p != pEnd && INetMIME::isTokenChar(*p))
- {
- bDowncase = bDowncase || INetMIME::isUpperCase(*p);
- ++p;
- }
- if (p == pToken)
- return false;
- rType = UniString(pToken, sal::static_int_cast< xub_StrLen >(p - pToken));
- if (bDowncase)
- rType.ToLowerAscii();
-
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- if (p == pEnd || *p++ != '/')
- return false;
-
- p = INetMIME::skipLinearWhiteSpaceComment(p, pEnd);
- pToken = p;
- bDowncase = false;
- while (p != pEnd && INetMIME::isTokenChar(*p))
- {
- bDowncase = bDowncase || INetMIME::isUpperCase(*p);
- ++p;
- }
- if (p == pToken)
- return false;
- rSubType = UniString(
- pToken, sal::static_int_cast< xub_StrLen >(p - pToken));
- if (bDowncase)
- rSubType.ToLowerAscii();
-
- return INetMIME::scanParameters(p, pEnd, pParameters) == pEnd;
-}
-
-//============================================================================
-// static
-ByteString INetContentTypes::appendUSASCIIParameter(ByteString const &
- rMediaType,
- ByteString const &
- rAttribute,
- ByteString const & rValue)
-{
- ByteString aResult = rMediaType;
- aResult.Append(RTL_CONSTASCII_STRINGPARAM("; "));
- aResult += rAttribute;
- aResult += '=';
- bool bQuote = false;
- for (xub_StrLen i = 0; i < rValue.Len(); ++i)
- {
- // When the value contains any ' characters, use a quoted string
- // instead of a token, in order to avoid confusion with RFC 2231
- // extensions:
- sal_uInt32 nChar = sal_uChar(rValue.GetChar(i));
- DBG_ASSERT(INetMIME::isUSASCII(nChar),
- "INetContentTypes::appendUSASCIIParameter(): Bad value");
- if (!INetMIME::isTokenChar(nChar) || nChar == '\'')
- {
- bQuote = true;
- break;
- }
- }
- if (bQuote)
- {
- aResult += '"';
- for (xub_StrLen i = 0; i < rValue.Len(); ++i)
- {
- // Escape LF as well as CR to avoid confusion with line folding:
- sal_uInt32 nChar = sal_uChar(rValue.GetChar(i));
- DBG_ASSERT(INetMIME::isUSASCII(nChar),
- "INetContentTypes::appendUSASCIIParameter():"
- " Bad value");
- switch (nChar)
- {
- case 0x0A: // LF
- case 0x0D: // CR
- case '"':
- case '\\':
- aResult += '\\';
- default:
- aResult += static_cast< char >(nChar);
- break;
- }
- }
- aResult += '"';
- }
- else
- aResult += rValue;
- return aResult;
-}
-
-//============================================================================
-// static
-UniString INetContentTypes::appendUSASCIIParameter(UniString const &
- rMediaType,
- UniString const &
- rAttribute,
- UniString const & rValue)
-{
- UniString aResult = rMediaType;
- aResult.AppendAscii(RTL_CONSTASCII_STRINGPARAM("; "));
- aResult += rAttribute;
- aResult += '=';
- bool bQuote = false;
- for (xub_StrLen i = 0; i < rValue.Len(); ++i)
- {
- // When the value contains any ' characters, use a quoted string
- // instead of a token, in order to avoid confusion with RFC 2231
- // extensions:
- sal_uInt32 nChar = rValue.GetChar(i);
- DBG_ASSERT(INetMIME::isUSASCII(nChar),
- "INetContentTypes::appendUSASCIIParameter(): Bad value");
- if (!INetMIME::isTokenChar(nChar) || nChar == '\'')
- {
- bQuote = true;
- break;
- }
- }
- if (bQuote)
- {
- aResult += '"';
- for (xub_StrLen i = 0; i < rValue.Len(); ++i)
- {
- // Escape LF as well as CR to avoid confusion with line folding:
- sal_uInt32 nChar = rValue.GetChar(i);
- DBG_ASSERT(INetMIME::isUSASCII(nChar),
- "INetContentTypes::appendUSASCIIParameter():"
- " Bad value");
- switch (nChar)
- {
- case 0x0A: // LF
- case 0x0D: // CR
- case '"':
- case '\\':
- aResult += '\\';
- default:
- aResult += sal_Unicode(nChar);
- break;
- }
- }
- aResult += '"';
- }
- else
- aResult += rValue;
- return aResult;
-}
-
diff --git a/svtools/source/misc1/iniadrtk.cxx b/svtools/source/misc1/iniadrtk.cxx
deleted file mode 100644
index 8d4c929fc988..000000000000
--- a/svtools/source/misc1/iniadrtk.cxx
+++ /dev/null
@@ -1,76 +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: iniadrtk.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <tools/string.hxx>
-#include <iniadrtk.hxx>
-
-//============================================================================
-//
-// class SfxIniManagerAddressEntry
-//
-//============================================================================
-
-// static
-String SfxIniManagerAddressEntry::get(const String & rAddress,
- AddressToken eToken)
-{
- String aToken;
- USHORT i = 0, nTxt = 0;
-
- while ( i < rAddress.Len() )
- {
- while ( i < rAddress.Len() && rAddress.GetChar(i) != '#' )
- {
- if ( rAddress.GetChar(i) == '\\' )
- i++;
- aToken += rAddress.GetChar(i++);
- }
-
- // rAddress[i] == '#' oder am Ende, also eine Position weiter gehen
- i++;
-
- if ( eToken == (AddressToken)nTxt )
- break;
- else if ( i >= rAddress.Len() )
- {
- aToken.Erase();
- break;
- }
- else
- {
- aToken.Erase();
- nTxt++;
- }
- }
- return aToken;
-}
-
diff --git a/svtools/source/misc1/lngmisc.cxx b/svtools/source/misc1/lngmisc.cxx
deleted file mode 100644
index e00540af1ab1..000000000000
--- a/svtools/source/misc1/lngmisc.cxx
+++ /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: lngmisc.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include <lngmisc.hxx>
-#include <tools/solar.h>
-#include <tools/string.hxx>
-#include <tools/debug.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/ustring.hxx>
-
-
-using namespace rtl;
-
-namespace linguistic
-{
-
-///////////////////////////////////////////////////////////////////////////
-
-INT32 GetNumControlChars( const OUString &rTxt )
-{
- INT32 nCnt = 0;
- INT32 nLen = rTxt.getLength();
- for (INT32 i = 0; i < nLen; ++i)
- {
- if (IsControlChar( rTxt[i] ))
- ++nCnt;
- }
- return nCnt;
-}
-
-
-BOOL RemoveHyphens( OUString &rTxt )
-{
- BOOL bModified = FALSE;
- if (HasHyphens( rTxt ))
- {
- String aTmp( rTxt );
- aTmp.EraseAllChars( SVT_SOFT_HYPHEN );
- aTmp.EraseAllChars( SVT_HARD_HYPHEN );
- rTxt = aTmp;
- bModified = TRUE;
- }
- return bModified;
-}
-
-
-BOOL RemoveControlChars( OUString &rTxt )
-{
- BOOL bModified = FALSE;
- INT32 nCtrlChars = GetNumControlChars( rTxt );
- if (nCtrlChars)
- {
- INT32 nLen = rTxt.getLength();
- INT32 nSize = nLen - nCtrlChars;
- OUStringBuffer aBuf( nSize );
- aBuf.setLength( nSize );
- INT32 nCnt = 0;
- for (INT32 i = 0; i < nLen; ++i)
- {
- sal_Unicode cChar = rTxt[i];
- if (!IsControlChar( cChar ))
- {
- DBG_ASSERT( nCnt < nSize, "index out of range" );
- aBuf.setCharAt( nCnt++, cChar );
- }
- }
- DBG_ASSERT( nCnt == nSize, "wrong size" );
- rTxt = aBuf.makeStringAndClear();
- bModified = TRUE;
- }
- return bModified;
-}
-
-
-// non breaking field character
-#define CH_TXTATR_INWORD ((sal_Char) 0x02)
-
-BOOL ReplaceControlChars( rtl::OUString &rTxt, sal_Char /*aRplcChar*/ )
-{
- // the resulting string looks like this:
- // 1. non breaking field characters get removed
- // 2. remaining control characters will be replaced by ' '
-
- BOOL bModified = FALSE;
- INT32 nCtrlChars = GetNumControlChars( rTxt );
- if (nCtrlChars)
- {
- INT32 nLen = rTxt.getLength();
- OUStringBuffer aBuf( nLen );
- INT32 nCnt = 0;
- for (INT32 i = 0; i < nLen; ++i)
- {
- sal_Unicode cChar = rTxt[i];
- if (CH_TXTATR_INWORD != cChar)
- {
- if (IsControlChar( cChar ))
- cChar = ' ';
- DBG_ASSERT( nCnt < nLen, "index out of range" );
- aBuf.setCharAt( nCnt++, cChar );
- }
- }
- aBuf.setLength( nCnt );
- rTxt = aBuf.makeStringAndClear();
- bModified = TRUE;
- }
- return bModified;
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-} // namespace linguistic
-
diff --git a/svtools/source/misc1/makefile.mk b/svtools/source/misc1/makefile.mk
deleted file mode 100644
index dd143ea4e972..000000000000
--- a/svtools/source/misc1/makefile.mk
+++ /dev/null
@@ -1,69 +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: makefile.mk,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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJNAME=svtools
-TARGET=misc1
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-EXCEPTIONSFILES=\
- $(SLO)$/fstathelper.obj \
- $(SLO)$/folderrestriction.obj \
- $(SLO)$/strmadpt.obj \
- $(SLO)$/svtdata.obj
-
-SLOFILES=\
- $(EXCEPTIONSFILES) \
- $(SLO)$/adrparse.obj \
- $(SLO)$/filenotation.obj \
- $(SLO)$/inethist.obj \
- $(SLO)$/inettype.obj \
- $(SLO)$/iniadrtk.obj \
- $(SLO)$/lngmisc.obj \
- $(SLO)$/PasswordHelper.obj
-
-SRS1NAME=$(TARGET)
-SRC1FILES=\
- mediatyp.src
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
-
-
-
diff --git a/svtools/source/misc1/mediatyp.src b/svtools/source/misc1/mediatyp.src
deleted file mode 100644
index c7acdf8efc45..000000000000
--- a/svtools/source/misc1/mediatyp.src
+++ /dev/null
@@ -1,610 +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: mediatyp.src,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.
- *
- ************************************************************************/
-//============================================================================
-//
-// Internet Media Type Presentations
-//
-// $Author: rt $ $Date: 2008-04-10 21:44:39 $ $Revision: 1.7 $
-//============================================================================
-
-#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
-#endif
-
-String STR_SVT_MIMETYPE_APP_OCTSTREAM
-{
- Text [ en-US ] = "Binary file" ;
-};
-
-String STR_SVT_MIMETYPE_APP_PDF
-{
- Text [ en-US ] = "PDF file" ;
-};
-
-String STR_SVT_MIMETYPE_APP_RTF
-{
- Text [ en-US ] = "RTF File" ;
-};
-
-String STR_SVT_MIMETYPE_APP_MSWORD
-{
- Text [ en-US ] = "MS-Word document" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARCALC
-{
- Text [ en-US ] = "%PRODUCTNAME Spreadsheet" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARCHART
-{
- Text [ en-US ] = "%PRODUCTNAME Chart" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARDRAW
-{
- Text [ en-US ] = "%PRODUCTNAME Drawing" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARIMAGE
-{
- Text [ en-US ] = "%PRODUCTNAME Image" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARMATH
-{
- Text [ en-US ] = "%PRODUCTNAME Formula" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARWRITER
-{
- Text [ en-US ] = "%PRODUCTNAME Text" ;
-};
-
-String STR_SVT_MIMETYPE_APP_ZIP
-{
- Text [ en-US ] = "ZIP file" ;
-};
-
-String STR_SVT_MIMETYPE_APP_JAR
-{
- Text [ en-US ] = "JAR file" ;
-};
-
-String STR_SVT_MIMETYPE_AUDIO_AIFF
-{
- Text [ en-US ] = "Audio file" ;
-};
-
-String STR_SVT_MIMETYPE_AUDIO_BASIC
-{
- Text [ en-US ] = "Audio file" ;
-};
-
-String STR_SVT_MIMETYPE_AUDIO_MIDI
-{
- Text [ en-US ] = "Audio file" ;
-};
-
-String STR_SVT_MIMETYPE_AUDIO_WAV
-{
- Text [ en-US ] = "Audio file" ;
-};
-
-String STR_SVT_MIMETYPE_IMAGE_GIF
-{
- Text [ en-US ] = "Graphics" ;
-};
-
-String STR_SVT_MIMETYPE_IMAGE_JPEG
-{
- Text [ en-US ] = "Graphics" ;
-};
-
-String STR_SVT_MIMETYPE_IMAGE_PCX
-{
- Text [ en-US ] = "Graphics" ;
-};
-
-String STR_SVT_MIMETYPE_IMAGE_BMP
-{
- Text [ en-US ] = "Bitmap" ;
-};
-
-String STR_SVT_MIMETYPE_TEXT_HTML
-{
- Text [ en-US ] = "HTML document" ;
-};
-
-String STR_SVT_MIMETYPE_TEXT_PLAIN
-{
- Text [ en-US ] = "Text file" ;
-};
-
-String STR_SVT_MIMETYPE_TEXT_URL
-{
- Text [ en-US ] = "Bookmark" ;
-};
-
-String STR_SVT_MIMETYPE_TEXT_VCARD
-{
- Text [ en-US ] = "vCard file" ;
-};
-
-String STR_SVT_MIMETYPE_VIDEO_VDO
-{
- Text [ en-US ] = "Video file" ;
-};
-
-String STR_SVT_MIMETYPE_VIDEO_MSVIDEO
-{
- Text [ en-US ] = "Video file" ;
-};
-
-String STR_SVT_MIMETYPE_X_STARMAIL
-{
- Text [ en-US ] = "Message" ;
-};
-
-String STR_SVT_MIMETYPE_X_VRML
-{
- Text [ en-US ] = "VRML file" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARIMPRESS
-{
- Text [ en-US ] = "%PRODUCTNAME Presentation" ;
-};
-
-String STR_SVT_MIMETYPE_APP_IMPRESSPACKED
-{
- Text [ en-US ] = "%PRODUCTNAME Presentation (packed)";
-};
-
-String STR_SVT_MIMETYPE_APP_STARHELP
-{
- Text [ en-US ] = "%PRODUCTNAME Help" ;
-};
-
-
-String STR_SVT_MIMETYPE_CNT_MSG
-{
- Text [ en-US ] = "Message" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_DOCUMENT
-{
- Text [ en-US ] = "Document" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_POP3BOX
-{
- Text [ en-US ] = "POP3 Account" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_IMAPBOX
-{
- Text [ en-US ] = "IMAP Account" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_IMAPFLD
-{
- Text [ en-US ] = "Folder" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_VIMBOX
-{
- Text [ en-US ] = "VIM Account" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_VIMINBOX
-{
- Text [ en-US ] = "Inbox" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_BBBOX
-{
- Text [ en-US ] = "Newsgroups" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_VIM_BB
-{
- Text [ en-US ] = "Newsgroup" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_NEWSBOX
-{
- Text [ en-US ] = "News" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_NEWSGRP
-{
- Text [ en-US ] = "Group" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_OUTBOX
-{
- Text [ en-US ] = "Outbox" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FTPBOX
-{
- Text [ en-US ] = "FTP Account" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FTPFLD
-{
- Text [ en-US ] = "FTP Folder" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FTPFILE
-{
- Text [ en-US ] = "FTP File" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FTPLINK
-{
- Text [ en-US ] = "FTP Link" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_HTTPBOX
-{
- Text [ en-US ] = "HTTP" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FSYSBOX
-{
- Text [ en-US ] = "Workplace" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FSYSFLD
-{
- Text [ en-US ] = "Folder" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FSYSFILE
-{
- Text [ en-US ] = "File" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FSYSURLFILE
-{
- Text [ en-US ] = "Link" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_PUBLBOX
-{
- Text [ en-US ] = "Project" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_SRCHBOX
-{
- Text [ en-US ] = "Find" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_SUBSCRBOX
-{
- Text [ en-US ] = "Subscriptions" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_BOOKMARK
-{
- Text [ en-US ] = "Bookmark subscription" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_CDF
-{
- Text [ en-US ] = "Channel subscription" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_CDFSUB
-{
- Text [ en-US ] = "Channel subscription" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_CDFITEM
-{
- Text [ en-US ] = "Channel subscription" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_STARCHANNEL
-{
- Text [ en-US ] = "StarChannel" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_TRASHBOX
-{
- Text [ en-US ] = "Recycle Bin" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_TRASH
-{
- Text [ en-US ] = "Deleted Object" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_REMOV_VOL
-{
- Text [ en-US ] = "Local drive" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_FIX_VOL
-{
- Text [ en-US ] = "Local drive" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_REM_VOL
-{
- Text [ en-US ] = "Network connection" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_RAM_VOL
-{
- Text [ en-US ] = "RAM Disk" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_CDROM
-{
- Text [ en-US ] = "CD-ROM drive" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_DISK_35
-{
- Text [ en-US ] = "3.5'' Disk" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_DISK_525
-{
- Text [ en-US ] = "5.25'' Disk" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_TAPEDRIVE
-{
- Text [ en-US ] = "Tape drive" ;
-};
-
-String STR_SVT_MIMETYPE_APP_GAL
-{
- Text [ en-US ] = "Gallery";
-};
-
-String STR_SVT_MIMETYPE_APP_GAL_THEME
-{
- Text [ en-US ] = "Gallery theme" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_SEPARATOR
-{
- Text = "CntMenuView-Separator" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARW_GLOB
-{
- Text [ en-US ] = "%PRODUCTNAME Master Document" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SDM
-{
- Text [ en-US ] = "Message" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SMD
-{
- Text [ en-US ] = "Message" ;
-};
-
-String STR_SVT_MIMETYPE_APP_STARW_WEB
-{
- Text [ en-US ] = "%PRODUCTNAME Writer/Web" ;
-};
-
-String STR_SVT_MIMETYPE_SCHEDULE
-{
- Text [ en-US ] = "Tasks & Events" ;
-};
-
-String STR_SVT_MIMETYPE_SCHEDULE_EVT
-{
- Text [ en-US ] = "%PRODUCTNAME Events View" ;
-};
-
-String STR_SVT_MIMETYPE_SCHEDULE_TASK
-{
- Text [ en-US ] = "%PRODUCTNAME Task View" ;
-};
-
-String STR_SVT_MIMETYPE_SCHEDULE_FEVT
-{
- Text [ en-US ] = "%PRODUCTNAME Event" ;
-};
-
-String STR_SVT_MIMETYPE_SCHEDULE_FTASK
-{
- Text [ en-US ] = "%PRODUCTNAME Task" ;
-};
-
-String STR_SVT_MIMETYPE_FRAMESET
-{
- Text [ en-US ] = "Frameset Document" ;
-};
-
-String STR_SVT_MIMETYPE_MACRO
-{
- Text [ en-US ] = "Macro file" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_SFSYSFOLDER
-{
- Text [ en-US ] = "System folder" ;
-};
-
-String STR_SVT_MIMETYPE_CNT_SFSYSFILE
-{
- Text [ en-US ] = "System object" ;
-};
-
-String STR_SVT_MIMETYPE_APP_TEMPLATE
-{
- Text [ en-US ] = "%PRODUCTNAME Template";
-};
-
-String STR_SVT_MIMETYPE_IMAGE_GENERIC
-{
- Text [ en-US ] = "Graphics";
-};
-
-String STR_SVT_MIMETYPE_APP_MSEXCEL
-{
- Text [ en-US ] = "MS Excel document" ;
-};
-
-String STR_SVT_MIMETYPE_APP_MSEXCEL_TEMPL
-{
- Text [ en-US ] = "MS Excel Template" ;
-};
-
-String STR_SVT_MIMETYPE_APP_MSPPOINT
-{
- Text [ en-US ] = "MS PowerPoint document" ;
-};
-
-String STR_SVT_MIMETYPE_TEXT_VCALENDAR
-{
- Text [ en-US ] = "vCalendar-file" ;
-};
-
-String STR_SVT_MIMETYPE_TEXT_ICALENDAR
-{
- Text [ en-US ] = "iCalendar-File";
-};
-
-String STR_SVT_MIMETYPE_TEXT_XMLICALENDAR
-{
- Text [ en-US ] = "XML-iCalendar-File";
-};
-
-String STR_SVT_MIMETYPE_TEXT_CDE_CALENDAR_APP
-{
- Text [ en-US ] = "CDE-Calendar-File";
-};
-
-String STR_SVT_MIMETYPE_INET_MSG_RFC822
-{
- Text [ en-US ] = "message/rfc822" ;
-};
-
-String STR_SVT_MIMETYPE_INET_MULTI_ALTERNATIVE
-{
- Text [ en-US ] = "multipart/alternative" ;
-};
-
-String STR_SVT_MIMETYPE_INET_MULTI_DIGEST
-{
- Text [ en-US ] = "multipart/digest" ;
-};
-
-String STR_SVT_MIMETYPE_INET_MULTI_PARALLEL
-{
- Text [ en-US ] = "multipart/parallel" ;
-};
-
-String STR_SVT_MIMETYPE_INET_MULTI_RELATED
-{
- Text [ en-US ] = "multipart/related" ;
-};
-
-String STR_SVT_MIMETYPE_INET_MULTI_MIXED
-{
- Text [ en-US ] = "multipart/mixed" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXCALC
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Spreadsheet" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXCHART
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Chart" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXDRAW
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Drawing" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXMATH
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Formula" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXWRITER
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Text Document" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXIMPRESS
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Presentation" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXGLOBAL
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Master Document" ;
-};
-
-String STR_SVT_MIMETYPE_APP_SXIPACKED
-{
- Text [ en-US ] = "%PRODUCTNAME %PRODUCTXMLFILEFORMATVERSION Presentation (packed)" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/svtools/source/misc1/strmadpt.cxx b/svtools/source/misc1/strmadpt.cxx
deleted file mode 100644
index 4c4835609b7b..000000000000
--- a/svtools/source/misc1/strmadpt.cxx
+++ /dev/null
@@ -1,1048 +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: strmadpt.cxx,v $
- * $Revision: 1.5.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <functional> // needed under Solaris when including <algorithm>...
-
-#include <algorithm>
-#include <limits>
-#include <set>
-#include <rtl/alloc.h>
-#include <rtl/memory.h>
-#include <instrm.hxx>
-#include <outstrm.hxx>
-#include <strmadpt.hxx>
-
-using namespace com::sun::star;
-
-//============================================================================
-class SvDataPipe_Impl
-{
-public:
- enum SeekResult { SEEK_BEFORE_MARKED, SEEK_OK, SEEK_PAST_END };
-
-private:
- struct Page
- {
- Page * m_pPrev;
- Page * m_pNext;
- sal_Int8 * m_pStart;
- sal_Int8 * m_pRead;
- sal_Int8 * m_pEnd;
- sal_uInt32 m_nOffset;
- sal_Int8 m_aBuffer[1];
- };
-
- std::multiset< sal_uInt32 > m_aMarks;
- Page * m_pFirstPage;
- Page * m_pReadPage;
- Page * m_pWritePage;
- sal_Int8 * m_pReadBuffer;
- sal_uInt32 m_nReadBufferSize;
- sal_uInt32 m_nReadBufferFilled;
- sal_uInt32 m_nPageSize;
- sal_uInt32 m_nMinPages;
- sal_uInt32 m_nMaxPages;
- sal_uInt32 m_nPages;
- bool m_bEOF;
-
- bool remove(Page * pPage);
-
-public:
- inline SvDataPipe_Impl(sal_uInt32 nThePageSize = 1000,
- sal_uInt32 nTheMinPages = 100,
- sal_uInt32 nTheMaxPages
- = std::numeric_limits< sal_uInt32 >::max());
-
- ~SvDataPipe_Impl();
-
- inline void setReadBuffer(sal_Int8 * pBuffer, sal_uInt32 nSize);
-
- sal_uInt32 read();
-
- void clearReadBuffer() { m_pReadBuffer = 0; }
-
- sal_uInt32 write(sal_Int8 const * pBuffer, sal_uInt32 nSize);
-
- void setEOF() { m_bEOF = true; }
-
- inline bool isEOF() const;
-
- bool addMark(sal_uInt32 nPosition);
-
- bool removeMark(sal_uInt32 nPosition);
-
- inline sal_uInt32 getReadPosition() const;
-
- SeekResult setReadPosition(sal_uInt32 nPosition);
-};
-
-SvDataPipe_Impl::SvDataPipe_Impl(sal_uInt32 nThePageSize,
- sal_uInt32 nTheMinPages,
- sal_uInt32 nTheMaxPages):
- m_pFirstPage(0),
- m_pReadPage(0),
- m_pWritePage(0),
- m_pReadBuffer(0),
- m_nPageSize(std::min< sal_uInt32 >(
- std::max< sal_uInt32 >(nThePageSize, sal_uInt32(1)),
- sal_uInt32(std::numeric_limits< sal_uInt32 >::max()
- - sizeof (Page) + 1))),
- m_nMinPages(std::max< sal_uInt32 >(nTheMinPages, sal_uInt32(1))),
- m_nMaxPages(std::max< sal_uInt32 >(nTheMaxPages, sal_uInt32(1))),
- m_nPages(0),
- m_bEOF(false)
-{}
-
-inline void SvDataPipe_Impl::setReadBuffer(sal_Int8 * pBuffer,
- sal_uInt32 nSize)
-{
- m_pReadBuffer = pBuffer;
- m_nReadBufferSize = nSize;
- m_nReadBufferFilled = 0;
-}
-
-inline bool SvDataPipe_Impl::isEOF() const
-{
- return m_bEOF && m_pReadPage == m_pWritePage
- && (!m_pReadPage || m_pReadPage->m_pRead == m_pReadPage->m_pEnd);
-}
-
-inline sal_uInt32 SvDataPipe_Impl::getReadPosition() const
-{
- return m_pReadPage == 0 ? 0 :
- m_pReadPage->m_nOffset
- + (m_pReadPage->m_pRead
- - m_pReadPage->m_aBuffer);
-}
-
-//============================================================================
-//
-// SvOutputStreamOpenLockBytes
-//
-//============================================================================
-
-TYPEINIT1(SvOutputStreamOpenLockBytes, SvOpenLockBytes)
-
-//============================================================================
-// virtual
-ErrCode SvOutputStreamOpenLockBytes::ReadAt(ULONG, void *, ULONG, ULONG *)
- const
-{
- return ERRCODE_IO_CANTREAD;
-}
-
-//============================================================================
-// virtual
-ErrCode SvOutputStreamOpenLockBytes::WriteAt(ULONG nPos, void const * pBuffer,
- ULONG nCount, ULONG * pWritten)
-{
- if (nPos != m_nPosition)
- return ERRCODE_IO_CANTWRITE;
- return FillAppend(pBuffer, nCount, pWritten);
-}
-
-//============================================================================
-// virtual
-ErrCode SvOutputStreamOpenLockBytes::Flush() const
-{
- if (!m_xOutputStream.is())
- return ERRCODE_IO_CANTWRITE;
- try
- {
- m_xOutputStream->flush();
- }
- catch (io::IOException)
- {
- return ERRCODE_IO_CANTWRITE;
- }
- return ERRCODE_NONE;
-}
-
-//============================================================================
-// virtual
-ErrCode SvOutputStreamOpenLockBytes::SetSize(ULONG)
-{
- return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//============================================================================
-// virtual
-ErrCode SvOutputStreamOpenLockBytes::Stat(SvLockBytesStat * pStat,
- SvLockBytesStatFlag) const
-{
- if (pStat)
- pStat->nSize = m_nPosition;
- return ERRCODE_NONE;
-}
-
-//============================================================================
-// virtual
-ErrCode SvOutputStreamOpenLockBytes::FillAppend(void const * pBuffer,
- ULONG nCount,
- ULONG * pWritten)
-{
- if (!m_xOutputStream.is())
- return ERRCODE_IO_CANTWRITE;
- if (nCount > 0
- && nCount > std::numeric_limits< ULONG >::max() - m_nPosition)
- {
- nCount = std::numeric_limits< ULONG >::max() - m_nPosition;
- if (nCount == 0)
- return ERRCODE_IO_CANTWRITE;
- }
- try
- {
- m_xOutputStream->
- writeBytes(uno::Sequence< sal_Int8 >(
- static_cast< sal_Int8 const * >(pBuffer), nCount));
- }
- catch (io::IOException)
- {
- return ERRCODE_IO_CANTWRITE;
- }
- m_nPosition += nCount;
- if (pWritten)
- *pWritten = nCount;
- return ERRCODE_NONE;
-}
-
-//============================================================================
-// virtual
-ULONG SvOutputStreamOpenLockBytes::Tell() const
-{
- return m_nPosition;
-}
-
-//============================================================================
-// virtual
-ULONG SvOutputStreamOpenLockBytes::Seek(ULONG)
-{
- return m_nPosition;
-}
-
-//============================================================================
-// virtual
-void SvOutputStreamOpenLockBytes::Terminate()
-{
- if (m_xOutputStream.is())
- try
- {
- m_xOutputStream->closeOutput();
- }
- catch (io::IOException) {}
-}
-
-//============================================================================
-//
-// SvLockBytesInputStream
-//
-//============================================================================
-
-// virtual
-uno::Any SAL_CALL SvLockBytesInputStream::queryInterface(uno::Type const &
- rType)
- throw (uno::RuntimeException)
-{
- uno::Any
- aReturn(cppu::queryInterface(rType,
- static_cast< io::XInputStream * >(this),
- static_cast< io::XSeekable * >(this)));
- return aReturn.hasValue() ? aReturn : OWeakObject::queryInterface(rType);
-}
-
-//============================================================================
-// virtual
-void SAL_CALL SvLockBytesInputStream::acquire() throw ()
-{
- OWeakObject::acquire();
-}
-
-//============================================================================
-// virtual
-void SAL_CALL SvLockBytesInputStream::release() throw ()
-{
- OWeakObject::release();
-}
-
-//============================================================================
-// virtual
-sal_Int32 SAL_CALL
-SvLockBytesInputStream::readBytes(uno::Sequence< sal_Int8 > & rData,
- sal_Int32 nBytesToRead)
- throw (io::IOException, uno::RuntimeException)
-{
- OSL_ASSERT(m_nPosition >= 0);
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- if (
- nBytesToRead < 0 ||
- (
- static_cast<sal_uInt64>(m_nPosition) > SAL_MAX_SIZE &&
- nBytesToRead > 0
- )
- )
- {
- throw io::IOException();
- }
- rData.realloc(nBytesToRead);
- sal_Int32 nSize = 0;
- while (nSize < nBytesToRead)
- {
- sal_Size nCount;
- ErrCode nError = m_xLockBytes->ReadAt(static_cast<sal_Size>(
- m_nPosition),
- rData.getArray() + nSize,
- nBytesToRead - nSize, &nCount);
- if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING)
- throw io::IOException();
- m_nPosition += nCount;
- nSize += nCount;
- if (nError == ERRCODE_NONE && nCount == 0)
- break;
- }
- rData.realloc(nSize);
- return nSize;
-}
-
-//============================================================================
-// virtual
-sal_Int32 SAL_CALL
-SvLockBytesInputStream::readSomeBytes(uno::Sequence< sal_Int8 > & rData,
- sal_Int32 nMaxBytesToRead)
- throw (io::IOException, uno::RuntimeException)
-{
- OSL_ASSERT(m_nPosition >= 0);
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- if (static_cast<sal_uInt64>(m_nPosition) > SAL_MAX_SIZE
- && nMaxBytesToRead > 0)
- throw io::IOException();
- rData.realloc(nMaxBytesToRead);
- sal_Size nCount = 0;
- if (nMaxBytesToRead > 0)
- {
- ErrCode nError;
- do
- {
- nError = m_xLockBytes->ReadAt(static_cast<sal_Size>(m_nPosition),
- rData.getArray(),
- nMaxBytesToRead < 0 ?
- 0 : nMaxBytesToRead,
- &nCount);
- if (nError != ERRCODE_NONE && nError != ERRCODE_IO_PENDING)
- throw io::IOException();
- m_nPosition += nCount;
- }
- while (nCount == 0 && nError == ERRCODE_IO_PENDING);
- }
- rData.realloc(sal_Int32(nCount));
- return sal_Int32(nCount);
-}
-
-//============================================================================
-// virtual
-void SAL_CALL SvLockBytesInputStream::skipBytes(sal_Int32 nBytesToSkip)
- throw (io::IOException, uno::RuntimeException)
-{
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- if (nBytesToSkip < 0)
- throw io::IOException();
- if (nBytesToSkip > SAL_MAX_INT64 - m_nPosition)
- throw io::BufferSizeExceededException();
- m_nPosition += nBytesToSkip;
-}
-
-//============================================================================
-// virtual
-sal_Int32 SAL_CALL SvLockBytesInputStream::available()
- throw (io::IOException, uno::RuntimeException)
-{
- OSL_ASSERT(m_nPosition >= 0);
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- SvLockBytesStat aStat;
- if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE)
- throw io::IOException();
- return aStat.nSize <= static_cast<sal_uInt64>(m_nPosition) ?
- 0 :
- static_cast<sal_Size>(aStat.nSize - m_nPosition) <=
- static_cast<sal_uInt32>(SAL_MAX_INT32) ?
- static_cast<sal_Int32>(aStat.nSize - m_nPosition) :
- SAL_MAX_INT32;
-}
-
-//============================================================================
-// virtual
-void SAL_CALL SvLockBytesInputStream::closeInput()
- throw (io::IOException, uno::RuntimeException)
-{
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- m_xLockBytes = 0;
-}
-
-//============================================================================
-// virtual
-void SAL_CALL SvLockBytesInputStream::seek(sal_Int64 nLocation)
- throw (lang::IllegalArgumentException, io::IOException,
- uno::RuntimeException)
-{
- if (nLocation < 0)
- throw lang::IllegalArgumentException();
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- m_nPosition = nLocation;
-}
-
-//============================================================================
-// virtual
-sal_Int64 SAL_CALL SvLockBytesInputStream::getPosition()
- throw (io::IOException, uno::RuntimeException)
-{
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- return m_nPosition;
-}
-
-//============================================================================
-// virtual
-sal_Int64 SAL_CALL SvLockBytesInputStream::getLength()
- throw (io::IOException, uno::RuntimeException)
-{
- if (!m_xLockBytes.Is())
- throw io::NotConnectedException();
- SvLockBytesStat aStat;
- if (m_xLockBytes->Stat(&aStat, SVSTATFLAG_DEFAULT) != ERRCODE_NONE)
- throw io::IOException();
-#if SAL_TYPES_SIZEOFPOINTER > 4 // avoid warnings if sal_Size < sal_Int64
- if (aStat.nSize > static_cast<sal_uInt64>(SAL_MAX_INT64))
- throw io::IOException();
-#endif
- return aStat.nSize;
-}
-
-//============================================================================
-//
-// SvInputStream
-//
-//============================================================================
-
-bool SvInputStream::open()
-{
- if (GetError() != ERRCODE_NONE)
- return false;
- if (!(m_xSeekable.is() || m_pPipe))
- {
- if (!m_xStream.is())
- {
- SetError(ERRCODE_IO_INVALIDDEVICE);
- return false;
- }
- m_xSeekable
- = uno::Reference< io::XSeekable >(m_xStream, uno::UNO_QUERY);
- if (!m_xSeekable.is())
- m_pPipe = new SvDataPipe_Impl;
- }
- return true;
-}
-
-//============================================================================
-// virtual
-ULONG SvInputStream::GetData(void * pData, ULONG nSize)
-{
- if (!open())
- {
- SetError(ERRCODE_IO_CANTREAD);
- return 0;
- }
- sal_uInt32 nRead = 0;
- if (m_xSeekable.is())
- {
- if (m_nSeekedFrom != STREAM_SEEK_TO_END)
- {
- try
- {
- m_xSeekable->seek(m_nSeekedFrom);
- }
- catch (io::IOException)
- {
- SetError(ERRCODE_IO_CANTREAD);
- return 0;
- }
- m_nSeekedFrom = STREAM_SEEK_TO_END;
- }
- for (;;)
- {
- sal_Int32 nRemain
- = sal_Int32(
- std::min(ULONG(nSize - nRead),
- ULONG(std::numeric_limits< sal_Int32 >::max())));
- if (nRemain == 0)
- break;
- uno::Sequence< sal_Int8 > aBuffer;
- sal_Int32 nCount;
- try
- {
- nCount = m_xStream->readBytes(aBuffer, nRemain);
- }
- catch (io::IOException)
- {
- SetError(ERRCODE_IO_CANTREAD);
- return nRead;
- }
- rtl_copyMemory(static_cast< sal_Int8 * >(pData) + nRead,
- aBuffer.getConstArray(), sal_uInt32(nCount));
- nRead += nCount;
- if (nCount < nRemain)
- break;
- }
- }
- else
- {
- if (m_nSeekedFrom != STREAM_SEEK_TO_END)
- {
- SetError(ERRCODE_IO_CANTREAD);
- return 0;
- }
- m_pPipe->setReadBuffer(static_cast< sal_Int8 * >(pData), nSize);
- nRead = m_pPipe->read();
- if (nRead < nSize && !m_pPipe->isEOF())
- for (;;)
- {
- sal_Int32 nRemain
- = sal_Int32(
- std::min(
- ULONG(nSize - nRead),
- ULONG(std::numeric_limits< sal_Int32 >::max())));
- if (nRemain == 0)
- break;
- uno::Sequence< sal_Int8 > aBuffer;
- sal_Int32 nCount;
- try
- {
- nCount = m_xStream->readBytes(aBuffer, nRemain);
- }
- catch (io::IOException)
- {
- SetError(ERRCODE_IO_CANTREAD);
- break;
- }
- m_pPipe->write(aBuffer.getConstArray(), sal_uInt32(nCount));
- nRead += m_pPipe->read();
- if (nCount < nRemain)
- {
- m_xStream->closeInput();
- m_pPipe->setEOF();
- break;
- }
- }
- m_pPipe->clearReadBuffer();
- }
- return nRead;
-}
-
-//============================================================================
-// virtual
-ULONG SvInputStream::PutData(void const *, ULONG)
-{
- SetError(ERRCODE_IO_NOTSUPPORTED);
- return 0;
-}
-
-//============================================================================
-// virtual
-void SvInputStream::FlushData()
-{}
-
-//============================================================================
-// virtual
-ULONG SvInputStream::SeekPos(ULONG nPos)
-{
- if (open())
- {
- if (nPos == STREAM_SEEK_TO_END)
- {
- if (m_nSeekedFrom == STREAM_SEEK_TO_END)
- {
- if (m_xSeekable.is())
- try
- {
- sal_Int64 nLength = m_xSeekable->getLength();
- OSL_ASSERT(nLength >= 0);
- if (static_cast<sal_uInt64>(nLength)
- < STREAM_SEEK_TO_END)
- {
- m_nSeekedFrom = Tell();
- return ULONG(nLength);
- }
- }
- catch (io::IOException) {}
- else
- return Tell(); //@@@
- }
- else
- return Tell();
- }
- else if (nPos == m_nSeekedFrom)
- {
- m_nSeekedFrom = STREAM_SEEK_TO_END;
- return nPos;
- }
- else if (m_xSeekable.is())
- try
- {
- m_xSeekable->seek(nPos);
- m_nSeekedFrom = STREAM_SEEK_TO_END;
- return nPos;
- }
- catch (io::IOException) {}
- else if (m_pPipe->setReadPosition(nPos) == SvDataPipe_Impl::SEEK_OK)
- {
- m_nSeekedFrom = STREAM_SEEK_TO_END;
- return nPos;
- }
- }
- SetError(ERRCODE_IO_CANTSEEK);
- return Tell();
-}
-
-//============================================================================
-// virtual
-void SvInputStream::SetSize(ULONG)
-{
- SetError(ERRCODE_IO_NOTSUPPORTED);
-}
-
-//============================================================================
-SvInputStream::SvInputStream(
- com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
- const &
- rTheStream):
- m_xStream(rTheStream),
- m_pPipe(0),
- m_nSeekedFrom(STREAM_SEEK_TO_END)
-{
- SetBufferSize(0);
-}
-
-//============================================================================
-// virtual
-SvInputStream::~SvInputStream()
-{
- if (m_xStream.is())
- try
- {
- m_xStream->closeInput();
- }
- catch (io::IOException) {}
- delete m_pPipe;
-}
-
-//============================================================================
-// virtual
-USHORT SvInputStream::IsA() const
-{
- return 0;
-}
-
-//============================================================================
-// virtual
-void SvInputStream::AddMark(ULONG nPos)
-{
- if (open() && m_pPipe)
- m_pPipe->addMark(nPos);
-}
-
-//============================================================================
-// virtual
-void SvInputStream::RemoveMark(ULONG nPos)
-{
- if (open() && m_pPipe)
- m_pPipe->removeMark(nPos);
-}
-
-//============================================================================
-//
-// SvOutputStream
-//
-//============================================================================
-
-// virtual
-ULONG SvOutputStream::GetData(void *, ULONG)
-{
- SetError(ERRCODE_IO_NOTSUPPORTED);
- return 0;
-}
-
-//============================================================================
-// virtual
-ULONG SvOutputStream::PutData(void const * pData, ULONG nSize)
-{
- if (!m_xStream.is())
- {
- SetError(ERRCODE_IO_CANTWRITE);
- return 0;
- }
- ULONG nWritten = 0;
- for (;;)
- {
- sal_Int32 nRemain
- = sal_Int32(
- std::min(ULONG(nSize - nWritten),
- ULONG(std::numeric_limits< sal_Int32 >::max())));
- if (nRemain == 0)
- break;
- try
- {
- m_xStream->writeBytes(uno::Sequence< sal_Int8 >(
- static_cast<const sal_Int8 * >(pData)
- + nWritten,
- nRemain));
- }
- catch (io::IOException)
- {
- SetError(ERRCODE_IO_CANTWRITE);
- break;
- }
- nWritten += nRemain;
- }
- return nWritten;
-}
-
-//============================================================================
-// virtual
-ULONG SvOutputStream::SeekPos(ULONG)
-{
- SetError(ERRCODE_IO_NOTSUPPORTED);
- return 0;
-}
-
-//============================================================================
-// virtual
-void SvOutputStream::FlushData()
-{
- if (!m_xStream.is())
- {
- SetError(ERRCODE_IO_INVALIDDEVICE);
- return;
- }
- try
- {
- m_xStream->flush();
- }
- catch (io::IOException) {}
-}
-
-//============================================================================
-// virtual
-void SvOutputStream::SetSize(ULONG)
-{
- SetError(ERRCODE_IO_NOTSUPPORTED);
-}
-
-//============================================================================
-SvOutputStream::SvOutputStream(uno::Reference< io::XOutputStream > const &
- rTheStream):
- m_xStream(rTheStream)
-{
- SetBufferSize(0);
-}
-
-//============================================================================
-// virtual
-SvOutputStream::~SvOutputStream()
-{
- if (m_xStream.is())
- try
- {
- m_xStream->closeOutput();
- }
- catch (io::IOException) {}
-}
-
-//============================================================================
-// virtual
-USHORT SvOutputStream::IsA() const
-{
- return 0;
-}
-
-//============================================================================
-//
-// SvDataPipe_Impl
-//
-//============================================================================
-
-bool SvDataPipe_Impl::remove(Page * pPage)
-{
- if (
- pPage != m_pFirstPage ||
- m_pReadPage == m_pFirstPage ||
- (
- !m_aMarks.empty() &&
- *m_aMarks.begin() < m_pFirstPage->m_nOffset + m_nPageSize
- )
- )
- {
- return false;
- }
-
- m_pFirstPage = m_pFirstPage->m_pNext;
-
- if (m_nPages <= m_nMinPages)
- return true;
-
- pPage->m_pPrev->m_pNext = pPage->m_pNext;
- pPage->m_pNext->m_pPrev = pPage->m_pPrev;
- rtl_freeMemory(pPage);
- --m_nPages;
-
- return true;
-}
-
-//============================================================================
-SvDataPipe_Impl::~SvDataPipe_Impl()
-{
- if (m_pFirstPage != 0)
- for (Page * pPage = m_pFirstPage;;)
- {
- Page * pNext = pPage->m_pNext;
- rtl_freeMemory(pPage);
- if (pNext == m_pFirstPage)
- break;
- pPage = pNext;
- }
-}
-
-//============================================================================
-sal_uInt32 SvDataPipe_Impl::read()
-{
- if (m_pReadBuffer == 0 || m_nReadBufferSize == 0 || m_pReadPage == 0)
- return 0;
-
- sal_uInt32 nSize = m_nReadBufferSize;
- sal_uInt32 nRemain = m_nReadBufferSize - m_nReadBufferFilled;
-
- m_pReadBuffer += m_nReadBufferFilled;
- m_nReadBufferSize -= m_nReadBufferFilled;
- m_nReadBufferFilled = 0;
-
- while (nRemain > 0)
- {
- sal_uInt32 nBlock = std::min(sal_uInt32(m_pReadPage->m_pEnd
- - m_pReadPage->m_pRead),
- nRemain);
- rtl_copyMemory(m_pReadBuffer, m_pReadPage->m_pRead, nBlock);
- m_pReadPage->m_pRead += nBlock;
- m_pReadBuffer += nBlock;
- m_nReadBufferSize -= nBlock;
- m_nReadBufferFilled = 0;
- nRemain -= nBlock;
-
- if (m_pReadPage == m_pWritePage)
- break;
-
- if (m_pReadPage->m_pRead == m_pReadPage->m_pEnd)
- {
- Page * pRemove = m_pReadPage;
- m_pReadPage = pRemove->m_pNext;
- remove(pRemove);
- }
- }
-
- return nSize - nRemain;
-}
-
-//============================================================================
-sal_uInt32 SvDataPipe_Impl::write(sal_Int8 const * pBuffer, sal_uInt32 nSize)
-{
- if (nSize == 0)
- return 0;
-
- if (m_pWritePage == 0)
- {
- m_pFirstPage
- = static_cast< Page * >(rtl_allocateMemory(sizeof (Page)
- + m_nPageSize
- - 1));
- m_pFirstPage->m_pPrev = m_pFirstPage;
- m_pFirstPage->m_pNext = m_pFirstPage;
- m_pFirstPage->m_pStart = m_pFirstPage->m_aBuffer;
- m_pFirstPage->m_pRead = m_pFirstPage->m_aBuffer;
- m_pFirstPage->m_pEnd = m_pFirstPage->m_aBuffer;
- m_pFirstPage->m_nOffset = 0;
- m_pReadPage = m_pFirstPage;
- m_pWritePage = m_pFirstPage;
- ++m_nPages;
- }
-
- sal_uInt32 nRemain = nSize;
-
- if (m_pReadBuffer != 0 && m_pReadPage == m_pWritePage
- && m_pReadPage->m_pRead == m_pWritePage->m_pEnd)
- {
- sal_uInt32 nBlock = std::min(nRemain,
- sal_uInt32(m_nReadBufferSize
- - m_nReadBufferFilled));
- sal_uInt32 nPosition = m_pWritePage->m_nOffset
- + (m_pWritePage->m_pEnd
- - m_pWritePage->m_aBuffer);
- if (!m_aMarks.empty())
- nBlock = *m_aMarks.begin() > nPosition ?
- std::min(nBlock, sal_uInt32(*m_aMarks.begin()
- - nPosition)) :
- 0;
-
- if (nBlock > 0)
- {
- rtl_copyMemory(m_pReadBuffer + m_nReadBufferFilled, pBuffer,
- nBlock);
- m_nReadBufferFilled += nBlock;
- nRemain -= nBlock;
-
- nPosition += nBlock;
- m_pWritePage->m_nOffset = (nPosition / m_nPageSize) * m_nPageSize;
- m_pWritePage->m_pStart = m_pWritePage->m_aBuffer
- + nPosition % m_nPageSize;
- m_pWritePage->m_pRead = m_pWritePage->m_pStart;
- m_pWritePage->m_pEnd = m_pWritePage->m_pStart;
- }
- }
-
- if (nRemain > 0)
- for (;;)
- {
- sal_uInt32 nBlock
- = std::min(sal_uInt32(m_pWritePage->m_aBuffer + m_nPageSize
- - m_pWritePage->m_pEnd),
- nRemain);
- rtl_copyMemory(m_pWritePage->m_pEnd, pBuffer, nBlock);
- m_pWritePage->m_pEnd += nBlock;
- pBuffer += nBlock;
- nRemain -= nBlock;
-
- if (nRemain == 0)
- break;
-
- if (m_pWritePage->m_pNext == m_pFirstPage)
- {
- if (m_nPages == m_nMaxPages)
- break;
-
- Page * pNew
- = static_cast< Page * >(rtl_allocateMemory(
- sizeof (Page) + m_nPageSize
- - 1));
- pNew->m_pPrev = m_pWritePage;
- pNew->m_pNext = m_pWritePage->m_pNext;
-
- m_pWritePage->m_pNext->m_pPrev = pNew;
- m_pWritePage->m_pNext = pNew;
- ++m_nPages;
- }
-
- m_pWritePage->m_pNext->m_nOffset = m_pWritePage->m_nOffset
- + m_nPageSize;
- m_pWritePage = m_pWritePage->m_pNext;
- m_pWritePage->m_pStart = m_pWritePage->m_aBuffer;
- m_pWritePage->m_pRead = m_pWritePage->m_aBuffer;
- m_pWritePage->m_pEnd = m_pWritePage->m_aBuffer;
- }
-
- return nSize - nRemain;
-}
-
-//============================================================================
-bool SvDataPipe_Impl::addMark(sal_uInt32 nPosition)
-{
- if (m_pFirstPage != 0 && m_pFirstPage->m_nOffset > nPosition)
- return false;
- m_aMarks.insert(nPosition);
- return true;
-}
-
-//============================================================================
-bool SvDataPipe_Impl::removeMark(sal_uInt32 nPosition)
-{
- std::multiset< sal_uInt32 >::iterator t = m_aMarks.find(nPosition);
- if (t == m_aMarks.end())
- return false;
- m_aMarks.erase(t);
- while (remove(m_pFirstPage)) ;
- return true;
-}
-
-//============================================================================
-SvDataPipe_Impl::SeekResult SvDataPipe_Impl::setReadPosition(sal_uInt32
- nPosition)
-{
- if (m_pFirstPage == 0)
- return nPosition == 0 ? SEEK_OK : SEEK_PAST_END;
-
- if (nPosition
- <= m_pReadPage->m_nOffset
- + (m_pReadPage->m_pRead - m_pReadPage->m_aBuffer))
- {
- if (nPosition
- < m_pFirstPage->m_nOffset
- + (m_pFirstPage->m_pStart - m_pFirstPage->m_aBuffer))
- return SEEK_BEFORE_MARKED;
-
- while (nPosition < m_pReadPage->m_nOffset)
- {
- m_pReadPage->m_pRead = m_pReadPage->m_pStart;
- m_pReadPage = m_pReadPage->m_pPrev;
- }
- }
- else
- {
- if (nPosition
- > m_pWritePage->m_nOffset
- + (m_pWritePage->m_pEnd - m_pWritePage->m_aBuffer))
- return SEEK_PAST_END;
-
- while (m_pReadPage != m_pWritePage
- && nPosition >= m_pReadPage->m_nOffset + m_nPageSize)
- {
- Page * pRemove = m_pReadPage;
- m_pReadPage = pRemove->m_pNext;
- remove(pRemove);
- }
- }
-
- m_pReadPage->m_pRead = m_pReadPage->m_aBuffer
- + (nPosition - m_pReadPage->m_nOffset);
- return SEEK_OK;
-}
-
diff --git a/svtools/source/notify/brdcst.cxx b/svtools/source/notify/brdcst.cxx
deleted file mode 100644
index 3a698c725c5c..000000000000
--- a/svtools/source/notify/brdcst.cxx
+++ /dev/null
@@ -1,212 +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: brdcst.cxx,v $
- * $Revision: 1.8.60.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#ifndef GCC
-#endif
-#include <tools/debug.hxx>
-
-#include <svtools/hint.hxx>
-#include <svtools/smplhint.hxx>
-#include <svtools/lstner.hxx>
-
-SV_DECL_PTRARR( SfxListenerArr_Impl, SfxListener*, 0, 2 )
-
-#define _SFX_BRDCST_CXX
-#include <svtools/brdcst.hxx>
-
-//====================================================================
-DBG_NAME(SfxBroadcaster)
-TYPEINIT0(SfxBroadcaster);
-
-//====================================================================
-
-//====================================================================
-// broadcast immediately
-
-
-void SfxBroadcaster::Broadcast( const SfxHint &rHint )
-{
- DBG_CHKTHIS(SfxBroadcaster, 0);
-
- // is anybody to notify?
- if ( aListeners.Count() /*! || aGlobListeners.Count() */ )
- {
- // notify all registered listeners exactly once
- for ( USHORT n = 0; n < aListeners.Count(); ++n )
- {
- SfxListener* pListener = aListeners[n];
- if ( pListener )
- pListener->Notify( *this, rHint );
- }
- }
-}
-
-//--------------------------------------------------------------------
-
-// broadcast after a timeout
-
-
-void SfxBroadcaster::BroadcastDelayed( const SfxHint& rHint )
-{
- DBG_WARNING( "not implemented" );
- Broadcast(rHint);
-}
-//--------------------------------------------------------------------
-
-// broadcast in idle-handler
-
-void SfxBroadcaster::BroadcastInIdle( const SfxHint& rHint )
-{
- DBG_WARNING( "not implemented" );
- Broadcast(rHint);
-}
-//--------------------------------------------------------------------
-
-// unregister all listeners
-
-SfxBroadcaster::~SfxBroadcaster()
-{
- DBG_DTOR(SfxBroadcaster, 0);
-
- Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
-
- // remove all still registered listeners
- for ( USHORT nPos = 0; nPos < aListeners.Count(); ++nPos )
- {
- SfxListener *pListener = aListeners[nPos];
- if ( pListener )
- pListener->RemoveBroadcaster_Impl(*this);
- }
-}
-
-//--------------------------------------------------------------------
-
-// simple ctor of class SfxBroadcaster
-
-SfxBroadcaster::SfxBroadcaster()
-{
- DBG_CTOR(SfxBroadcaster, 0);
-}
-
-//--------------------------------------------------------------------
-
-// copy ctor of class SfxBroadcaster
-
-
-SfxBroadcaster::SfxBroadcaster( const SfxBroadcaster &rBC )
-{
- DBG_CTOR(SfxBroadcaster, 0);
-
- for ( USHORT n = 0; n < rBC.aListeners.Count(); ++n )
- {
- SfxListener *pListener = rBC.aListeners[n];
- if ( pListener )
- pListener->StartListening( *this );
- }
-}
-
-//--------------------------------------------------------------------
-
-// add a new SfxListener to the list
-
-BOOL SfxBroadcaster::AddListener( SfxListener& rListener )
-{
- DBG_CHKTHIS(SfxBroadcaster, 0);
- const SfxListener *pListener = &rListener;
- const SfxListener *pNull = 0;
- USHORT nFreePos = aListeners.GetPos( pNull );
- if ( nFreePos < aListeners.Count() )
- aListeners.GetData()[nFreePos] = pListener;
- else if ( aListeners.Count() < (USHRT_MAX-1) )
- aListeners.Insert( pListener, aListeners.Count() );
- else
- {
- DBG_ERROR( "array overflow" );
- return FALSE;
- }
-
- DBG_ASSERT( USHRT_MAX != aListeners.GetPos(pListener),
- "AddListener failed" );
- return TRUE;
-}
-
-//--------------------------------------------------------------------
-
-// called, if no more listeners exists
-
-void SfxBroadcaster::ListenersGone()
-{
- DBG_CHKTHIS(SfxBroadcaster,0);
-}
-
-//--------------------------------------------------------------------
-
-// forward a notification to all registered listeners
-
-void SfxBroadcaster::Forward(SfxBroadcaster& rBC, const SfxHint& rHint)
-{
- const USHORT nCount = aListeners.Count();
- for ( USHORT i = 0; i < nCount; ++i )
- {
- SfxListener *pListener = aListeners[i];
- if ( pListener )
- pListener->Notify( rBC, rHint );
- }
-}
-
-//--------------------------------------------------------------------
-
-// remove one SfxListener from the list
-
-void SfxBroadcaster::RemoveListener( SfxListener& rListener )
-{
- {DBG_CHKTHIS(SfxBroadcaster, 0);}
- const SfxListener *pListener = &rListener;
- USHORT nPos = aListeners.GetPos(pListener);
- DBG_ASSERT( nPos != USHRT_MAX, "RemoveListener: Listener unknown" );
- aListeners.GetData()[nPos] = 0;
- if ( !HasListeners() )
- ListenersGone();
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxBroadcaster::HasListeners() const
-{
- for ( USHORT n = 0; n < aListeners.Count(); ++n )
- if ( aListeners.GetObject(n) != 0 )
- return TRUE;
- return FALSE;
-}
-
-//--------------------------------------------------------------------
diff --git a/svtools/source/notify/broadcast.cxx b/svtools/source/notify/broadcast.cxx
deleted file mode 100644
index e363f545c719..000000000000
--- a/svtools/source/notify/broadcast.cxx
+++ /dev/null
@@ -1,151 +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: broadcast.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifndef GCC
-#endif
-#include <tools/debug.hxx>
-
-#include "listener.hxx"
-#include "listeneriter.hxx"
-#include "broadcast.hxx"
-#include <svtools/smplhint.hxx>
-
-
-//====================================================================
-TYPEINIT0(SvtBroadcaster);
-
-//====================================================================
-
-// simple ctor of class SvtBroadcaster
-
-SvtBroadcaster::SvtBroadcaster()
- : pRoot( 0 )
-{
-}
-
-//--------------------------------------------------------------------
-
-// copy ctor of class SvtBroadcaster
-
-SvtBroadcaster::SvtBroadcaster( const SvtBroadcaster &rBC )
- : pRoot( 0 )
-{
- SvtListenerIter aIter( (SvtBroadcaster&)rBC );
- SvtListener* pLast = aIter.GoStart();
- if( pLast )
- do {
- pLast->StartListening( *this );
- } while( 0 != ( pLast = aIter.GoNext() ));
-}
-
-//--------------------------------------------------------------------
-
-// unregister all listeners
-
-SvtBroadcaster::~SvtBroadcaster()
-{
- Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
-
- SvtListenerIter aIter( *this );
- SvtListener* pLast = aIter.GoStart();
- if( pLast )
- do {
- pLast->EndListening( *this );
- if( !HasListeners() ) // all gone ??
- break;
- } while( 0 != ( pLast = aIter.GoNext() ));
-}
-
-//--------------------------------------------------------------------
-
-// broadcast immedeately
-
-void SvtBroadcaster::Broadcast( const SfxHint &rHint )
-{
- // is anybody to notify?
- if( HasListeners() /* && !IsModifyLocked()*/ )
- {
-// LockModify();
-// bInModify = TRUE;
-
- SvtListenerIter aIter( *this );
- SvtListener* pLast = aIter.GoStart();
- if( pLast )
- do {
- pLast->Notify( *this, rHint );
- if( !HasListeners() ) // all gone ??
- break;
- } while( 0 != ( pLast = aIter.GoNext() ));
-
-// bInModify = FALSE;
-// UnlockModify();
- }
-}
-
-//--------------------------------------------------------------------
-
-
-// called, if no more listeners exists
-
-void SvtBroadcaster::ListenersGone()
-{
-}
-
-//--------------------------------------------------------------------
-
-// forward a notification to all registered listeners
-
-void SvtBroadcaster::Forward( SvtBroadcaster& rBC, const SfxHint& rHint )
-{
- // is anybody to notify?
- if( rBC.HasListeners() /* && !IsModifyLocked()*/ )
- {
-// LockModify();
-// bInModify = TRUE;
-
- SvtListenerIter aIter( rBC );
- SvtListener* pLast = aIter.GoStart();
- if( pLast )
- do {
- pLast->Notify( rBC, rHint );
- if( !rBC.HasListeners() ) // all gone ??
- break;
- } while( 0 != ( pLast = aIter.GoNext() ));
-
-// bInModify = FALSE;
-// UnlockModify();
- }
-}
-
-
-
diff --git a/svtools/source/notify/cancel.cxx b/svtools/source/notify/cancel.cxx
deleted file mode 100644
index 32a76a7df9c1..000000000000
--- a/svtools/source/notify/cancel.cxx
+++ /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: cancel.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#define _SFX_CANCEL_CXX
-#include <svtools/cancel.hxx>
-
-#include <vos/mutex.hxx>
-#include <tools/debug.hxx>
-
-#include <svtools/smplhint.hxx>
-#include <svtools/cnclhint.hxx>
-#include <rtl/instance.hxx>
-
-namespace { struct lclMutex : public rtl::Static< ::vos::OMutex, lclMutex >{}; }
-
-//=========================================================================
-
-SfxCancelManager::SfxCancelManager( SfxCancelManager *pParent )
-: _pParent( pParent )
-{
-}
-
-//-------------------------------------------------------------------------
-
-SfxCancelManager::~SfxCancelManager()
-{
- DBG_ASSERT( _pParent || !_aJobs.Count(), "deleting SfxCancelManager in use" );
- for ( USHORT n = _aJobs.Count(); n--; )
- _aJobs.GetObject(n)->SetManager( _pParent );
-}
-
-//-------------------------------------------------------------------------
-
-BOOL SfxCancelManager::CanCancel() const
-
-/* [Beschreibung]
-
- Liefert TRUE wenn an diesem CancelManager oder an einem Parent
- ein Job l"auft.
-*/
-
-{
- ::vos::OGuard aGuard( lclMutex::get() );
- return _aJobs.Count() > 0 || ( _pParent && _pParent->CanCancel() );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancelManager::Cancel( BOOL bDeep )
-
-/* [Beschreibung]
-
- Diese Methode markiert alle angemeldeten <SfxCancellable>-Instanzen
- als suspendiert.
-*/
-
-{
- ::vos::OGuard aGuard( lclMutex::get() );
- SfxCancelManagerWeak xWeak( this );
- for ( USHORT n = _aJobs.Count(); n-- && xWeak.Is(); )
- if ( n < _aJobs.Count() )
- _aJobs.GetObject(n)->Cancel();
- if ( xWeak.Is() && _pParent )
- _pParent->Cancel( bDeep );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancelManager::InsertCancellable( SfxCancellable *pJob )
-
-/* [Beschreibung]
-
- Diese interne Methode tr"agt 'pJob' in die Liste der unterbrechbaren
- Jobs ein und Broadcastet dies. Jeder <SfxCancellable> darf nur
- maximal einmal angemeldet sein, dies geschiet in seinem Ctor.
-*/
-
-{
-#ifdef GPF_ON_EMPTY_TITLE
- if ( !pJob->GetTitle() )
- {
- DBG_ERROR( "SfxCancellable: empty titles not allowed (Vermummungsverbot)" )
- *(int*)0 = 0;
- }
-#endif
-
- ::vos::OClearableGuard aGuard( lclMutex::get() );
- _aJobs.C40_INSERT( SfxCancellable, pJob, _aJobs.Count() );
-
- aGuard.clear();
- Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) );
-}
-
-//-------------------------------------------------------------------------
-
-
-void SfxCancelManager::RemoveCancellable( SfxCancellable *pJob )
-
-/* [Beschreibung]
-
- Diese interne Methode tr"agt 'pJob' aus die Liste der unterbrechbaren
- Jobs aus und Broadcastet dies. Dieser Aufruf mu\s paarig nach einem
- <InsertCancellable> erfolgen und wird im Dtor des <SfxCancellable>
- ausgel"ost.
-*/
-
-{
- ::vos::OClearableGuard aGuard( lclMutex::get() );
- const SfxCancellable *pTmp = pJob;
- USHORT nPos = _aJobs.GetPos( pTmp );
- if ( nPos != 0xFFFF )
- {
- _aJobs.Remove( nPos , 1 );
- aGuard.clear();
- Broadcast( SfxSimpleHint( SFX_HINT_CANCELLABLE ) );
- Broadcast( SfxCancelHint( pJob, SFXCANCELHINT_REMOVED ) );
- }
-}
-
-//-------------------------------------------------------------------------
-
-SfxCancellable::~SfxCancellable()
-{
- SfxCancelManager* pMgr = _pMgr;
- if ( pMgr )
- pMgr->RemoveCancellable( this );
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancellable::Cancel()
-
-/* [Description]
-
- This virtual function is called when the user hits the cancel-button.
- If you overload it, you can stop your activities. Please always call
- 'SfxCancellable::Cancel()'.
-*/
-
-{
-#ifdef GFP_ON_NO_CANCEL
- if ( _bCancelled < 5 )
- ++_bCancelled;
- else
- {
- delete this;
- }
-#else
- _bCancelled = TRUE;
-#endif
-}
-
-//-------------------------------------------------------------------------
-
-void SfxCancellable::SetManager( SfxCancelManager *pMgr )
-{
- SfxCancelManager* pTmp = _pMgr;
- if ( pTmp )
- pTmp->RemoveCancellable( this );
- _pMgr = pMgr;
- if ( pMgr )
- pMgr->InsertCancellable( this );
-}
-
-//-------------------------------------------------------------------------
-
-TYPEINIT1(SfxCancelHint, SfxHint);
-
-SfxCancelHint::SfxCancelHint( SfxCancellable* pJob, USHORT _nAction )
-{
- pCancellable = pJob;
- nAction = _nAction;
-}
-
-
diff --git a/svtools/source/notify/hint.cxx b/svtools/source/notify/hint.cxx
deleted file mode 100644
index 9ae3bf8f8b21..000000000000
--- a/svtools/source/notify/hint.cxx
+++ /dev/null
@@ -1,50 +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: hint.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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <svtools/hint.hxx>
-
-//====================================================================
-
-TYPEINIT0(SfxHint);
-
-//====================================================================
-// virtual dtor for the typical base-class Hint
-
-SfxHint::~SfxHint()
-{
-}
-
-
-
diff --git a/svtools/source/notify/isethint.cxx b/svtools/source/notify/isethint.cxx
deleted file mode 100644
index 67d484219ac6..000000000000
--- a/svtools/source/notify/isethint.cxx
+++ /dev/null
@@ -1,78 +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: isethint.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifndef GCC
-#endif
-
-#include <svtools/isethint.hxx>
-#include <svtools/itemset.hxx>
-
-//====================================================================
-
-TYPEINIT1(SfxItemSetHint, SfxHint);
-
-//====================================================================
-
-SfxItemSetHint::SfxItemSetHint( SfxItemSet *pItemSet )
-
-/* [Beschreibung]
-
- Dieser Ctor "ubernimmt das als Parameter "ubergeben <SfxItemSet>,
- das im Dtor gel"oscht wird.
-*/
-
-: _pItemSet( pItemSet )
-{
-}
-
-//--------------------------------------------------------------------
-
-SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet )
-
-/* [Beschreibung]
-
- Dieser Ctor kopiert das als Parameter "ubergeben <SfxItemSet>.
-*/
-
-: _pItemSet( rItemSet.Clone() )
-{
-}
-
-//--------------------------------------------------------------------
-
-SfxItemSetHint::~SfxItemSetHint()
-{
- delete _pItemSet;
-}
-
-//--------------------------------------------------------------------
diff --git a/svtools/source/notify/listener.cxx b/svtools/source/notify/listener.cxx
deleted file mode 100644
index 0ce072b44dfb..000000000000
--- a/svtools/source/notify/listener.cxx
+++ /dev/null
@@ -1,169 +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: listener.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-
-#ifndef DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-
-#include "broadcast.hxx"
-#include "listener.hxx"
-#include "listenerbase.hxx"
-#include "listeneriter.hxx"
-
-
-//====================================================================
-TYPEINIT0(SvtListener);
-
-//====================================================================
-// simple ctor of class SvtListener
-
-SvtListener::SvtListener()
- : pBrdCastLst( 0 )
-{
-}
-//--------------------------------------------------------------------
-
-// copy ctor of class SvtListener
-
-SvtListener::SvtListener( const SvtListener &rListener )
- : pBrdCastLst( 0 )
-{
- SvtListenerBase* pLst = rListener.pBrdCastLst;
- while( pLst )
- {
- new SvtListenerBase( *this, *pLst->GetBroadcaster() );
- pLst = pLst->GetNext();
- }
-}
-//--------------------------------------------------------------------
-
-// unregisteres the SvtListener from its SvtBroadcasters
-
-SvtListener::~SvtListener()
-{
- EndListeningAll();
-}
-
-//--------------------------------------------------------------------
-
-// registeres at a specific SvtBroadcaster
-
-BOOL SvtListener::StartListening( SvtBroadcaster& rBroadcaster )
-{
- const SvtListenerBase* pLst = pBrdCastLst;
- while( pLst )
- {
- if( &rBroadcaster == pLst->GetBroadcaster() )
- {
- // double, than return
- return FALSE;
- }
- pLst = pLst->GetNext();
- }
- new SvtListenerBase( *this, rBroadcaster );
- return TRUE;
-}
-
-//--------------------------------------------------------------------
-
-// unregisteres at a specific SvtBroadcaster
-
-BOOL SvtListener::EndListening( SvtBroadcaster& rBroadcaster )
-{
- SvtListenerBase *pLst = pBrdCastLst, *pPrev = pLst;
- while( pLst )
- {
- if( &rBroadcaster == pLst->GetBroadcaster() )
- {
- if( pBrdCastLst == pLst )
- pBrdCastLst = pLst->GetNext();
- else
- pPrev->SetNext( pLst->GetNext() );
-
- delete pLst;
- return TRUE;
- }
- pPrev = pLst;
- pLst = pLst->GetNext();
- }
- return FALSE;
-}
-
-//--------------------------------------------------------------------
-
-// unregisteres all Broadcasters
-
-void SvtListener::EndListeningAll()
-{
- SvtListenerBase *pLst = pBrdCastLst;
- while( pLst )
- {
- SvtListenerBase *pDel = pLst;
- pLst = pLst->GetNext();
-
- delete pDel;
- }
- pBrdCastLst = 0;
-}
-
-//--------------------------------------------------------------------
-
-BOOL SvtListener::IsListening( SvtBroadcaster& rBroadcaster ) const
-{
- const SvtListenerBase *pLst = pBrdCastLst;
- while( pLst )
- {
- if( &rBroadcaster == pLst->GetBroadcaster() )
- break;
- pLst = pLst->GetNext();
- }
- return 0 != pLst;
-}
-
-//--------------------------------------------------------------------
-
-// base implementation of notification handler
-
-void SvtListener::Notify( SvtBroadcaster&
-#ifdef DBG_UTIL
-rBC
-#endif
-, const SfxHint& )
-{
- DBG_ASSERT( IsListening( rBC ),
- "notification from unregistered broadcaster" );
-}
-
-
diff --git a/svtools/source/notify/listenerbase.cxx b/svtools/source/notify/listenerbase.cxx
deleted file mode 100644
index 25f1f1da1901..000000000000
--- a/svtools/source/notify/listenerbase.cxx
+++ /dev/null
@@ -1,84 +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: listenerbase.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#ifndef DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-
-#include "listenerbase.hxx"
-#include "listeneriter.hxx"
-#include "listener.hxx"
-#include "broadcast.hxx"
-
-
-SvtListenerBase::SvtListenerBase( SvtListener& rLst,
- SvtBroadcaster& rBroadcaster )
- : pLeft( 0 ), pRight( 0 ),
- pBroadcaster( &rBroadcaster ), pListener( &rLst )
-{
- pNext = rLst.pBrdCastLst;
- rLst.pBrdCastLst = this;
-
- if( pBroadcaster->pRoot )
- {
- // set ever behind the root
- pRight = pBroadcaster->pRoot->pRight;
- pBroadcaster->pRoot->pRight = this;
- this->pLeft = pBroadcaster->pRoot;
- if( pRight )
- pRight->pLeft = this;
- }
- else
- pBroadcaster->pRoot = this;
-}
-
-SvtListenerBase::~SvtListenerBase()
-{
- SvtListenerBase *pR = pRight, *pL = pLeft;
- if( pBroadcaster->pRoot )
- pBroadcaster->pRoot = pL ? pL : pR;
-
- if( pL )
- pL->pRight = pR;
- if( pR )
- pR->pLeft = pL;
-
- SvtListenerIter::RemoveListener( *this, pR );
-
- if( !pBroadcaster->pRoot )
- pBroadcaster->ListenersGone();
-}
-
-
diff --git a/svtools/source/notify/listenerbase.hxx b/svtools/source/notify/listenerbase.hxx
deleted file mode 100644
index e73f9dfc37c5..000000000000
--- a/svtools/source/notify/listenerbase.hxx
+++ /dev/null
@@ -1,60 +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: listenerbase.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _SVT_LISTENERBASE_HXX
-#define _SVT_LISTENERBASE_HXX
-
-class SvtBroadcaster;
-class SvtListener;
-
-class SvtListenerBase
-{
- SvtListenerBase *pNext;
- SvtListenerBase *pLeft, *pRight;
- SvtBroadcaster *pBroadcaster;
- SvtListener *pListener;
-
-public:
-
- SvtListenerBase( SvtListener& rLst, SvtBroadcaster& rBroadcaster );
- ~SvtListenerBase();
-
- SvtListenerBase* GetNext() const { return pNext; }
- void SetNext( SvtListenerBase* p ) { pNext = p; }
-
- SvtBroadcaster* GetBroadcaster() const { return pBroadcaster; }
- SvtListener* GetListener() const { return pListener; }
-
- SvtListenerBase* GetLeft() const { return pLeft; }
- SvtListenerBase* GetRight() const { return pRight; }
-};
-
-
-#endif
-
diff --git a/svtools/source/notify/listeneriter.cxx b/svtools/source/notify/listeneriter.cxx
deleted file mode 100644
index 08fcb5b7e9ac..000000000000
--- a/svtools/source/notify/listeneriter.cxx
+++ /dev/null
@@ -1,195 +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: listeneriter.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-#include <tools/debug.hxx>
-
-#include "listenerbase.hxx"
-#include "listeneriter.hxx"
-#include "broadcast.hxx"
-#include "listener.hxx"
-
-SvtListenerIter* SvtListenerIter::pListenerIters = 0;
-
-SvtListenerIter::SvtListenerIter( SvtBroadcaster& rBrdcst )
- : rRoot( rBrdcst )
-{
- // hinten einketten!
- pNxtIter = 0;
- if( pListenerIters )
- {
- SvtListenerIter* pTmp = pListenerIters;
- while( pTmp->pNxtIter )
- pTmp = pTmp->pNxtIter;
- pTmp->pNxtIter = this;
- }
- else
- pListenerIters = this;
-
- pAkt = rRoot.pRoot;
- pDelNext = pAkt;
-}
-
-
-
-SvtListenerIter::~SvtListenerIter()
-{
- if( pListenerIters )
- {
- if( pListenerIters == this )
- pListenerIters = pNxtIter;
- else
- {
- SvtListenerIter* pTmp = pListenerIters;
- while( pTmp->pNxtIter != this )
- if( 0 == ( pTmp = pTmp->pNxtIter ) )
- return ;
- pTmp->pNxtIter = pNxtIter;
- }
- }
-}
-
-void SvtListenerIter::RemoveListener( SvtListenerBase& rDel,
- SvtListenerBase* pNext )
-{
- // Update the ListenerIter
- SvtListenerIter* pTmp = pListenerIters;
- while( pTmp )
- {
- if( pTmp->pAkt == &rDel || pTmp->pDelNext == &rDel )
- pTmp->pDelNext = pNext;
- pTmp = pTmp->pNxtIter;
- }
-}
-
-SvtListener* SvtListenerIter::GoNext()
-{
- if( pDelNext == pAkt )
- {
- pAkt = pAkt->GetRight();
- pDelNext = pAkt;
- }
- else
- pAkt = pDelNext;
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-
-SvtListener* SvtListenerIter::GoPrev()
-{
- if( pDelNext == pAkt )
- pAkt = pAkt->GetLeft();
- else
- pAkt = pDelNext->GetLeft();
- pDelNext = pAkt;
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-
-SvtListener* SvtListenerIter::GoStart() // zum Anfang des Baums
-{
- pAkt = rRoot.pRoot;
- if( pAkt )
- while( pAkt->GetLeft() )
- pAkt = pAkt->GetLeft();
- pDelNext = pAkt;
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-
-SvtListener* SvtListenerIter::GoEnd() // zum End des Baums
-{
- pAkt = pDelNext;
- if( !pAkt )
- pAkt = rRoot.pRoot;
- if( pAkt )
- while( pAkt->GetRight() )
- pAkt = pAkt->GetRight();
- pDelNext = pAkt;
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-
-
-SvtListener* SvtListenerIter::First( TypeId nType )
-{
- aSrchId = nType;
- GoStart();
- if( pAkt )
- do {
- if( pAkt->GetListener()->IsA( aSrchId ) )
- break;
-
- if( pDelNext == pAkt )
- {
- pAkt = pAkt->GetRight();
- pDelNext = pAkt;
- }
- else
- pAkt = pDelNext;
-
- } while( pAkt );
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-
-SvtListener* SvtListenerIter::Next()
-{
- do {
- // erstmal zum naechsten
- if( pDelNext == pAkt )
- {
- pAkt = pAkt->GetRight();
- pDelNext = pAkt;
- }
- else
- pAkt = pDelNext;
-
- if( pAkt && pAkt->GetListener()->IsA( aSrchId ) )
- break;
- } while( pAkt );
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-
-SvtListener* SvtListenerIter::GoRoot() // wieder ab Root anfangen
-{
- pDelNext = pAkt = rRoot.pRoot;
- return pAkt ? pAkt->GetListener() : 0;
-}
-
-SvtListener* SvtListenerIter::GetCurr() const // returns the current
-{
- return pDelNext ? pDelNext->GetListener() : 0;
-}
-
diff --git a/svtools/source/notify/lstner.cxx b/svtools/source/notify/lstner.cxx
deleted file mode 100644
index d7345d7ed3db..000000000000
--- a/svtools/source/notify/lstner.cxx
+++ /dev/null
@@ -1,196 +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: lstner.cxx,v $
- * $Revision: 1.8.60.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#ifndef DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-
-#include <svtools/hint.hxx>
-#include <svtools/brdcst.hxx>
-
-SV_DECL_PTRARR( SfxBroadcasterArr_Impl, SfxBroadcaster*, 0, 2 )
-
-#define _SFX_LSTNER_CXX
-#include <svtools/lstner.hxx>
-
-//====================================================================
-DBG_NAME(SfxListener)
-TYPEINIT0(SfxListener);
-
-//====================================================================
-// simple ctor of class SfxListener
-
-SfxListener::SfxListener()
-{
- DBG_CTOR(SfxListener, 0);
-}
-//--------------------------------------------------------------------
-
-// copy ctor of class SfxListener
-
-SfxListener::SfxListener( const SfxListener &rListener )
-{
- DBG_CTOR(SfxListener, 0);
-
- for ( USHORT n = 0; n < rListener.aBCs.Count(); ++n )
- StartListening( *rListener.aBCs[n] );
-}
-//--------------------------------------------------------------------
-
-// unregisteres the SfxListener from its SfxBroadcasters
-
-SfxListener::~SfxListener()
-{
- DBG_DTOR(SfxListener, 0);
-
- // unregister at all remainding broadcasters
- for ( USHORT nPos = 0; nPos < aBCs.Count(); ++nPos )
- {
- SfxBroadcaster *pBC = aBCs[nPos];
- pBC->RemoveListener(*this);
- }
-}
-
-//--------------------------------------------------------------------
-
-// unregisteres at a specific SfxBroadcaster
-
-void SfxListener::RemoveBroadcaster_Impl( SfxBroadcaster& rBC )
-{
- DBG_CHKTHIS(SfxListener, 0);
-
- const SfxBroadcaster *pBC = &rBC;
- aBCs.Remove( aBCs.GetPos(pBC), 1 );
-}
-
-//--------------------------------------------------------------------
-
-// registeres at a specific SfxBroadcaster
-
-BOOL SfxListener::StartListening( SfxBroadcaster& rBroadcaster, BOOL bPreventDups )
-{
- DBG_CHKTHIS(SfxListener, 0);
-
- if ( !bPreventDups || !IsListening( rBroadcaster ) )
- {
- if ( rBroadcaster.AddListener(*this) )
- {
- const SfxBroadcaster *pBC = &rBroadcaster;
- aBCs.Insert( pBC, aBCs.Count() );
-
- DBG_ASSERT( IsListening(rBroadcaster), "StartListening failed" );
- return TRUE;
- }
-
- }
- return FALSE;
-}
-
-//--------------------------------------------------------------------
-
-// unregisteres at a specific SfxBroadcaster
-
-BOOL SfxListener::EndListening( SfxBroadcaster& rBroadcaster, BOOL bAllDups )
-{
- DBG_CHKTHIS(SfxListener, 0);
-
- if ( !IsListening( rBroadcaster ) )
- return FALSE;
-
- do
- {
- rBroadcaster.RemoveListener(*this);
- const SfxBroadcaster *pBC = &rBroadcaster;
- aBCs.Remove( aBCs.GetPos(pBC), 1 );
- }
- while ( bAllDups && IsListening( rBroadcaster ) );
- return TRUE;
-}
-
-//--------------------------------------------------------------------
-
-// unregisteres at a specific SfxBroadcaster by index
-
-void SfxListener::EndListening( USHORT nNo )
-{
- DBG_CHKTHIS(SfxListener, 0);
-
- SfxBroadcaster *pBC = aBCs.GetObject(nNo);
- pBC->RemoveListener(*this);
- aBCs.Remove( nNo, 1 );
-}
-
-//--------------------------------------------------------------------
-
-// unregisteres all Broadcasters
-
-void SfxListener::EndListeningAll()
-{
- DBG_CHKTHIS(SfxListener, 0);
-
- // MI: bei Optimierung beachten: Seiteneffekte von RemoveListener beachten!
- while ( aBCs.Count() )
- {
- SfxBroadcaster *pBC = aBCs.GetObject(0);
- pBC->RemoveListener(*this);
- aBCs.Remove( 0, 1 );
- }
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxListener::IsListening( SfxBroadcaster& rBroadcaster ) const
-{
- const SfxBroadcaster *pBC = &rBroadcaster;
- return USHRT_MAX != aBCs.GetPos( pBC );
-}
-
-//--------------------------------------------------------------------
-
-// base implementation of notification handler
-
-#ifdef DBG_UTIL
-void SfxListener::Notify( SfxBroadcaster& rBC, const SfxHint& )
-#else
-void SfxListener::Notify( SfxBroadcaster&, const SfxHint& )
-#endif
-{
- #ifdef DBG_UTIL
- const SfxBroadcaster *pBC = &rBC;
- DBG_ASSERT( USHRT_MAX != aBCs.GetPos(pBC),
- "notification from unregistered broadcaster" );
- #endif
-}
-
diff --git a/svtools/source/notify/makefile.mk b/svtools/source/notify/makefile.mk
deleted file mode 100644
index 8e4c4b211258..000000000000
--- a/svtools/source/notify/makefile.mk
+++ /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: makefile.mk,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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=notify
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/smplhint.obj \
- $(SLO)$/hint.obj \
- $(SLO)$/lstner.obj \
- $(SLO)$/isethint.obj \
- $(SLO)$/cancel.obj \
- $(SLO)$/brdcst.obj \
- $(SLO)$/listener.obj \
- $(SLO)$/listenerbase.obj \
- $(SLO)$/listeneriter.obj \
- $(SLO)$/broadcast.obj
-
-HXX1TARGET= notify
-HXX1EXT= hxx
-HXX1FILES= $(INC)$/hint.hxx \
- $(INC)$/smplhint.hxx \
- $(INC)$/lstner.hxx \
- $(INC)$/brdcst.hxx
-HXX1EXCL= -E:*include*
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/notify/smplhint.cxx b/svtools/source/notify/smplhint.cxx
deleted file mode 100644
index 6fddffc23e56..000000000000
--- a/svtools/source/notify/smplhint.cxx
+++ /dev/null
@@ -1,50 +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: smplhint.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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <svtools/smplhint.hxx>
-
-//====================================================================
-
-TYPEINIT1(SfxSimpleHint, SfxHint);
-
-//====================================================================
-// creates a SimpleHint with the type nId
-
-SfxSimpleHint::SfxSimpleHint( ULONG nIdP )
-{
- nId = nIdP;
-}
-
-
diff --git a/svtools/source/numbers/makefile.mk b/svtools/source/numbers/makefile.mk
deleted file mode 100644
index 46cd3985df1a..000000000000
--- a/svtools/source/numbers/makefile.mk
+++ /dev/null
@@ -1,78 +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: makefile.mk,v $
-#
-# $Revision: 1.12.148.1 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=numbers
-LIBTARGET=NO
-
-PROJECTPCH=
-PROJECTPCHSOURCE=
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svt.pmk
-
-# --- Files --------------------------------------------------------
-
-EXCEPTIONSFILES= \
- $(SLO)$/numuno.obj \
- $(SLO)$/numfmuno.obj \
- $(SLO)$/supservs.obj \
- $(SLO)$/zforlist.obj
-
-SLOFILES = \
- $(EXCEPTIONSFILES) \
- $(SLO)$/zforfind.obj \
- $(SLO)$/zformat.obj \
- $(SLO)$/zforscan.obj \
- $(SLO)$/numhead.obj
-
-LIB1TARGET= $(SLB)$/$(TARGET).uno.lib
-LIB1OBJFILES= \
- $(SLO)$/numfmuno.obj \
- $(SLO)$/supservs.obj
-
-LIB2TARGET= $(SLB)$/$(TARGET).lib
-LIB2OBJFILES= \
- $(SLO)$/zforfind.obj \
- $(SLO)$/zforlist.obj \
- $(SLO)$/zformat.obj \
- $(SLO)$/zforscan.obj \
- $(SLO)$/numuno.obj \
- $(SLO)$/numhead.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/numbers/nbdll.cxx b/svtools/source/numbers/nbdll.cxx
deleted file mode 100644
index d7cf20f6059f..000000000000
--- a/svtools/source/numbers/nbdll.cxx
+++ /dev/null
@@ -1,82 +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: nbdll.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#ifdef WIN
-#include <svwin.h>
-
-#ifndef _SYSDEP_HXX
-#include <sysdep.hxx>
-#endif
-
-// Statische DLL-Verwaltungs-Variablen
-static HINSTANCE hDLLInst = 0; // HANDLE der DLL
-
-
-/***************************************************************************
-|*
-|* LibMain()
-|*
-|* Beschreibung Initialisierungsfunktion der DLL
-|* Ersterstellung TH 05.05.93
-|* Letzte Aenderung TH 05.05.93
-|*
-***************************************************************************/
-
-extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
-{
-#ifndef WNT
- if ( nHeap )
- UnlockData( 0 );
-#endif
-
- hDLLInst = hDLL;
-
- return TRUE;
-}
-
-/***************************************************************************
-|*
-|* WEP()
-|*
-|* Beschreibung DLL-Deinitialisierung
-|* Ersterstellung TH 05.05.93
-|* Letzte Aenderung TH 05.05.93
-|*
-***************************************************************************/
-
-extern "C" int CALLBACK WEP( int )
-{
- return 1;
-}
-
-#endif
diff --git a/svtools/source/numbers/numfmuno.cxx b/svtools/source/numbers/numfmuno.cxx
deleted file mode 100644
index d65a2fd696ce..000000000000
--- a/svtools/source/numbers/numfmuno.cxx
+++ /dev/null
@@ -1,1144 +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: numfmuno.cxx,v $
- * $Revision: 1.15 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <vcl/svapp.hxx>
-#include <tools/color.hxx>
-#include <tools/debug.hxx>
-#include <i18npool/mslangid.hxx>
-#include <vos/mutex.hxx>
-#include <rtl/ustring.hxx>
-
-#include <com/sun/star/util/Date.hpp>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-#include "numfmuno.hxx"
-#include "numuno.hxx"
-#include <svtools/zforlist.hxx>
-#include <svtools/zformat.hxx>
-#include <svtools/itemprop.hxx>
-
-using namespace com::sun::star;
-
-//------------------------------------------------------------------------
-
-#define SERVICENAME_NUMBERFORMATTER "com.sun.star.util.NumberFormatter"
-#define SERVICENAME_NUMBERSETTINGS "com.sun.star.util.NumberFormatSettings"
-#define SERVICENAME_NUMBERFORMATS "com.sun.star.util.NumberFormats"
-#define SERVICENAME_NUMBERFORMAT "com.sun.star.util.NumberFormatProperties"
-
-//------------------------------------------------------------------------
-
-#define PROPERTYNAME_FMTSTR "FormatString"
-#define PROPERTYNAME_LOCALE "Locale"
-#define PROPERTYNAME_TYPE "Type"
-#define PROPERTYNAME_COMMENT "Comment"
-#define PROPERTYNAME_CURREXT "CurrencyExtension"
-#define PROPERTYNAME_CURRSYM "CurrencySymbol"
-#define PROPERTYNAME_CURRABB "CurrencyAbbreviation"
-#define PROPERTYNAME_DECIMALS "Decimals"
-#define PROPERTYNAME_LEADING "LeadingZeros"
-#define PROPERTYNAME_NEGRED "NegativeRed"
-#define PROPERTYNAME_STDFORM "StandardFormat"
-#define PROPERTYNAME_THOUS "ThousandsSeparator"
-#define PROPERTYNAME_USERDEF "UserDefined"
-
-#define PROPERTYNAME_NOZERO "NoZero"
-#define PROPERTYNAME_NULLDATE "NullDate"
-#define PROPERTYNAME_STDDEC "StandardDecimals"
-#define PROPERTYNAME_TWODIGIT "TwoDigitDateStart"
-
-//------------------------------------------------------------------------
-
-// alles ohne Which-ID, Map nur fuer PropertySetInfo
-
-const SfxItemPropertyMapEntry* lcl_GetNumberFormatPropertyMap()
-{
- static SfxItemPropertyMapEntry aNumberFormatPropertyMap_Impl[] =
- {
- {MAP_CHAR_LEN(PROPERTYNAME_FMTSTR), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_LOCALE), 0, &getCppuType((lang::Locale*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_TYPE), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_COMMENT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_CURREXT), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_CURRSYM), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_DECIMALS), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_LEADING), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_NEGRED), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_STDFORM), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_THOUS), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_USERDEF), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_CURRABB), 0, &getCppuType((rtl::OUString*)0),beans::PropertyAttribute::BOUND | beans::PropertyAttribute::READONLY, 0},
- {0,0,0,0,0,0}
- };
- return aNumberFormatPropertyMap_Impl;
-}
-
-const SfxItemPropertyMapEntry* lcl_GetNumberSettingsPropertyMap()
-{
- static SfxItemPropertyMapEntry aNumberSettingsPropertyMap_Impl[] =
- {
- {MAP_CHAR_LEN(PROPERTYNAME_NOZERO), 0, &getBooleanCppuType(), beans::PropertyAttribute::BOUND, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_NULLDATE), 0, &getCppuType((util::Date*)0), beans::PropertyAttribute::BOUND, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_STDDEC), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
- {MAP_CHAR_LEN(PROPERTYNAME_TWODIGIT), 0, &getCppuType((sal_Int16*)0), beans::PropertyAttribute::BOUND, 0},
- {0,0,0,0,0,0}
- };
- return aNumberSettingsPropertyMap_Impl;
-}
-
-//----------------------------------------------------------------------------------------
-
-LanguageType lcl_GetLanguage( const lang::Locale& rLocale )
-{
- // empty language -> LANGUAGE_SYSTEM
- if ( rLocale.Language.getLength() == 0 )
- return LANGUAGE_SYSTEM;
-
- LanguageType eRet = MsLangId::convertLocaleToLanguage( rLocale );
- if ( eRet == LANGUAGE_NONE )
- eRet = LANGUAGE_SYSTEM; //! or throw an exception?
-
- return eRet;
-}
-
-//----------------------------------------------------------------------------------------
-
-SvNumberFormatterServiceObj::SvNumberFormatterServiceObj()
- :m_aMutex()
-{
-}
-
-SvNumberFormatterServiceObj::~SvNumberFormatterServiceObj()
-{
-}
-
-com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SvNumberFormatterServiceObj_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
-{
- return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new SvNumberFormatterServiceObj );
-}
-
-// XNumberFormatter
-
-void SAL_CALL SvNumberFormatterServiceObj::attachNumberFormatsSupplier(
- const uno::Reference<util::XNumberFormatsSupplier>& _xSupplier )
- throw(uno::RuntimeException)
-{
- ::rtl::Reference< SvNumberFormatsSupplierObj > xAutoReleaseOld;
-
- // SYNCHRONIZED ->
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
-
- SvNumberFormatsSupplierObj* pNew = SvNumberFormatsSupplierObj::getImplementation( _xSupplier );
- if (!pNew)
- throw uno::RuntimeException(); // wrong object
-
- xAutoReleaseOld = xSupplier;
-
- xSupplier = pNew;
- m_aMutex = xSupplier->getSharedMutex();
- }
- // <- SYNCHRONIZED
-}
-
-uno::Reference<util::XNumberFormatsSupplier> SAL_CALL
- SvNumberFormatterServiceObj::getNumberFormatsSupplier()
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- return xSupplier.get();
-}
-
-sal_Int32 SAL_CALL SvNumberFormatterServiceObj::detectNumberFormat(
- sal_Int32 nKey, const rtl::OUString& aString )
- throw(util::NotNumericException, uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aTemp = aString;
- sal_uInt32 nUKey = nKey;
- double fValue = 0.0;
- if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) )
- nRet = nUKey;
- else
- throw util::NotNumericException();
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-double SAL_CALL SvNumberFormatterServiceObj::convertStringToNumber(
- sal_Int32 nKey, const rtl::OUString& aString )
- throw(util::NotNumericException, uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- double fRet = 0.0;
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aTemp = aString;
- sal_uInt32 nUKey = nKey;
- double fValue = 0.0;
- if ( pFormatter->IsNumberFormat(aTemp, nUKey, fValue) )
- fRet = fValue;
- else
- throw util::NotNumericException();
- }
- else
- throw uno::RuntimeException();
-
- return fRet;
-}
-
-rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString(
- sal_Int32 nKey, double fValue ) throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- String aRet;
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- Color* pColor = NULL;
- pFormatter->GetOutputString(fValue, nKey, aRet, &pColor);
- }
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 nKey,
- double fValue, util::Color aDefaultColor )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- util::Color nRet = aDefaultColor; // color = INT32
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aStr;
- Color* pColor = NULL;
- pFormatter->GetOutputString(fValue, nKey, aStr, &pColor);
- if (pColor)
- nRet = pColor->GetColor();
- // sonst Default behalten
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-rtl::OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey,
- const rtl::OUString& aString ) throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- String aRet;
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aTemp = aString;
- Color* pColor = NULL;
- pFormatter->GetOutputString(aTemp, nKey, aRet, &pColor);
- }
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-util::Color SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 nKey,
- const rtl::OUString& aString,util::Color aDefaultColor )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- util::Color nRet = aDefaultColor; // color = INT32
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aTemp = aString;
- String aStr;
- Color* pColor = NULL;
- pFormatter->GetOutputString(aTemp, nKey, aStr, &pColor);
- if (pColor)
- nRet = pColor->GetColor();
- // sonst Default behalten
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getInputString( sal_Int32 nKey, double fValue )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- String aRet;
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- pFormatter->GetInputLineString(fValue, nKey, aRet);
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-// XNumberFormatPreviewer
-
-rtl::OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString(
- const rtl::OUString& aFormat, double fValue,
- const lang::Locale& nLocale, sal_Bool bAllowEnglish )
- throw(util::MalformedNumberFormatException, uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- String aRet;
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aOutString;
- String aFormString = aFormat;
- LanguageType eLang = lcl_GetLanguage( nLocale );
- Color* pColor = NULL;
-
- BOOL bOk;
- if ( bAllowEnglish )
- bOk = pFormatter->GetPreviewStringGuess(
- aFormString, fValue, aOutString, &pColor, eLang );
- else
- bOk = pFormatter->GetPreviewString(
- aFormString, fValue, aOutString, &pColor, eLang );
-
- if (bOk)
- aRet = aOutString;
- else
- throw util::MalformedNumberFormatException();
- }
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-util::Color SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber(
- const rtl::OUString& aFormat, double fValue,
- const lang::Locale& nLocale, sal_Bool bAllowEnglish,
- util::Color aDefaultColor )
- throw(util::MalformedNumberFormatException, uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- util::Color nRet = aDefaultColor; // color = INT32
- SvNumberFormatter* pFormatter = xSupplier.is() ? xSupplier->GetNumberFormatter() : NULL;
- if (pFormatter)
- {
- String aOutString;
- String aFormString = aFormat;
- LanguageType eLang = lcl_GetLanguage( nLocale );
- Color* pColor = NULL;
-
- BOOL bOk;
- if ( bAllowEnglish )
- bOk = pFormatter->GetPreviewStringGuess(
- aFormString, fValue, aOutString, &pColor, eLang );
- else
- bOk = pFormatter->GetPreviewString(
- aFormString, fValue, aOutString, &pColor, eLang );
-
- if (bOk)
- {
- if (pColor)
- nRet = pColor->GetColor();
- // sonst Default behalten
- }
- else
- throw util::MalformedNumberFormatException();
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-// XServiceInfo
-
-rtl::OUString SAL_CALL SvNumberFormatterServiceObj::getImplementationName()
- throw(uno::RuntimeException)
-{
- return rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject");
-}
-
-sal_Bool SAL_CALL SvNumberFormatterServiceObj::supportsService( const rtl::OUString& ServiceName )
- throw(uno::RuntimeException)
-{
- return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATTER) == 0 );
-}
-
-uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatterServiceObj::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence<rtl::OUString> aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATTER);
- return aRet;
-}
-
-//------------------------------------------------------------------------
-
-SvNumberFormatsObj::SvNumberFormatsObj( SvNumberFormatsSupplierObj& _rParent, ::comphelper::SharedMutex& _rMutex )
- :rSupplier( _rParent )
- ,m_aMutex( _rMutex )
-{
- rSupplier.acquire();
-}
-
-SvNumberFormatsObj::~SvNumberFormatsObj()
-{
- rSupplier.release();
-}
-
-// XNumberFormats
-
-uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsObj::getByKey( sal_Int32 nKey )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
- if (pFormat)
- return new SvNumberFormatObj( rSupplier, nKey, m_aMutex );
- else
- throw uno::RuntimeException();
-}
-
-uno::Sequence<sal_Int32> SAL_CALL SvNumberFormatsObj::queryKeys( sal_Int16 nType,
- const lang::Locale& nLocale, sal_Bool bCreate )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if ( pFormatter )
- {
- sal_uInt32 nIndex = 0;
- LanguageType eLang = lcl_GetLanguage( nLocale );
- SvNumberFormatTable& rTable = bCreate ?
- pFormatter->ChangeCL( nType, nIndex, eLang ) :
- pFormatter->GetEntryTable( nType, nIndex, eLang );
- sal_uInt32 nCount = rTable.Count();
- uno::Sequence<sal_Int32> aSeq(nCount);
- sal_Int32* pAry = aSeq.getArray();
- for (sal_uInt32 i=0; i<nCount; i++)
- pAry[i] = rTable.GetObjectKey( i );
-
- return aSeq;
- }
- else
- throw uno::RuntimeException();
-}
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::queryKey( const rtl::OUString& aFormat,
- const lang::Locale& nLocale, sal_Bool bScan )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- String aFormStr = aFormat;
- LanguageType eLang = lcl_GetLanguage( nLocale );
- if (bScan)
- {
- //! irgendwas muss hier noch passieren...
- }
- nRet = pFormatter->GetEntryKey( aFormat, eLang );
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::addNew( const rtl::OUString& aFormat,
- const lang::Locale& nLocale )
- throw(util::MalformedNumberFormatException, uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- String aFormStr = aFormat;
- LanguageType eLang = lcl_GetLanguage( nLocale );
- sal_uInt32 nKey = 0;
- xub_StrLen nCheckPos = 0;
- short nType = 0;
- BOOL bOk = pFormatter->PutEntry( aFormStr, nCheckPos, nType, nKey, eLang );
- if (bOk)
- nRet = nKey;
- else if (nCheckPos)
- {
- throw util::MalformedNumberFormatException(); // ungueltiges Format
- }
- else
- throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden)
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::addNewConverted( const rtl::OUString& aFormat,
- const lang::Locale& nLocale, const lang::Locale& nNewLocale )
- throw(util::MalformedNumberFormatException, uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- String aFormStr = aFormat;
- LanguageType eLang = lcl_GetLanguage( nLocale );
- LanguageType eNewLang = lcl_GetLanguage( nNewLocale );
- sal_uInt32 nKey = 0;
- xub_StrLen nCheckPos = 0;
- short nType = 0;
- BOOL bOk = pFormatter->PutandConvertEntry( aFormStr, nCheckPos, nType, nKey, eLang, eNewLang );
- if (bOk || nKey > 0)
- nRet = nKey;
- else if (nCheckPos)
- {
- throw util::MalformedNumberFormatException(); // ungueltiges Format
- }
- else
- throw uno::RuntimeException(); // anderer Fehler (z.B. schon vorhanden)
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-void SAL_CALL SvNumberFormatsObj::removeByKey( sal_Int32 nKey ) throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
-
- if (pFormatter)
- {
- pFormatter->DeleteEntry(nKey);
- rSupplier.NumberFormatDeleted(nKey); // Benachrichtigung fuers Dokument
- }
-}
-
-rtl::OUString SAL_CALL SvNumberFormatsObj::generateFormat( sal_Int32 nBaseKey,
- const lang::Locale& nLocale, sal_Bool bThousands,
- sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- String aRet;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- LanguageType eLang = lcl_GetLanguage( nLocale );
- pFormatter->GenerateFormat( aRet, nBaseKey, eLang, bThousands, bRed, nDecimals, nLeading );
- }
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-// XNumberFormatTypes
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardIndex( const lang::Locale& nLocale )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- LanguageType eLang = lcl_GetLanguage( nLocale );
- nRet = pFormatter->GetStandardIndex(eLang);
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::getStandardFormat( sal_Int16 nType, const lang::Locale& nLocale )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- LanguageType eLang = lcl_GetLanguage( nLocale );
- // mask out "defined" bit, so type from an existing number format
- // can directly be used for getStandardFormat
- nType &= ~NUMBERFORMAT_DEFINED;
- nRet = pFormatter->GetStandardFormat(nType, eLang);
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatIndex( sal_Int16 nIndex, const lang::Locale& nLocale )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- LanguageType eLang = lcl_GetLanguage( nLocale );
- nRet = pFormatter->GetFormatIndex( (NfIndexTableOffset)nIndex, eLang );
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-sal_Bool SAL_CALL SvNumberFormatsObj::isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- BOOL bRet = FALSE;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- bRet = pFormatter->IsCompatible( nOldType, nNewType );
- else
- throw uno::RuntimeException();
-
- return bRet;
-}
-
-sal_Int32 SAL_CALL SvNumberFormatsObj::getFormatForLocale( sal_Int32 nKey, const lang::Locale& nLocale )
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- INT32 nRet = 0;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- LanguageType eLang = lcl_GetLanguage( nLocale );
- nRet = pFormatter->GetFormatForLanguageIfBuiltIn(nKey, eLang);
- }
- else
- throw uno::RuntimeException();
-
- return nRet;
-}
-
-// XServiceInfo
-
-rtl::OUString SAL_CALL SvNumberFormatsObj::getImplementationName()
- throw(uno::RuntimeException)
-{
- return rtl::OUString::createFromAscii("SvNumberFormatsObj");
-}
-
-sal_Bool SAL_CALL SvNumberFormatsObj::supportsService( const rtl::OUString& ServiceName )
- throw(uno::RuntimeException)
-{
- return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMATS) == 0 );
-}
-
-uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatsObj::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence<rtl::OUString> aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMATS);
- return aRet;
-}
-
-//------------------------------------------------------------------------
-
-SvNumberFormatObj::SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex )
- :rSupplier( rParent )
- ,nKey( nK )
- ,m_aMutex( _rMutex )
-{
- rSupplier.acquire();
-}
-
-SvNumberFormatObj::~SvNumberFormatObj()
-{
- rSupplier.release();
-}
-
-// XPropertySet
-
-uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatObj::getPropertySetInfo()
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- static uno::Reference<beans::XPropertySetInfo> aRef =
- new SfxItemPropertySetInfo( lcl_GetNumberFormatPropertyMap() );
- return aRef;
-}
-
-void SAL_CALL SvNumberFormatObj::setPropertyValue( const rtl::OUString&,
- const uno::Any& )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- uno::RuntimeException)
-{
- throw beans::UnknownPropertyException(); // everything is read-only
-}
-
-uno::Any SAL_CALL SvNumberFormatObj::getPropertyValue( const rtl::OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- uno::Any aRet;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
- if (pFormat)
- {
- BOOL bThousand, bRed;
- USHORT nDecimals, nLeading;
-
- String aString = aPropertyName;
- if (aString.EqualsAscii( PROPERTYNAME_FMTSTR ))
- {
- aRet <<= rtl::OUString( pFormat->GetFormatstring() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_LOCALE ))
- {
- lang::Locale aLocale( MsLangId::convertLanguageToLocale(
- pFormat->GetLanguage()));
- aRet <<= aLocale;
- }
- else if (aString.EqualsAscii( PROPERTYNAME_TYPE ))
- {
- aRet <<= (sal_Int16)( pFormat->GetType() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_COMMENT ))
- {
- aRet <<= rtl::OUString( pFormat->GetComment() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_STDFORM ))
- {
- //! SvNumberformat Member bStandard rausreichen?
- BOOL bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
- aRet.setValue( &bStandard, getBooleanCppuType() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_USERDEF ))
- {
- BOOL bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 );
- aRet.setValue( &bUserDef, getBooleanCppuType() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_DECIMALS ))
- {
- pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- aRet <<= (sal_Int16)( nDecimals );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_LEADING ))
- {
- pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- aRet <<= (sal_Int16)( nLeading );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_NEGRED ))
- {
- pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- aRet.setValue( &bRed, getBooleanCppuType() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_THOUS ))
- {
- pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- aRet.setValue( &bThousand, getBooleanCppuType() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_CURRSYM ))
- {
- String aSymbol, aExt;
- pFormat->GetNewCurrencySymbol( aSymbol, aExt );
- aRet <<= rtl::OUString( aSymbol );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_CURREXT ))
- {
- String aSymbol, aExt;
- pFormat->GetNewCurrencySymbol( aSymbol, aExt );
- aRet <<= rtl::OUString( aExt );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_CURRABB ))
- {
- String aSymbol, aExt;
- BOOL bBank = FALSE;
- pFormat->GetNewCurrencySymbol( aSymbol, aExt );
- const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank,
- aSymbol, aExt, pFormat->GetLanguage() );
- if ( pCurr )
- aRet <<= rtl::OUString( pCurr->GetBankSymbol() );
- else
- aRet <<= rtl::OUString();
- }
- else
- throw beans::UnknownPropertyException();
- }
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-void SAL_CALL SvNumberFormatObj::addPropertyChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XPropertyChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-void SAL_CALL SvNumberFormatObj::removePropertyChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XPropertyChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-void SAL_CALL SvNumberFormatObj::addVetoableChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XVetoableChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-void SAL_CALL SvNumberFormatObj::removeVetoableChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XVetoableChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-// XPropertyAccess
-
-uno::Sequence<beans::PropertyValue> SAL_CALL SvNumberFormatObj::getPropertyValues()
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- const SvNumberformat* pFormat = pFormatter ? pFormatter->GetEntry(nKey) : NULL;
- if (pFormat)
- {
- String aSymbol, aExt, aAbb;
- BOOL bBank = FALSE;
- pFormat->GetNewCurrencySymbol( aSymbol, aExt );
- const NfCurrencyEntry* pCurr = pFormatter->GetCurrencyEntry( bBank,
- aSymbol, aExt, pFormat->GetLanguage() );
- if ( pCurr )
- aAbb = pCurr->GetBankSymbol();
-
- String aFmtStr = pFormat->GetFormatstring();
- String aComment = pFormat->GetComment();
- BOOL bStandard = ( ( nKey % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 );
- //! SvNumberformat Member bStandard rausreichen?
- BOOL bUserDef = ( ( pFormat->GetType() & NUMBERFORMAT_DEFINED ) != 0 );
- BOOL bThousand, bRed;
- USHORT nDecimals, nLeading;
- pFormat->GetFormatSpecialInfo( bThousand, bRed, nDecimals, nLeading );
- lang::Locale aLocale( MsLangId::convertLanguageToLocale(
- pFormat->GetLanguage()));
-
- uno::Sequence<beans::PropertyValue> aSeq(13);
- beans::PropertyValue* pArray = aSeq.getArray();
-
- pArray[0].Name = rtl::OUString::createFromAscii( PROPERTYNAME_FMTSTR );
- pArray[0].Value <<= rtl::OUString( aFmtStr );
- pArray[1].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LOCALE );
- pArray[1].Value <<= aLocale;
- pArray[2].Name = rtl::OUString::createFromAscii( PROPERTYNAME_TYPE );
- pArray[2].Value <<= (sal_Int16)( pFormat->GetType() );
- pArray[3].Name = rtl::OUString::createFromAscii( PROPERTYNAME_COMMENT );
- pArray[3].Value <<= rtl::OUString( aComment );
- pArray[4].Name = rtl::OUString::createFromAscii( PROPERTYNAME_STDFORM );
- pArray[4].Value.setValue( &bStandard, getBooleanCppuType() );
- pArray[5].Name = rtl::OUString::createFromAscii( PROPERTYNAME_USERDEF );
- pArray[5].Value.setValue( &bUserDef, getBooleanCppuType() );
- pArray[6].Name = rtl::OUString::createFromAscii( PROPERTYNAME_DECIMALS );
- pArray[6].Value <<= (sal_Int16)( nDecimals );
- pArray[7].Name = rtl::OUString::createFromAscii( PROPERTYNAME_LEADING );
- pArray[7].Value <<= (sal_Int16)( nLeading );
- pArray[8].Name = rtl::OUString::createFromAscii( PROPERTYNAME_NEGRED );
- pArray[8].Value.setValue( &bRed, getBooleanCppuType() );
- pArray[9].Name = rtl::OUString::createFromAscii( PROPERTYNAME_THOUS );
- pArray[9].Value.setValue( &bThousand, getBooleanCppuType() );
- pArray[10].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRSYM );
- pArray[10].Value <<= rtl::OUString( aSymbol );
- pArray[11].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURREXT );
- pArray[11].Value <<= rtl::OUString( aExt );
- pArray[12].Name = rtl::OUString::createFromAscii( PROPERTYNAME_CURRABB );
- pArray[12].Value <<= rtl::OUString( aAbb );
-
- return aSeq;
- }
- else
- throw uno::RuntimeException();
-}
-
-void SAL_CALL SvNumberFormatObj::setPropertyValues( const uno::Sequence<beans::PropertyValue>& )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- uno::RuntimeException)
-{
- throw beans::UnknownPropertyException(); // everything is read-only
-}
-
-// XServiceInfo
-
-rtl::OUString SAL_CALL SvNumberFormatObj::getImplementationName()
- throw(uno::RuntimeException)
-{
- return rtl::OUString::createFromAscii("SvNumberFormatObj");
-}
-
-sal_Bool SAL_CALL SvNumberFormatObj::supportsService( const rtl::OUString& ServiceName )
- throw(uno::RuntimeException)
-{
- return ( ServiceName.compareToAscii(SERVICENAME_NUMBERFORMAT) == 0 );
-}
-
-uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatObj::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence<rtl::OUString> aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERFORMAT);
- return aRet;
-}
-
-//------------------------------------------------------------------------
-
-SvNumberFormatSettingsObj::SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex )
- :rSupplier( rParent )
- ,m_aMutex( _rMutex )
-{
- rSupplier.acquire();
-}
-
-SvNumberFormatSettingsObj::~SvNumberFormatSettingsObj()
-{
- rSupplier.release();
-}
-
-// XPropertySet
-
-uno::Reference<beans::XPropertySetInfo> SAL_CALL SvNumberFormatSettingsObj::getPropertySetInfo()
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- static uno::Reference<beans::XPropertySetInfo> aRef =
- new SfxItemPropertySetInfo( lcl_GetNumberSettingsPropertyMap() );
- return aRef;
-}
-
-void SAL_CALL SvNumberFormatSettingsObj::setPropertyValue( const rtl::OUString& aPropertyName,
- const uno::Any& aValue )
- throw(beans::UnknownPropertyException, beans::PropertyVetoException,
- lang::IllegalArgumentException, lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- String aString = aPropertyName;
- if (aString.EqualsAscii( PROPERTYNAME_NOZERO ))
- {
- // operator >>= shouldn't be used for bool (?)
- if ( aValue.getValueTypeClass() == uno::TypeClass_BOOLEAN )
- pFormatter->SetNoZero( *(sal_Bool*)aValue.getValue() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE ))
- {
- util::Date aDate;
- if ( aValue >>= aDate )
- pFormatter->ChangeNullDate( aDate.Day, aDate.Month, aDate.Year );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_STDDEC ))
- {
- sal_Int16 nInt16 = sal_Int16();
- if ( aValue >>= nInt16 )
- pFormatter->ChangeStandardPrec( nInt16 );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT ))
- {
- sal_Int16 nInt16 = sal_Int16();
- if ( aValue >>= nInt16 )
- pFormatter->SetYear2000( nInt16 );
- }
- else
- throw beans::UnknownPropertyException();
-
- rSupplier.SettingsChanged();
- }
- else
- throw uno::RuntimeException();
-}
-
-uno::Any SAL_CALL SvNumberFormatSettingsObj::getPropertyValue( const rtl::OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- uno::Any aRet;
- SvNumberFormatter* pFormatter = rSupplier.GetNumberFormatter();
- if (pFormatter)
- {
- String aString = aPropertyName;
- if (aString.EqualsAscii( PROPERTYNAME_NOZERO ))
- {
- BOOL bNoZero = pFormatter->GetNoZero();
- aRet.setValue( &bNoZero, getBooleanCppuType() );
- }
- else if (aString.EqualsAscii( PROPERTYNAME_NULLDATE ))
- {
- Date* pDate = pFormatter->GetNullDate();
- if (pDate)
- {
- util::Date aUnoDate( pDate->GetDay(), pDate->GetMonth(), pDate->GetYear() );
- aRet <<= aUnoDate;
- }
- }
- else if (aString.EqualsAscii( PROPERTYNAME_STDDEC ))
- aRet <<= (sal_Int16)( pFormatter->GetStandardPrec() );
- else if (aString.EqualsAscii( PROPERTYNAME_TWODIGIT ))
- aRet <<= (sal_Int16)( pFormatter->GetYear2000() );
- else
- throw beans::UnknownPropertyException();
- }
- else
- throw uno::RuntimeException();
-
- return aRet;
-}
-
-void SAL_CALL SvNumberFormatSettingsObj::addPropertyChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XPropertyChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-void SAL_CALL SvNumberFormatSettingsObj::removePropertyChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XPropertyChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-void SAL_CALL SvNumberFormatSettingsObj::addVetoableChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XVetoableChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-void SAL_CALL SvNumberFormatSettingsObj::removeVetoableChangeListener( const rtl::OUString&,
- const uno::Reference<beans::XVetoableChangeListener>&)
- throw(beans::UnknownPropertyException,
- lang::WrappedTargetException, uno::RuntimeException)
-{
- DBG_ERROR("not implemented");
-}
-
-// XServiceInfo
-
-rtl::OUString SAL_CALL SvNumberFormatSettingsObj::getImplementationName()
- throw(uno::RuntimeException)
-{
- return rtl::OUString::createFromAscii("SvNumberFormatSettingsObj");
-}
-
-sal_Bool SAL_CALL SvNumberFormatSettingsObj::supportsService( const rtl::OUString& ServiceName )
- throw(uno::RuntimeException)
-{
- return ( ServiceName.compareToAscii(SERVICENAME_NUMBERSETTINGS) == 0 );
-}
-
-uno::Sequence<rtl::OUString> SAL_CALL SvNumberFormatSettingsObj::getSupportedServiceNames()
- throw(uno::RuntimeException)
-{
- uno::Sequence<rtl::OUString> aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString::createFromAscii(SERVICENAME_NUMBERSETTINGS);
- return aRet;
-}
-
-
diff --git a/svtools/source/numbers/numfmuno.hxx b/svtools/source/numbers/numfmuno.hxx
deleted file mode 100644
index 4148069fb37e..000000000000
--- a/svtools/source/numbers/numfmuno.hxx
+++ /dev/null
@@ -1,324 +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: numfmuno.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.
- *
- ************************************************************************/
-
-#ifndef _NUMFMUNO_HXX
-#define _NUMFMUNO_HXX
-
-#include <com/sun/star/util/XNumberFormatter.hpp>
-#include <com/sun/star/util/XNumberFormatPreviewer.hpp>
-#include <com/sun/star/util/XNumberFormats.hpp>
-#include <com/sun/star/util/XNumberFormatTypes.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertyAccess.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <comphelper/sharedmutex.hxx>
-#include <rtl/ref.hxx>
-
-class SvNumberformat;
-class SvNumberFormatter;
-class SvNumberFormatsSupplierObj;
-
-
-// SvNumberFormatterServiceObj wird global als Service angemeldet
-
-class SvNumberFormatterServiceObj : public cppu::WeakImplHelper3<
- com::sun::star::util::XNumberFormatter,
- com::sun::star::util::XNumberFormatPreviewer,
- com::sun::star::lang::XServiceInfo>
-{
-private:
- ::rtl::Reference< SvNumberFormatsSupplierObj > xSupplier;
- mutable ::comphelper::SharedMutex m_aMutex;
-
-public:
- SvNumberFormatterServiceObj();
- virtual ~SvNumberFormatterServiceObj();
-
- // XNumberFormatter
- virtual void SAL_CALL attachNumberFormatsSupplier(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >
- SAL_CALL getNumberFormatsSupplier()
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL detectNumberFormat( sal_Int32 nKey, const ::rtl::OUString& aString )
- throw(::com::sun::star::util::NotNumericException,
- ::com::sun::star::uno::RuntimeException);
- virtual double SAL_CALL convertStringToNumber( sal_Int32 nKey, const ::rtl::OUString& aString )
- throw(::com::sun::star::util::NotNumericException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL convertNumberToString( sal_Int32 nKey, double fValue )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Color SAL_CALL queryColorForNumber( sal_Int32 nKey,
- double fValue, ::com::sun::star::util::Color aDefaultColor )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL formatString( sal_Int32 nKey, const ::rtl::OUString& aString )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Color SAL_CALL queryColorForString( sal_Int32 nKey,
- const ::rtl::OUString& aString,
- ::com::sun::star::util::Color aDefaultColor )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getInputString( sal_Int32 nKey, double fValue )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XNumberFormatPreviewer
- virtual ::rtl::OUString SAL_CALL convertNumberToPreviewString(
- const ::rtl::OUString& aFormat, double fValue,
- const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish )
- throw(::com::sun::star::util::MalformedNumberFormatException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::util::Color SAL_CALL queryPreviewColorForNumber(
- const ::rtl::OUString& aFormat, double fValue,
- const ::com::sun::star::lang::Locale& nLocale, sal_Bool bAllowEnglish,
- ::com::sun::star::util::Color aDefaultColor )
- throw(::com::sun::star::util::MalformedNumberFormatException,
- ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-};
-
-
-class SvNumberFormatsObj : public cppu::WeakImplHelper3<
- com::sun::star::util::XNumberFormats,
- com::sun::star::util::XNumberFormatTypes,
- com::sun::star::lang::XServiceInfo>
-{
-private:
- SvNumberFormatsSupplierObj& rSupplier;
- mutable ::comphelper::SharedMutex m_aMutex;
-
-public:
- SvNumberFormatsObj(SvNumberFormatsSupplierObj& pParent, ::comphelper::SharedMutex& _rMutex);
- virtual ~SvNumberFormatsObj();
-
-
- // XNumberFormats
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
- getByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL queryKeys( sal_Int16 nType,
- const ::com::sun::star::lang::Locale& nLocale, sal_Bool bCreate )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL queryKey( const ::rtl::OUString& aFormat,
- const ::com::sun::star::lang::Locale& nLocale, sal_Bool bScan )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL addNew( const ::rtl::OUString& aFormat,
- const ::com::sun::star::lang::Locale& nLocale )
- throw(::com::sun::star::util::MalformedNumberFormatException,
- ::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL addNewConverted( const ::rtl::OUString& aFormat,
- const ::com::sun::star::lang::Locale& nLocale,
- const ::com::sun::star::lang::Locale& nNewLocale )
- throw(::com::sun::star::util::MalformedNumberFormatException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByKey( sal_Int32 nKey ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL generateFormat( sal_Int32 nBaseKey,
- const ::com::sun::star::lang::Locale& nLocale, sal_Bool bThousands,
- sal_Bool bRed, sal_Int16 nDecimals, sal_Int16 nLeading )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XNumberFormatTypes
- virtual sal_Int32 SAL_CALL getStandardIndex( const ::com::sun::star::lang::Locale& nLocale )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getStandardFormat( sal_Int16 nType,
- const ::com::sun::star::lang::Locale& nLocale )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getFormatIndex( sal_Int16 nIndex,
- const ::com::sun::star::lang::Locale& nLocale )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isTypeCompatible( sal_Int16 nOldType, sal_Int16 nNewType )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL getFormatForLocale( sal_Int32 nKey,
- const ::com::sun::star::lang::Locale& nLocale )
- throw(::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-
-private:
- SvNumberFormatsObj(); // never implemented
-};
-
-
-class SvNumberFormatObj : public cppu::WeakImplHelper3<
- com::sun::star::beans::XPropertySet,
- com::sun::star::beans::XPropertyAccess,
- com::sun::star::lang::XServiceInfo>
-{
-private:
- SvNumberFormatsSupplierObj& rSupplier;
- ULONG nKey;
- mutable ::comphelper::SharedMutex m_aMutex;
-
-public:
- SvNumberFormatObj( SvNumberFormatsSupplierObj& rParent, ULONG nK, const ::comphelper::SharedMutex& _rMutex );
- virtual ~SvNumberFormatObj();
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
- SAL_CALL getPropertySetInfo( )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Any& aValue )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
- const ::rtl::OUString& PropertyName )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& xListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& aListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XPropertyAccess
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
- getPropertyValues() throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyValue >& aProps )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-};
-
-
-class SvNumberFormatSettingsObj : public cppu::WeakImplHelper2<
- com::sun::star::beans::XPropertySet,
- com::sun::star::lang::XServiceInfo>
-{
-private:
- SvNumberFormatsSupplierObj& rSupplier;
- mutable ::comphelper::SharedMutex m_aMutex;
-
-public:
- SvNumberFormatSettingsObj( SvNumberFormatsSupplierObj& rParent, const ::comphelper::SharedMutex& _rMutex);
- virtual ~SvNumberFormatSettingsObj();
-
-
- // XPropertySet
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
- SAL_CALL getPropertySetInfo( )
- throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Any& aValue )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::beans::PropertyVetoException,
- ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(
- const ::rtl::OUString& PropertyName )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& xListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener >& aListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XVetoableChangeListener >& aListener )
- throw(::com::sun::star::beans::UnknownPropertyException,
- ::com::sun::star::lang::WrappedTargetException,
- ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
- throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
- throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
- throw(::com::sun::star::uno::RuntimeException);
-};
-
-
-
-#endif
-
diff --git a/svtools/source/numbers/numhead.cxx b/svtools/source/numbers/numhead.cxx
deleted file mode 100644
index 7e79aad624f3..000000000000
--- a/svtools/source/numbers/numhead.cxx
+++ /dev/null
@@ -1,252 +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: numhead.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-#include <tools/debug.hxx>
-
-#include "numhead.hxx"
-
-// ID's fuer Dateien:
-#define SV_NUMID_SIZES 0x4200
-
-// STATIC DATA -----------------------------------------------------------
-
-//SEG_EOFGLOBALS()
-
-// =======================================================================
-/* wird fuer SvNumberformatter nicht gebraucht
-//#pragma SEG_FUNCDEF(numhead_01)
-
-SvNumReadHeader::SvNumReadHeader(SvStream& rNewStream) :
- rStream( rNewStream )
-{
- ULONG nDataSize;
- rStream >> nDataSize;
- nDataEnd = rStream.Tell() + nDataSize;
-}
-
-//#pragma SEG_FUNCDEF(numhead_02)
-
-SvNumReadHeader::~SvNumReadHeader()
-{
- ULONG nReadEnd = rStream.Tell();
- DBG_ASSERT( nReadEnd <= nDataEnd, "zuviele Bytes gelesen" );
- if ( nReadEnd != nDataEnd )
- rStream.Seek(nDataEnd); // Rest ueberspringen
-}
-
-//#pragma SEG_FUNCDEF(numhead_03)
-
-ULONG SvNumReadHeader::BytesLeft() const
-{
- ULONG nReadEnd = rStream.Tell();
- if (nReadEnd <= nDataEnd)
- return nDataEnd-nReadEnd;
-
- DBG_ERROR("Fehler bei SvNumReadHeader::BytesLeft");
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-//#pragma SEG_FUNCDEF(numhead_04)
-
-SvNumWriteHeader::SvNumWriteHeader(SvStream& rNewStream, ULONG nDefault) :
- rStream( rNewStream )
-{
- nDataSize = nDefault;
- rStream << nDataSize;
- nDataPos = rStream.Tell();
-}
-
-//#pragma SEG_FUNCDEF(numhead_05)
-
-SvNumWriteHeader::~SvNumWriteHeader()
-{
- ULONG nPos = rStream.Tell();
-
- if ( nPos - nDataPos != nDataSize ) // Default getroffen?
- {
- nDataSize = nPos - nDataPos;
- rStream.Seek(nDataPos - sizeof(sal_uInt32));
- rStream << nDataSize; // Groesse am Anfang eintragen
- rStream.Seek(nPos);
- }
-}
-*/
-
-// =======================================================================
-
-//#pragma SEG_FUNCDEF(numhead_06)
-
-//! mit Skip() synchron
-ImpSvNumMultipleReadHeader::ImpSvNumMultipleReadHeader(SvStream& rNewStream) :
- rStream( rNewStream )
-{
- sal_uInt32 nDataSize;
- rStream >> nDataSize;
- ULONG nDataPos = rStream.Tell();
- nEntryEnd = nDataPos;
-
- rStream.SeekRel(nDataSize);
- USHORT nID;
- rStream >> nID;
- if (nID != SV_NUMID_SIZES)
- {
- DBG_ERROR("SV_NUMID_SIZES nicht gefunden");
- }
- sal_uInt32 nSizeTableLen;
- rStream >> nSizeTableLen;
- pBuf = new char[nSizeTableLen];
- rStream.Read( pBuf, nSizeTableLen );
- pMemStream = new SvMemoryStream( pBuf, nSizeTableLen, STREAM_READ );
-
- nEndPos = rStream.Tell();
- rStream.Seek( nDataPos );
-}
-
-//#pragma SEG_FUNCDEF(numhead_07)
-
-ImpSvNumMultipleReadHeader::~ImpSvNumMultipleReadHeader()
-{
- DBG_ASSERT( pMemStream->Tell() == pMemStream->GetSize(),
- "Sizes nicht vollstaendig gelesen" );
- delete pMemStream;
- delete [] pBuf;
-
- rStream.Seek(nEndPos);
-}
-
-//! mit ctor synchron
-// static
-void ImpSvNumMultipleReadHeader::Skip( SvStream& rStream )
-{
- sal_uInt32 nDataSize;
- rStream >> nDataSize;
- rStream.SeekRel( nDataSize );
- USHORT nID;
- rStream >> nID;
- if ( nID != SV_NUMID_SIZES )
- {
- DBG_ERROR("SV_NUMID_SIZES nicht gefunden");
- }
- sal_uInt32 nSizeTableLen;
- rStream >> nSizeTableLen;
- rStream.SeekRel( nSizeTableLen );
-}
-
-//#pragma SEG_FUNCDEF(numhead_08)
-
-void ImpSvNumMultipleReadHeader::EndEntry()
-{
- ULONG nPos = rStream.Tell();
- DBG_ASSERT( nPos <= nEntryEnd, "zuviel gelesen" );
- if ( nPos != nEntryEnd )
- rStream.Seek( nEntryEnd ); // Rest ueberspringen
-}
-
-//#pragma SEG_FUNCDEF(numhead_0d)
-
-void ImpSvNumMultipleReadHeader::StartEntry()
-{
- ULONG nPos = rStream.Tell();
- sal_uInt32 nEntrySize;
- (*pMemStream) >> nEntrySize;
-
- nEntryEnd = nPos + nEntrySize;
-}
-
-//#pragma SEG_FUNCDEF(numhead_09)
-
-ULONG ImpSvNumMultipleReadHeader::BytesLeft() const
-{
- ULONG nReadEnd = rStream.Tell();
- if (nReadEnd <= nEntryEnd)
- return nEntryEnd-nReadEnd;
-
- DBG_ERROR("Fehler bei ImpSvNumMultipleReadHeader::BytesLeft");
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-//#pragma SEG_FUNCDEF(numhead_0a)
-
-ImpSvNumMultipleWriteHeader::ImpSvNumMultipleWriteHeader(SvStream& rNewStream,
- ULONG nDefault) :
- rStream( rNewStream ),
- aMemStream( 4096, 4096 )
-{
- nDataSize = nDefault;
- rStream << nDataSize;
-
- nDataPos = rStream.Tell();
- nEntryStart = nDataPos;
-}
-
-//#pragma SEG_FUNCDEF(numhead_0b)
-
-ImpSvNumMultipleWriteHeader::~ImpSvNumMultipleWriteHeader()
-{
- ULONG nDataEnd = rStream.Tell();
-
- rStream << (USHORT) SV_NUMID_SIZES;
- rStream << static_cast<sal_uInt32>(aMemStream.Tell());
- rStream.Write( aMemStream.GetData(), aMemStream.Tell() );
-
- if ( nDataEnd - nDataPos != nDataSize ) // Default getroffen?
- {
- nDataSize = nDataEnd - nDataPos;
- ULONG nPos = rStream.Tell();
- rStream.Seek(nDataPos-sizeof(sal_uInt32));
- rStream << nDataSize; // Groesse am Anfang eintragen
- rStream.Seek(nPos);
- }
-}
-
-//#pragma SEG_FUNCDEF(numhead_0c)
-
-void ImpSvNumMultipleWriteHeader::EndEntry()
-{
- ULONG nPos = rStream.Tell();
- aMemStream << static_cast<sal_uInt32>(nPos - nEntryStart);
-}
-
-//#pragma SEG_FUNCDEF(numhead_0e)
-
-void ImpSvNumMultipleWriteHeader::StartEntry()
-{
- ULONG nPos = rStream.Tell();
- nEntryStart = nPos;
-}
-
diff --git a/svtools/source/numbers/numhead.hxx b/svtools/source/numbers/numhead.hxx
deleted file mode 100644
index de23b3cbccf4..000000000000
--- a/svtools/source/numbers/numhead.hxx
+++ /dev/null
@@ -1,109 +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: numhead.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.
- *
- ************************************************************************/
-
-#ifndef NF_NUMHEAD_HXX
-#define NF_NUMHEAD_HXX
-
-#include <tools/stream.hxx>
-
-// -----------------------------------------------------------------------
-
- // "Automatischer" Record-Header mit Groessenangabe
-
-/* wird fuer SvNumberFormatter nicht gebraucht
-class SvNumReadHeader
-{
-private:
- SvStream& rStream;
- ULONG nDataEnd;
-
-public:
- SvNumReadHeader(SvStream& rNewStream);
- ~SvNumReadHeader();
-
- ULONG BytesLeft() const;
-};
-
-class SvNumWriteHeader
-{
-private:
- SvStream& rStream;
- ULONG nDataPos;
- ULONG nDataSize;
-
-public:
- SvNumWriteHeader(SvStream& rNewStream, ULONG nDefault = 0);
- ~SvNumWriteHeader();
-};
-
-*/
-
- // Header mit Groessenangaben fuer mehrere Objekte
-
-class ImpSvNumMultipleReadHeader
-{
-private:
- SvStream& rStream;
- char* pBuf;
- SvMemoryStream* pMemStream;
- ULONG nEndPos;
- ULONG nEntryEnd;
-
-public:
- ImpSvNumMultipleReadHeader(SvStream& rNewStream);
- ~ImpSvNumMultipleReadHeader();
-
- void StartEntry();
- void EndEntry();
- ULONG BytesLeft() const;
-
- static void Skip( SvStream& ); // komplett ueberspringen
-};
-
-class ImpSvNumMultipleWriteHeader
-{
-private:
- SvStream& rStream;
- SvMemoryStream aMemStream;
- ULONG nDataPos;
- sal_uInt32 nDataSize;
- ULONG nEntryStart;
-
-public:
- ImpSvNumMultipleWriteHeader(SvStream& rNewStream, ULONG nDefault = 0);
- ~ImpSvNumMultipleWriteHeader();
-
- void StartEntry();
- void EndEntry();
-};
-
-#endif
-
-
diff --git a/svtools/source/numbers/numuno.cxx b/svtools/source/numbers/numuno.cxx
deleted file mode 100644
index f91bf82b4e60..000000000000
--- a/svtools/source/numbers/numuno.cxx
+++ /dev/null
@@ -1,171 +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: numuno.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifndef GCC
-#endif
-
-#define _ZFORLIST_DECLARE_TABLE
-
-#include <vcl/svapp.hxx>
-#include <tools/color.hxx>
-#include <tools/debug.hxx>
-#include <vos/mutex.hxx>
-#include <osl/mutex.hxx>
-#include <rtl/uuid.h>
-
-#include "numuno.hxx"
-#include "numfmuno.hxx"
-#include <svtools/zforlist.hxx>
-
-using namespace com::sun::star;
-
-//------------------------------------------------------------------------
-
-class SvNumFmtSuppl_Impl
-{
-public:
- SvNumberFormatter* pFormatter;
- mutable ::comphelper::SharedMutex aMutex;
-
- SvNumFmtSuppl_Impl(SvNumberFormatter* p) :
- pFormatter(p) {}
-};
-
-//------------------------------------------------------------------------
-
-// Default-ctor fuer getReflection
-SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj()
-{
- pImpl = new SvNumFmtSuppl_Impl(NULL);
-}
-
-SvNumberFormatsSupplierObj::SvNumberFormatsSupplierObj(SvNumberFormatter* pForm)
-{
- pImpl = new SvNumFmtSuppl_Impl(pForm);
-}
-
-SvNumberFormatsSupplierObj::~SvNumberFormatsSupplierObj()
-{
- delete pImpl;
-}
-
-::comphelper::SharedMutex& SvNumberFormatsSupplierObj::getSharedMutex() const
-{
- return pImpl->aMutex;
-}
-
-SvNumberFormatter* SvNumberFormatsSupplierObj::GetNumberFormatter() const
-{
- return pImpl->pFormatter;
-}
-
-void SvNumberFormatsSupplierObj::SetNumberFormatter(SvNumberFormatter* pNew)
-{
- // der alte Numberformatter ist ungueltig geworden, nicht mehr darauf zugreifen!
- pImpl->pFormatter = pNew;
-}
-
-void SvNumberFormatsSupplierObj::NumberFormatDeleted(sal_uInt32)
-{
- // Basis-Implementierung tut nix...
-}
-
-void SvNumberFormatsSupplierObj::SettingsChanged()
-{
- // Basis-Implementierung tut nix...
-}
-
-// XNumberFormatsSupplier
-
-uno::Reference<beans::XPropertySet> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormatSettings()
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( pImpl->aMutex );
-
- return new SvNumberFormatSettingsObj( *this, pImpl->aMutex );
-}
-
-uno::Reference<util::XNumberFormats> SAL_CALL SvNumberFormatsSupplierObj::getNumberFormats()
- throw(uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( pImpl->aMutex );
-
- return new SvNumberFormatsObj( *this, pImpl->aMutex );
-}
-
-// XUnoTunnel
-
-sal_Int64 SAL_CALL SvNumberFormatsSupplierObj::getSomething(
- const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
-{
- if ( rId.getLength() == 16 &&
- 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
- rId.getConstArray(), 16 ) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
-}
-
-// static
-const uno::Sequence<sal_Int8>& SvNumberFormatsSupplierObj::getUnoTunnelId()
-{
- static uno::Sequence<sal_Int8> * pSeq = 0;
- if( !pSeq )
- {
- osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
- if( !pSeq )
- {
- static uno::Sequence< sal_Int8 > aSeq( 16 );
- rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
- pSeq = &aSeq;
- }
- }
- return *pSeq;
-}
-
-// static
-SvNumberFormatsSupplierObj* SvNumberFormatsSupplierObj::getImplementation(
- const uno::Reference<util::XNumberFormatsSupplier> xObj )
-{
- SvNumberFormatsSupplierObj* pRet = NULL;
- uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
- if (xUT.is())
- pRet = reinterpret_cast<SvNumberFormatsSupplierObj*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( getUnoTunnelId() )));
- return pRet;
-}
-
-
-//------------------------------------------------------------------------
-
-
-
diff --git a/svtools/source/numbers/supservs.cxx b/svtools/source/numbers/supservs.cxx
deleted file mode 100644
index 1035cd056406..000000000000
--- a/svtools/source/numbers/supservs.cxx
+++ /dev/null
@@ -1,233 +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: supservs.cxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include "supservs.hxx"
-#include <com/sun/star/lang/Locale.hpp>
-#include <comphelper/sharedmutex.hxx>
-#include <i18npool/mslangid.hxx>
-#include <tools/debug.hxx>
-#include <vos/mutex.hxx>
-#include <vcl/svapp.hxx>
-#include <tools/stream.hxx>
-#include <strmadpt.hxx>
-#include "instrm.hxx"
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::util;
-using namespace ::vos;
-using namespace ::utl;
-
-#define PERSISTENT_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatsSupplier");
-
-//-------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(const Reference< XMultiServiceFactory >& _rxFactory)
-{
- return static_cast< ::cppu::OWeakObject* >(new SvNumberFormatsSupplierServiceObject(_rxFactory));
-}
-
-//-------------------------------------------------------------------------
-SvNumberFormatsSupplierServiceObject::SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB)
- :m_pOwnFormatter(NULL)
- ,m_xORB(_rxORB)
-{
-}
-
-//-------------------------------------------------------------------------
-SvNumberFormatsSupplierServiceObject::~SvNumberFormatsSupplierServiceObject()
-{
- if (m_pOwnFormatter)
- {
- delete m_pOwnFormatter;
- m_pOwnFormatter = NULL;
- }
-}
-
-//-------------------------------------------------------------------------
-Any SAL_CALL SvNumberFormatsSupplierServiceObject::queryAggregation( const Type& _rType ) throw (RuntimeException)
-{
- Any aReturn = ::cppu::queryInterface(_rType,
- static_cast< XInitialization* >(this),
- static_cast< XPersistObject* >(this),
- static_cast< XServiceInfo* >(this)
- );
-
- if (!aReturn.hasValue())
- aReturn = SvNumberFormatsSupplierObj::queryAggregation(_rType);
-
- return aReturn;
-}
-
-//-------------------------------------------------------------------------
-void SAL_CALL SvNumberFormatsSupplierServiceObject::initialize( const Sequence< Any >& _rArguments ) throw(Exception, RuntimeException)
-{
- ::osl::MutexGuard aGuard( getSharedMutex() );
-
- DBG_ASSERT(m_pOwnFormatter == NULL,
- "SvNumberFormatsSupplierServiceObject::initialize : already initialized !");
- // maybe you already called a method which needed the formatter
- // you should use XMultiServiceFactory::createInstanceWithArguments to avoid that
- if (m_pOwnFormatter)
- { // !!! this is only a emergency handling, normally this should not occur !!!
- delete m_pOwnFormatter;
- m_pOwnFormatter = NULL;
- SetNumberFormatter(m_pOwnFormatter);
- }
-
- Type aExpectedArgType = ::getCppuType(static_cast<Locale*>(NULL));
- LanguageType eNewFormatterLanguage = LANGUAGE_ENGLISH_US;
- // the default
-
- const Any* pArgs = _rArguments.getConstArray();
- for (sal_Int32 i=0; i<_rArguments.getLength(); ++i, ++pArgs)
- {
- if (pArgs->getValueType().equals(aExpectedArgType))
- {
- Locale aLocale;
- *pArgs >>= aLocale;
- eNewFormatterLanguage = MsLangId::convertLocaleToLanguage( aLocale);
- }
-#ifdef DBG_UTIL
- else
- {
- DBG_ERROR("SvNumberFormatsSupplierServiceObject::initialize : unknown argument !");
- }
-#endif
- }
-
- m_pOwnFormatter = new SvNumberFormatter(m_xORB, eNewFormatterLanguage);
- m_pOwnFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );
- SetNumberFormatter(m_pOwnFormatter);
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getImplementationName( ) throw(RuntimeException)
-{
- return ::rtl::OUString::createFromAscii("com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject");
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL SvNumberFormatsSupplierServiceObject::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aServices = getSupportedServiceNames();
- const ::rtl::OUString* pServices = aServices.getConstArray();
- for (sal_Int32 i=0; i<aServices.getLength(); ++i, ++pServices)
- if (pServices->equals(_rServiceName))
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL SvNumberFormatsSupplierServiceObject::getSupportedServiceNames( ) throw(RuntimeException)
-{
- Sequence< ::rtl::OUString > aSupported(1);
- aSupported.getArray()[0] = PERSISTENT_SERVICE_NAME;
- return aSupported;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getServiceName( ) throw(RuntimeException)
-{
- return PERSISTENT_SERVICE_NAME;
-}
-
-//-------------------------------------------------------------------------
-void SAL_CALL SvNumberFormatsSupplierServiceObject::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw(IOException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( getSharedMutex() );
- implEnsureFormatter();
-
- Reference< XOutputStream > xStream(_rxOutStream.get());
- SvLockBytesRef aLockBytes = new SvOutputStreamOpenLockBytes(xStream);
- SvStream aSvOutputSteam(aLockBytes);
-
- m_pOwnFormatter->Save(aSvOutputSteam);
-}
-
-//-------------------------------------------------------------------------
-void SAL_CALL SvNumberFormatsSupplierServiceObject::read( const Reference< XObjectInputStream >& _rxInStream ) throw(IOException, RuntimeException)
-{
- ::osl::MutexGuard aGuard( getSharedMutex() );
- implEnsureFormatter();
-
- Reference< XInputStream > xStream(_rxInStream.get());
- SvInputStream aSvInputSteam(xStream);
-
- m_pOwnFormatter->Load(aSvInputSteam);
-}
-
-//-------------------------------------------------------------------------
-Reference< XPropertySet > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormatSettings() throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( getSharedMutex() );
- implEnsureFormatter();
- return SvNumberFormatsSupplierObj::getNumberFormatSettings();
-}
-
-//-------------------------------------------------------------------------
-Reference< XNumberFormats > SAL_CALL SvNumberFormatsSupplierServiceObject::getNumberFormats() throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( getSharedMutex() );
- implEnsureFormatter();
- return SvNumberFormatsSupplierObj::getNumberFormats();
-}
-
-//-------------------------------------------------------------------------
-sal_Int64 SAL_CALL SvNumberFormatsSupplierServiceObject::getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw (RuntimeException)
-{
- sal_Int64 nReturn = SvNumberFormatsSupplierObj::getSomething( aIdentifier );
- if ( nReturn )
- // if somebody accesses internals then we should have the formatter
- implEnsureFormatter();
- return nReturn;
-}
-
-//-------------------------------------------------------------------------
-void SvNumberFormatsSupplierServiceObject::implEnsureFormatter()
-{
- if (!m_pOwnFormatter)
- {
- // get the office's UI locale
- SvtSysLocale aSysLocale;
- Locale aOfficeLocale = aSysLocale.GetLocaleData().getLocale();
-
- // initi with this locale
- Sequence< Any > aFakedInitProps( 1 );
- aFakedInitProps[0] <<= aOfficeLocale;
-
- initialize( aFakedInitProps );
- }
-}
-
diff --git a/svtools/source/numbers/supservs.hxx b/svtools/source/numbers/supservs.hxx
deleted file mode 100644
index df48d6567ecc..000000000000
--- a/svtools/source/numbers/supservs.hxx
+++ /dev/null
@@ -1,105 +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: supservs.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 _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
-#define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
-
-#include "numuno.hxx"
-#include <svtools/zforlist.hxx>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/io/XPersistObject.hpp>
-
-//=========================================================================
-//= SvNumberFormatsSupplierServiceObject - a number formats supplier which
-//= - can be instantiated as an service
-//= - supports the ::com::sun::star::io::XPersistObject interface
-//= - works with it's own SvNumberFormatter instance
-//= - can be initialized (::com::sun::star::lang::XInitialization)
-//= with a specific language (i.e. ::com::sun::star::lang::Locale)
-//=========================================================================
-class SvNumberFormatsSupplierServiceObject
- :protected SvNumberFormatsSupplierObj
- ,public ::com::sun::star::lang::XInitialization
- ,public ::com::sun::star::io::XPersistObject
- ,public ::com::sun::star::lang::XServiceInfo
-{ // don't want the Set-/GetNumberFormatter to be accessable from outside
-
- friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
- SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
-
-protected:
- SvNumberFormatter* m_pOwnFormatter;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
- m_xORB;
-
-public:
- SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
- ~SvNumberFormatsSupplierServiceObject();
-
- // XInterface
- virtual void SAL_CALL acquire() throw() { SvNumberFormatsSupplierObj::acquire(); }
- virtual void SAL_CALL release() throw() { SvNumberFormatsSupplierObj::release(); }
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException)
- { return SvNumberFormatsSupplierObj::queryInterface(_rType); }
-
- // XAggregation
- virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
-
- // XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
-
- // XPersistObject
- virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
-
- // XNumberFormatsSupplier
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
- getNumberFormatSettings() throw(::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL
- getNumberFormats() throw(::com::sun::star::uno::RuntimeException);
-
- // XUnoTunnler
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
-
-protected:
- void implEnsureFormatter();
-};
-
-
-#endif // _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
-
diff --git a/svtools/source/numbers/zforfind.cxx b/svtools/source/numbers/zforfind.cxx
deleted file mode 100644
index 7aac440e8b58..000000000000
--- a/svtools/source/numbers/zforfind.cxx
+++ /dev/null
@@ -1,2819 +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: zforfind.cxx,v $
- * $Revision: 1.51.96.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <float.h>
-#include <errno.h>
-#include <tools/date.hxx>
-#include <tools/debug.hxx>
-#include <rtl/math.hxx>
-#include <unotools/charclass.hxx>
-#include <unotools/calendarwrapper.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
-#include <unotools/digitgroupingiterator.hxx>
-
-#include <svtools/zforlist.hxx> // NUMBERFORMAT_XXX
-#include "zforscan.hxx"
-#include <svtools/zformat.hxx>
-
-#define _ZFORFIND_CXX
-#include "zforfind.hxx"
-#undef _ZFORFIND_CXX
-
-
-#ifdef PRODUCT
-#define NF_TEST_CALENDAR 0
-#else
-#define NF_TEST_CALENDAR 0
-#endif
-#if NF_TEST_CALENDAR
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/i18n/XExtendedCalendar.hpp>
-#endif
-
-
-const BYTE ImpSvNumberInputScan::nMatchedEndString = 0x01;
-const BYTE ImpSvNumberInputScan::nMatchedMidString = 0x02;
-const BYTE ImpSvNumberInputScan::nMatchedStartString = 0x04;
-const BYTE ImpSvNumberInputScan::nMatchedVirgin = 0x08;
-const BYTE ImpSvNumberInputScan::nMatchedUsedAsReturn = 0x10;
-
-/* It is not clear how we want timezones to be handled. Convert them to local
- * time isn't wanted, as it isn't done in any other place and timezone
- * information isn't stored anywhere. Ignoring them and pretending local time
- * may be wrong too and might not be what the user expects. Keep the input as
- * string so that no information is lost.
- * Anyway, defining NF_RECOGNIZE_ISO8601_TIMEZONES to 1 would be the way how it
- * would work, together with the nTimezonePos handling in GetTimeRef(). */
-#define NF_RECOGNIZE_ISO8601_TIMEZONES 0
-
-//---------------------------------------------------------------------------
-// Konstruktor
-
-ImpSvNumberInputScan::ImpSvNumberInputScan( SvNumberFormatter* pFormatterP )
- :
- pUpperMonthText( NULL ),
- pUpperAbbrevMonthText( NULL ),
- pUpperDayText( NULL ),
- pUpperAbbrevDayText( NULL )
-{
- pFormatter = pFormatterP;
- pNullDate = new Date(30,12,1899);
- nYear2000 = SvNumberFormatter::GetYear2000Default();
- Reset();
- ChangeIntl();
-}
-
-
-//---------------------------------------------------------------------------
-// Destruktor
-
-ImpSvNumberInputScan::~ImpSvNumberInputScan()
-{
- Reset();
- delete pNullDate;
- delete [] pUpperMonthText;
- delete [] pUpperAbbrevMonthText;
- delete [] pUpperDayText;
- delete [] pUpperAbbrevDayText;
-}
-
-
-//---------------------------------------------------------------------------
-// Reset
-
-void ImpSvNumberInputScan::Reset()
-{
-#if 0
-// ER 16.06.97 18:56 Vorbelegung erfolgt jetzt in NumberStringDivision,
-// wozu immer alles loeschen wenn einiges wieder benutzt oder gar nicht
-// gebraucht wird..
- for (USHORT i = 0; i < SV_MAX_ANZ_INPUT_STRINGS; i++)
- {
- sStrArray[i].Erase();
- nNums[i] = SV_MAX_ANZ_INPUT_STRINGS-1;
- IsNum[i] = FALSE;
- }
-#endif
- nMonth = 0;
- nMonthPos = 0;
- nTimePos = 0;
- nSign = 0;
- nESign = 0;
- nDecPos = 0;
- nNegCheck = 0;
- nAnzStrings = 0;
- nAnzNums = 0;
- nThousand = 0;
- eScannedType = NUMBERFORMAT_UNDEFINED;
- nAmPm = 0;
- nPosThousandString = 0;
- nLogical = 0;
- nStringScanNumFor = 0;
- nStringScanSign = 0;
- nMatchedAllStrings = nMatchedVirgin;
- nMayBeIso8601 = 0;
- nTimezonePos = 0;
-}
-
-
-//---------------------------------------------------------------------------
-//
-// static
-inline BOOL ImpSvNumberInputScan::MyIsdigit( sal_Unicode c )
-{
- // If the input string wouldn't be converted using TransformInput() we'd
- // to use something similar to the following and to adapt many places.
-#if 0
- // use faster isdigit() if possible
- if ( c < 128 )
- return isdigit( (unsigned char) c ) != 0;
- if ( c < 256 )
- return FALSE;
- String aTmp( c );
- return pFormatter->GetCharClass()->isDigit( aTmp, 0 );
-#else
- return c < 128 && isdigit( (unsigned char) c );
-#endif
-}
-
-
-//---------------------------------------------------------------------------
-//
-void ImpSvNumberInputScan::TransformInput( String& rStr )
-{
- xub_StrLen nPos, nLen;
- for ( nPos = 0, nLen = rStr.Len(); nPos < nLen; ++nPos )
- {
- if ( 256 <= rStr.GetChar( nPos ) &&
- pFormatter->GetCharClass()->isDigit( rStr, nPos ) )
- break;
- }
- if ( nPos < nLen )
- rStr = pFormatter->GetNatNum()->getNativeNumberString( rStr,
- pFormatter->GetLocale(), 0 );
-}
-
-
-//---------------------------------------------------------------------------
-// StringToDouble
-//
-// Only simple unsigned floating point values without any error detection,
-// decimal separator has to be '.'
-
-double ImpSvNumberInputScan::StringToDouble( const String& rStr, BOOL bForceFraction )
-{
- double fNum = 0.0;
- double fFrac = 0.0;
- int nExp = 0;
- xub_StrLen nPos = 0;
- xub_StrLen nLen = rStr.Len();
- BOOL bPreSep = !bForceFraction;
-
- while (nPos < nLen)
- {
- if (rStr.GetChar(nPos) == '.')
- bPreSep = FALSE;
- else if (bPreSep)
- fNum = fNum * 10.0 + (double) (rStr.GetChar(nPos) - '0');
- else
- {
- fFrac = fFrac * 10.0 + (double) (rStr.GetChar(nPos) - '0');
- --nExp;
- }
- nPos++;
- }
- if ( fFrac )
- return fNum + ::rtl::math::pow10Exp( fFrac, nExp );
- return fNum;
-}
-
-
-//---------------------------------------------------------------------------
-// NextNumberStringSymbol
-//
-// Zerlegt die Eingabe in Zahlen und Strings fuer die weitere
-// Verarbeitung (Turing-Maschine).
-//---------------------------------------------------------------------------
-// Ausgangs Zustand = GetChar
-//---------------+-------------------+-----------------------+---------------
-// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand
-//---------------+-------------------+-----------------------+---------------
-// GetChar | Ziffer | Symbol=Zeichen | GetValue
-// | Sonst | Symbol=Zeichen | GetString
-//---------------|-------------------+-----------------------+---------------
-// GetValue | Ziffer | Symbol=Symbol+Zeichen | GetValue
-// | Sonst | Dec(CharPos) | Stop
-//---------------+-------------------+-----------------------+---------------
-// GetString | Ziffer | Dec(CharPos) | Stop
-// | Sonst | Symbol=Symbol+Zeichen | GetString
-//---------------+-------------------+-----------------------+---------------
-
-enum ScanState // States der Turing-Maschine
-{
- SsStop = 0,
- SsStart = 1,
- SsGetValue = 2,
- SsGetString = 3
-};
-
-BOOL ImpSvNumberInputScan::NextNumberStringSymbol(
- const sal_Unicode*& pStr,
- String& rSymbol )
-{
- BOOL isNumber = FALSE;
- sal_Unicode cToken;
- ScanState eState = SsStart;
- register const sal_Unicode* pHere = pStr;
- register xub_StrLen nChars = 0;
-
- while ( ((cToken = *pHere) != 0) && eState != SsStop)
- {
- pHere++;
- switch (eState)
- {
- case SsStart:
- if ( MyIsdigit( cToken ) )
- {
- eState = SsGetValue;
- isNumber = TRUE;
- }
- else
- eState = SsGetString;
- nChars++;
- break;
- case SsGetValue:
- if ( MyIsdigit( cToken ) )
- nChars++;
- else
- {
- eState = SsStop;
- pHere--;
- }
- break;
- case SsGetString:
- if ( !MyIsdigit( cToken ) )
- nChars++;
- else
- {
- eState = SsStop;
- pHere--;
- }
- break;
- default:
- break;
- } // switch
- } // while
-
- if ( nChars )
- rSymbol.Assign( pStr, nChars );
- else
- rSymbol.Erase();
-
- pStr = pHere;
-
- return isNumber;
-}
-
-
-//---------------------------------------------------------------------------
-// SkipThousands
-
-// FIXME: should be grouping; it is only used though in case nAnzStrings is
-// near SV_MAX_ANZ_INPUT_STRINGS, in NumberStringDivision().
-
-BOOL ImpSvNumberInputScan::SkipThousands(
- const sal_Unicode*& pStr,
- String& rSymbol )
-{
- BOOL res = FALSE;
- sal_Unicode cToken;
- const String& rThSep = pFormatter->GetNumThousandSep();
- register const sal_Unicode* pHere = pStr;
- ScanState eState = SsStart;
- xub_StrLen nCounter = 0; // counts 3 digits
-
- while ( ((cToken = *pHere) != 0) && eState != SsStop)
- {
- pHere++;
- switch (eState)
- {
- case SsStart:
- if ( StringPtrContains( rThSep, pHere-1, 0 ) )
- {
- nCounter = 0;
- eState = SsGetValue;
- pHere += rThSep.Len()-1;
- }
- else
- {
- eState = SsStop;
- pHere--;
- }
- break;
- case SsGetValue:
- if ( MyIsdigit( cToken ) )
- {
- rSymbol += cToken;
- nCounter++;
- if (nCounter == 3)
- {
- eState = SsStart;
- res = TRUE; // .000 combination found
- }
- }
- else
- {
- eState = SsStop;
- pHere--;
- }
- break;
- default:
- break;
- } // switch
- } // while
-
- if (eState == SsGetValue) // break witth less than 3 digits
- {
- if ( nCounter )
- rSymbol.Erase( rSymbol.Len() - nCounter, nCounter );
- pHere -= nCounter + rThSep.Len(); // put back ThSep also
- }
- pStr = pHere;
-
- return res;
-}
-
-
-//---------------------------------------------------------------------------
-// NumberStringDivision
-
-void ImpSvNumberInputScan::NumberStringDivision( const String& rString )
-{
- const sal_Unicode* pStr = rString.GetBuffer();
- const sal_Unicode* const pEnd = pStr + rString.Len();
- while ( pStr < pEnd && nAnzStrings < SV_MAX_ANZ_INPUT_STRINGS )
- {
- if ( NextNumberStringSymbol( pStr, sStrArray[nAnzStrings] ) )
- { // Zahl
- IsNum[nAnzStrings] = TRUE;
- nNums[nAnzNums] = nAnzStrings;
- nAnzNums++;
- if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS - 7 &&
- nPosThousandString == 0) // nur einmal
- if ( SkipThousands( pStr, sStrArray[nAnzStrings] ) )
- nPosThousandString = nAnzStrings;
- }
- else
- {
- IsNum[nAnzStrings] = FALSE;
- }
- nAnzStrings++;
- }
-}
-
-
-//---------------------------------------------------------------------------
-// Whether rString contains rWhat at nPos
-
-BOOL ImpSvNumberInputScan::StringContainsImpl( const String& rWhat,
- const String& rString, xub_StrLen nPos )
-{
- if ( nPos + rWhat.Len() <= rString.Len() )
- return StringPtrContainsImpl( rWhat, rString.GetBuffer(), nPos );
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// Whether pString contains rWhat at nPos
-
-BOOL ImpSvNumberInputScan::StringPtrContainsImpl( const String& rWhat,
- const sal_Unicode* pString, xub_StrLen nPos )
-{
- if ( rWhat.Len() == 0 )
- return FALSE;
- register const sal_Unicode* pWhat = rWhat.GetBuffer();
- register const sal_Unicode* const pEnd = pWhat + rWhat.Len();
- register const sal_Unicode* pStr = pString + nPos;
- while ( pWhat < pEnd )
- {
- if ( *pWhat != *pStr )
- return FALSE;
- pWhat++;
- pStr++;
- }
- return TRUE;
-}
-
-
-//---------------------------------------------------------------------------
-// SkipChar
-//
-// ueberspringt genau das angegebene Zeichen
-
-inline BOOL ImpSvNumberInputScan::SkipChar( sal_Unicode c, const String& rString,
- xub_StrLen& nPos )
-{
- if ((nPos < rString.Len()) && (rString.GetChar(nPos) == c))
- {
- nPos++;
- return TRUE;
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// SkipBlanks
-//
-// Ueberspringt Leerzeichen
-
-inline void ImpSvNumberInputScan::SkipBlanks( const String& rString,
- xub_StrLen& nPos )
-{
- if ( nPos < rString.Len() )
- {
- register const sal_Unicode* p = rString.GetBuffer() + nPos;
- while ( *p == ' ' )
- {
- nPos++;
- p++;
- }
- }
-}
-
-
-//---------------------------------------------------------------------------
-// SkipString
-//
-// jump over rWhat in rString at nPos
-
-inline BOOL ImpSvNumberInputScan::SkipString( const String& rWhat,
- const String& rString, xub_StrLen& nPos )
-{
- if ( StringContains( rWhat, rString, nPos ) )
- {
- nPos = nPos + rWhat.Len();
- return TRUE;
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// GetThousandSep
-//
-// recognizes exactly ,111 in {3} and {3,2} or ,11 in {3,2} grouping
-
-inline BOOL ImpSvNumberInputScan::GetThousandSep(
- const String& rString,
- xub_StrLen& nPos,
- USHORT nStringPos )
-{
- const String& rSep = pFormatter->GetNumThousandSep();
- // Is it an ordinary space instead of a non-breaking space?
- bool bSpaceBreak = rSep.GetChar(0) == 0xa0 && rString.GetChar(0) == 0x20 &&
- rSep.Len() == 1 && rString.Len() == 1;
- if (!( (rString == rSep || bSpaceBreak) // nothing else
- && nStringPos < nAnzStrings - 1 // safety first!
- && IsNum[nStringPos+1] )) // number follows
- return FALSE; // no? => out
-
- utl::DigitGroupingIterator aGrouping(
- pFormatter->GetLocaleData()->getDigitGrouping());
- // Match ,### in {3} or ,## in {3,2}
- /* FIXME: this could be refined to match ,## in {3,2} only if ,##,## or
- * ,##,### and to match ,### in {3,2} only if it's the last. However,
- * currently there is no track kept where group separators occur. In {3,2}
- * #,###,### and #,##,## would be valid input, which maybe isn't even bad
- * for #,###,###. Other combinations such as #,###,## maybe not. */
- xub_StrLen nLen = sStrArray[nStringPos+1].Len();
- if (nLen == aGrouping.get() // with 3 (or so) digits
- || nLen == aGrouping.advance().get() // or with 2 (or 3 or so) digits
- || nPosThousandString == nStringPos+1 // or concatenated
- )
- {
- nPos = nPos + rSep.Len();
- return TRUE;
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// GetLogical
-//
-// Conversion of text to logial value
-// "TRUE" => 1:
-// "FALSE"=> -1:
-// else => 0:
-
-short ImpSvNumberInputScan::GetLogical( const String& rString )
-{
- short res;
-
- const ImpSvNumberformatScan* pFS = pFormatter->GetFormatScanner();
- if ( rString == pFS->GetTrueString() )
- res = 1;
- else if ( rString == pFS->GetFalseString() )
- res = -1;
- else
- res = 0;
-
- return res;
-}
-
-
-//---------------------------------------------------------------------------
-// GetMonth
-//
-// Converts a string containing a month name (JAN, January) at nPos into the
-// month number (negative if abbreviated), returns 0 if nothing found
-
-short ImpSvNumberInputScan::GetMonth( const String& rString, xub_StrLen& nPos )
-{
- // #102136# The correct English form of month September abbreviated is
- // SEPT, but almost every data contains SEP instead.
- static const String aSeptCorrect( RTL_CONSTASCII_USTRINGPARAM( "SEPT" ) );
- static const String aSepShortened( RTL_CONSTASCII_USTRINGPARAM( "SEP" ) );
-
- short res = 0; // no month found
-
- if (rString.Len() > nPos) // only if needed
- {
- if ( !bTextInitialized )
- InitText();
- sal_Int16 nMonths = pFormatter->GetCalendar()->getNumberOfMonthsInYear();
- for ( sal_Int16 i = 0; i < nMonths; i++ )
- {
- if ( StringContains( pUpperMonthText[i], rString, nPos ) )
- { // full names first
- nPos = nPos + pUpperMonthText[i].Len();
- res = i+1;
- break; // for
- }
- else if ( StringContains( pUpperAbbrevMonthText[i], rString, nPos ) )
- { // abbreviated
- nPos = nPos + pUpperAbbrevMonthText[i].Len();
- res = sal::static_int_cast< short >(-(i+1)); // negative
- break; // for
- }
- else if ( i == 8 && pUpperAbbrevMonthText[i] == aSeptCorrect &&
- StringContains( aSepShortened, rString, nPos ) )
- { // #102136# SEPT/SEP
- nPos = nPos + aSepShortened.Len();
- res = sal::static_int_cast< short >(-(i+1)); // negative
- break; // for
- }
- }
- }
-
- return res;
-}
-
-
-//---------------------------------------------------------------------------
-// GetDayOfWeek
-//
-// Converts a string containing a DayOfWeek name (Mon, Monday) at nPos into the
-// DayOfWeek number + 1 (negative if abbreviated), returns 0 if nothing found
-
-int ImpSvNumberInputScan::GetDayOfWeek( const String& rString, xub_StrLen& nPos )
-{
- int res = 0; // no day found
-
- if (rString.Len() > nPos) // only if needed
- {
- if ( !bTextInitialized )
- InitText();
- sal_Int16 nDays = pFormatter->GetCalendar()->getNumberOfDaysInWeek();
- for ( sal_Int16 i = 0; i < nDays; i++ )
- {
- if ( StringContains( pUpperDayText[i], rString, nPos ) )
- { // full names first
- nPos = nPos + pUpperDayText[i].Len();
- res = i + 1;
- break; // for
- }
- if ( StringContains( pUpperAbbrevDayText[i], rString, nPos ) )
- { // abbreviated
- nPos = nPos + pUpperAbbrevDayText[i].Len();
- res = -(i + 1); // negative
- break; // for
- }
- }
- }
-
- return res;
-}
-
-
-//---------------------------------------------------------------------------
-// GetCurrency
-//
-// Lesen eines Waehrungssysmbols
-// '$' => TRUE
-// sonst => FALSE
-
-BOOL ImpSvNumberInputScan::GetCurrency( const String& rString, xub_StrLen& nPos,
- const SvNumberformat* pFormat )
-{
- if ( rString.Len() > nPos )
- {
- if ( !aUpperCurrSymbol.Len() )
- { // if no format specified the currency of the initialized formatter
- LanguageType eLang = (pFormat ? pFormat->GetLanguage() :
- pFormatter->GetLanguage());
- aUpperCurrSymbol = pFormatter->GetCharClass()->upper(
- SvNumberFormatter::GetCurrencyEntry( eLang ).GetSymbol() );
- }
- if ( StringContains( aUpperCurrSymbol, rString, nPos ) )
- {
- nPos = nPos + aUpperCurrSymbol.Len();
- return TRUE;
- }
- if ( pFormat )
- {
- String aSymbol, aExtension;
- if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) )
- {
- if ( aSymbol.Len() <= rString.Len() - nPos )
- {
- pFormatter->GetCharClass()->toUpper( aSymbol );
- if ( StringContains( aSymbol, rString, nPos ) )
- {
- nPos = nPos + aSymbol.Len();
- return TRUE;
- }
- }
- }
- }
- }
-
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// GetTimeAmPm
-//
-// Lesen des Zeitsymbols (AM od. PM) f. kurze Zeitangabe
-//
-// Rueckgabe:
-// "AM" od. "PM" => TRUE
-// sonst => FALSE
-//
-// nAmPos:
-// "AM" => 1
-// "PM" => -1
-// sonst => 0
-
-BOOL ImpSvNumberInputScan::GetTimeAmPm( const String& rString, xub_StrLen& nPos )
-{
-
- if ( rString.Len() > nPos )
- {
- const CharClass* pChr = pFormatter->GetCharClass();
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
- if ( StringContains( pChr->upper( pLoc->getTimeAM() ), rString, nPos ) )
- {
- nAmPm = 1;
- nPos = nPos + pLoc->getTimeAM().Len();
- return TRUE;
- }
- else if ( StringContains( pChr->upper( pLoc->getTimePM() ), rString, nPos ) )
- {
- nAmPm = -1;
- nPos = nPos + pLoc->getTimePM().Len();
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// GetDecSep
-//
-// Lesen eines Dezimaltrenners (',')
-// ',' => TRUE
-// sonst => FALSE
-
-inline BOOL ImpSvNumberInputScan::GetDecSep( const String& rString, xub_StrLen& nPos )
-{
- if ( rString.Len() > nPos )
- {
- const String& rSep = pFormatter->GetNumDecimalSep();
- if ( rString.Equals( rSep, nPos, rSep.Len() ) )
- {
- nPos = nPos + rSep.Len();
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// read a hundredth seconds separator
-
-inline BOOL ImpSvNumberInputScan::GetTime100SecSep( const String& rString, xub_StrLen& nPos )
-{
- if ( rString.Len() > nPos )
- {
- const String& rSep = pFormatter->GetLocaleData()->getTime100SecSep();
- if ( rString.Equals( rSep, nPos, rSep.Len() ) )
- {
- nPos = nPos + rSep.Len();
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// GetSign
-//
-// Lesen eines Vorzeichens, auch Klammer !?!
-// '+' => 1
-// '-' => -1
-// '(' => -1, nNegCheck = 1
-// sonst => 0
-
-int ImpSvNumberInputScan::GetSign( const String& rString, xub_StrLen& nPos )
-{
- if (rString.Len() > nPos)
- switch (rString.GetChar(nPos))
- {
- case '+':
- nPos++;
- return 1;
- case '(': // '(' aehnlich wie '-' ?!?
- nNegCheck = 1;
- //! fallthru
- case '-':
- nPos++;
- return -1;
- default:
- break;
- }
-
- return 0;
-}
-
-
-//---------------------------------------------------------------------------
-// GetESign
-//
-// Lesen eines Vorzeichens, gedacht fuer Exponent ?!?
-// '+' => 1
-// '-' => -1
-// sonst => 0
-
-short ImpSvNumberInputScan::GetESign( const String& rString, xub_StrLen& nPos )
-{
- if (rString.Len() > nPos)
- switch (rString.GetChar(nPos))
- {
- case '+':
- nPos++;
- return 1;
- case '-':
- nPos++;
- return -1;
- default:
- break;
- }
-
- return 0;
-}
-
-
-//---------------------------------------------------------------------------
-// GetNextNumber
-//
-// i counts string portions, j counts numbers thereof.
-// It should had been called SkipNumber instead.
-
-inline BOOL ImpSvNumberInputScan::GetNextNumber( USHORT& i, USHORT& j )
-{
- if ( i < nAnzStrings && IsNum[i] )
- {
- j++;
- i++;
- return TRUE;
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// GetTimeRef
-
-void ImpSvNumberInputScan::GetTimeRef(
- double& fOutNumber,
- USHORT nIndex, // j-value of the first numeric time part of input, default 0
- USHORT nAnz ) // count of numeric time parts
-{
- USHORT nHour;
- USHORT nMinute = 0;
- USHORT nSecond = 0;
- double fSecond100 = 0.0;
- USHORT nStartIndex = nIndex;
-
- if (nTimezonePos)
- {
- // find first timezone number index and adjust count
- for (USHORT j=0; j<nAnzNums; ++j)
- {
- if (nNums[j] == nTimezonePos)
- {
- // nAnz is not total count, but count of time relevant strings.
- if (nStartIndex < j && j - nStartIndex < nAnz)
- nAnz = j - nStartIndex;
- break; // for
- }
- }
- }
-
- if (nDecPos == 2 && (nAnz == 3 || nAnz == 2)) // 20:45.5 or 45.5
- nHour = 0;
- else if (nIndex - nStartIndex < nAnz)
- nHour = (USHORT) sStrArray[nNums[nIndex++]].ToInt32();
- else
- {
- nHour = 0;
- DBG_ERRORFILE( "ImpSvNumberInputScan::GetTimeRef: bad number index");
- }
- if (nDecPos == 2 && nAnz == 2) // 45.5
- nMinute = 0;
- else if (nIndex - nStartIndex < nAnz)
- nMinute = (USHORT) sStrArray[nNums[nIndex++]].ToInt32();
- if (nIndex - nStartIndex < nAnz)
- nSecond = (USHORT) sStrArray[nNums[nIndex++]].ToInt32();
- if (nIndex - nStartIndex < nAnz)
- fSecond100 = StringToDouble( sStrArray[nNums[nIndex]], TRUE );
- if (nAmPm == -1 && nHour != 12) // PM
- nHour += 12;
- else if (nAmPm == 1 && nHour == 12) // 12 AM
- nHour = 0;
-
- fOutNumber = ((double)nHour*3600 +
- (double)nMinute*60 +
- (double)nSecond +
- fSecond100)/86400.0;
-}
-
-
-//---------------------------------------------------------------------------
-// ImplGetDay
-
-USHORT ImpSvNumberInputScan::ImplGetDay( USHORT nIndex )
-{
- USHORT nRes = 0;
-
- if (sStrArray[nNums[nIndex]].Len() <= 2)
- {
- USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32();
- if (nNum <= 31)
- nRes = nNum;
- }
-
- return nRes;
-}
-
-
-//---------------------------------------------------------------------------
-// ImplGetMonth
-
-USHORT ImpSvNumberInputScan::ImplGetMonth( USHORT nIndex )
-{
- // preset invalid month number
- USHORT nRes = pFormatter->GetCalendar()->getNumberOfMonthsInYear();
-
- if (sStrArray[nNums[nIndex]].Len() <= 2)
- {
- USHORT nNum = (USHORT) sStrArray[nNums[nIndex]].ToInt32();
- if ( 0 < nNum && nNum <= nRes )
- nRes = nNum - 1; // zero based for CalendarFieldIndex::MONTH
- }
-
- return nRes;
-}
-
-
-//---------------------------------------------------------------------------
-// ImplGetYear
-//
-// 30 -> 1930, 29 -> 2029, oder 56 -> 1756, 55 -> 1855, ...
-
-USHORT ImpSvNumberInputScan::ImplGetYear( USHORT nIndex )
-{
- USHORT nYear = 0;
-
- if (sStrArray[nNums[nIndex]].Len() <= 4)
- {
- nYear = (USHORT) sStrArray[nNums[nIndex]].ToInt32();
- nYear = SvNumberFormatter::ExpandTwoDigitYear( nYear, nYear2000 );
- }
-
- return nYear;
-}
-
-//---------------------------------------------------------------------------
-
-bool ImpSvNumberInputScan::MayBeIso8601()
-{
- if (nMayBeIso8601 == 0)
- {
- if (nAnzNums >= 3 && nNums[0] < nAnzStrings &&
- sStrArray[nNums[0]].ToInt32() > 31)
- nMayBeIso8601 = 1;
- else
- nMayBeIso8601 = 2;
- }
- return nMayBeIso8601 == 1;
-}
-
-//---------------------------------------------------------------------------
-// GetDateRef
-
-BOOL ImpSvNumberInputScan::GetDateRef( double& fDays, USHORT& nCounter,
- const SvNumberformat* pFormat )
-{
- using namespace ::com::sun::star::i18n;
- NfEvalDateFormat eEDF;
- int nFormatOrder;
- if ( pFormat && ((pFormat->GetType() & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE) )
- {
- eEDF = pFormatter->GetEvalDateFormat();
- switch ( eEDF )
- {
- case NF_EVALDATEFORMAT_INTL :
- case NF_EVALDATEFORMAT_FORMAT :
- nFormatOrder = 1; // only one loop
- break;
- default:
- nFormatOrder = 2;
- if ( nMatchedAllStrings )
- eEDF = NF_EVALDATEFORMAT_FORMAT_INTL;
- // we have a complete match, use it
- }
- }
- else
- {
- eEDF = NF_EVALDATEFORMAT_INTL;
- nFormatOrder = 1;
- }
- BOOL res = TRUE;
-
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
- CalendarWrapper* pCal = pFormatter->GetCalendar();
- for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ )
- {
- pCal->setGregorianDateTime( Date() ); // today
- String aOrgCalendar; // empty => not changed yet
- DateFormat DateFmt;
- BOOL bFormatTurn;
- switch ( eEDF )
- {
- case NF_EVALDATEFORMAT_INTL :
- bFormatTurn = FALSE;
- DateFmt = pLoc->getDateFormat();
- break;
- case NF_EVALDATEFORMAT_FORMAT :
- bFormatTurn = TRUE;
- DateFmt = pFormat->GetDateOrder();
- break;
- case NF_EVALDATEFORMAT_INTL_FORMAT :
- if ( nTryOrder == 1 )
- {
- bFormatTurn = FALSE;
- DateFmt = pLoc->getDateFormat();
- }
- else
- {
- bFormatTurn = TRUE;
- DateFmt = pFormat->GetDateOrder();
- }
- break;
- case NF_EVALDATEFORMAT_FORMAT_INTL :
- if ( nTryOrder == 2 )
- {
- bFormatTurn = FALSE;
- DateFmt = pLoc->getDateFormat();
- }
- else
- {
- bFormatTurn = TRUE;
- DateFmt = pFormat->GetDateOrder();
- }
- break;
- default:
- DBG_ERROR( "ImpSvNumberInputScan::GetDateRef: unknown NfEvalDateFormat" );
- DateFmt = YMD;
- bFormatTurn = FALSE;
- }
- if ( bFormatTurn )
- {
-#if 0
-/* TODO:
-We are currently not able to fully support a switch to another calendar during
-input for the following reasons:
-1. We do have a problem if both (locale's default and format's) calendars
- define the same YMD order and use the same date separator, there is no way
- to distinguish between them if the input results in valid calendar input for
- both calendars. How to solve? Would NfEvalDateFormat be sufficient? Should
- it always be set to NF_EVALDATEFORMAT_FORMAT_INTL and thus the format's
- calendar be preferred? This could be confusing if a Calc cell was formatted
- different to the locale's default and has no content yet, then the user has
- no clue about the format or calendar being set.
-2. In Calc cell edit mode a date is always displayed and edited using the
- default edit format of the default calendar (normally being Gregorian). If
- input was ambiguous due to issue #1 we'd need a mechanism to tell that a
- date was edited and not newly entered. Not feasible. Otherwise we'd need a
- mechanism to use a specific edit format with a specific calendar according
- to the format set.
-3. For some calendars like Japanese Gengou we'd need era input, which isn't
- implemented at all. Though this is a rare and special case, forcing a
- calendar dependent edit format as suggested in item #2 might require era
- input, if it shouldn't result in a fallback to Gregorian calendar.
-4. Last and least: the GetMonth() method currently only matches month names of
- the default calendar. Alternating month names of the actual format's
- calendar would have to be implemented. No problem.
-
-*/
- if ( pFormat->IsOtherCalendar( nStringScanNumFor ) )
- pFormat->SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- else
- pFormat->SwitchToSpecifiedCalendar( aOrgCalendar, fOrgDateTime,
- nStringScanNumFor );
-#endif
- }
-
- res = TRUE;
- nCounter = 0;
- // For incomplete dates, always assume first day of month if not specified.
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 );
-
- switch (nAnzNums) // count of numbers in string
- {
- case 0: // none
- if (nMonthPos) // only month (Jan)
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- else
- res = FALSE;
- break;
-
- case 1: // only one number
- nCounter = 1;
- switch (nMonthPos) // where is the month
- {
- case 0: // not found => only day entered
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- break;
- case 1: // month at the beginning (Jan 01)
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- switch (DateFmt)
- {
- case MDY:
- case YMD:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- break;
- case DMY:
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- case 3: // month at the end (10 Jan)
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- switch (DateFmt)
- {
- case DMY:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- break;
- case YMD:
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- default:
- res = FALSE;
- break;
- } // switch (nMonthPos)
- break;
-
- case 2: // 2 numbers
- nCounter = 2;
- switch (nMonthPos) // where is the month
- {
- case 0: // not found
- {
- bool bHadExact;
- sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : 0);
- if ( 0xff < nExactDateOrder && nExactDateOrder <= 0xffff )
- { // formatted as date and exactly 2 parts
- bHadExact = true;
- switch ( (nExactDateOrder >> 8) & 0xff )
- {
- case 'Y':
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- break;
- case 'M':
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
- break;
- case 'D':
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- break;
- default:
- bHadExact = false;
- }
- switch ( nExactDateOrder & 0xff )
- {
- case 'Y':
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- break;
- case 'M':
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
- break;
- case 'D':
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- break;
- default:
- bHadExact = false;
- }
- }
- else
- bHadExact = false;
- if ( !bHadExact || !pCal->isValid() )
- {
- if ( !bHadExact && nExactDateOrder )
- pCal->setGregorianDateTime( Date() ); // reset today
- switch (DateFmt)
- {
- case MDY:
- // M D
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
- if ( !pCal->isValid() ) // 2nd try
- { // M Y
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- }
- break;
- case DMY:
- // D M
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
- if ( !pCal->isValid() ) // 2nd try
- { // M Y
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- }
- break;
- case YMD:
- // M D
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
- if ( !pCal->isValid() ) // 2nd try
- { // Y M
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, 1 );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- }
- break;
- default:
- res = FALSE;
- break;
- }
- }
- }
- break;
- case 1: // month at the beginning (Jan 01 01)
- {
- // The input is valid as MDY in almost any
- // constellation, there is no date order (M)YD except if
- // set in a format applied.
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- sal_uInt32 nExactDateOrder = (bFormatTurn ? pFormat->GetExactDateOrder() : 0);
- if ((((nExactDateOrder >> 8) & 0xff) == 'Y') && ((nExactDateOrder & 0xff) == 'D'))
- {
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- }
- else
- {
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- }
- }
- break;
- case 2: // month in the middle (10 Jan 94)
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- switch (DateFmt)
- {
- case MDY: // yes, "10-Jan-94" is valid
- case DMY:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- break;
- case YMD:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- default: // else, e.g. month at the end (94 10 Jan)
- res = FALSE;
- break;
- } // switch (nMonthPos)
- break;
-
- default: // more than two numbers (31.12.94 8:23) (31.12. 8:23)
- switch (nMonthPos) // where is the month
- {
- case 0: // not found
- {
- nCounter = 3;
- if ( nTimePos > 1 )
- { // find first time number index (should only be 3 or 2 anyway)
- for ( USHORT j = 0; j < nAnzNums; j++ )
- {
- if ( nNums[j] == nTimePos - 2 )
- {
- nCounter = j;
- break; // for
- }
- }
- }
- // ISO 8601 yyyy-mm-dd forced recognition
- DateFormat eDF = (MayBeIso8601() ? YMD : DateFmt);
- switch (eDF)
- {
- case MDY:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(0) );
- if ( nCounter > 2 )
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) );
- break;
- case DMY:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
- if ( nCounter > 2 )
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(2) );
- break;
- case YMD:
- if ( nCounter > 2 )
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(2) );
- pCal->setValue( CalendarFieldIndex::MONTH, ImplGetMonth(1) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- break;
- default:
- res = FALSE;
- break;
- }
- }
- break;
- case 1: // month at the beginning (Jan 01 01 8:23)
- nCounter = 2;
- switch (DateFmt)
- {
- case MDY:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- case 2: // month in the middle (10 Jan 94 8:23)
- nCounter = 2;
- pCal->setValue( CalendarFieldIndex::MONTH, Abs(nMonth)-1 );
- switch (DateFmt)
- {
- case DMY:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(0) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(1) );
- break;
- case YMD:
- pCal->setValue( CalendarFieldIndex::DAY_OF_MONTH, ImplGetDay(1) );
- pCal->setValue( CalendarFieldIndex::YEAR, ImplGetYear(0) );
- break;
- default:
- res = FALSE;
- break;
- }
- break;
- default: // else, e.g. month at the end (94 10 Jan 8:23)
- nCounter = 2;
- res = FALSE;
- break;
- } // switch (nMonthPos)
- break;
- } // switch (nAnzNums)
-
- if ( res && pCal->isValid() )
- {
- double fDiff = DateTime(*pNullDate) - pCal->getEpochStart();
- fDays = ::rtl::math::approxFloor( pCal->getLocalDateTime() );
- fDays -= fDiff;
- nTryOrder = nFormatOrder; // break for
- }
- else
- res = FALSE;
-
- if ( aOrgCalendar.Len() )
- pCal->loadCalendar( aOrgCalendar, pLoc->getLocale() ); // restore calendar
-
-#if NF_TEST_CALENDAR
-{
- using namespace ::com::sun::star;
- struct entry { const char* lan; const char* cou; const char* cal; };
- const entry cals[] = {
- { "en", "US", "gregorian" },
- { "ar", "TN", "hijri" },
- { "he", "IL", "jewish" },
- { "ja", "JP", "gengou" },
- { "ko", "KR", "hanja_yoil" },
- { "th", "TH", "buddhist" },
- { "zh", "TW", "ROC" },
- {0,0,0}
- };
- lang::Locale aLocale;
- sal_Bool bValid;
- sal_Int16 nDay, nMyMonth, nYear, nHour, nMinute, nSecond;
- sal_Int16 nDaySet, nMonthSet, nYearSet, nHourSet, nMinuteSet, nSecondSet;
- sal_Int16 nZO, nDST1, nDST2, nDST, nZOmillis, nDST1millis, nDST2millis, nDSTmillis;
- sal_Int32 nZoneInMillis, nDST1InMillis, nDST2InMillis;
- uno::Reference< lang::XMultiServiceFactory > xSMgr =
- ::comphelper::getProcessServiceFactory();
- uno::Reference< ::com::sun::star::i18n::XExtendedCalendar > xCal(
- xSMgr->createInstance( ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.i18n.LocaleCalendar" ) ) ),
- uno::UNO_QUERY );
- for ( const entry* p = cals; p->lan; ++p )
- {
- aLocale.Language = ::rtl::OUString::createFromAscii( p->lan );
- aLocale.Country = ::rtl::OUString::createFromAscii( p->cou );
- xCal->loadCalendar( ::rtl::OUString::createFromAscii( p->cal ),
- aLocale );
- double nDateTime = 0.0; // 1-Jan-1970 00:00:00
- nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET );
- nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS );
- nZoneInMillis = static_cast<sal_Int32>(nZO) * 60000 +
- (nZO < 0 ? -1 : 1) * static_cast<sal_uInt16>(nZOmillis);
- nDST1 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET );
- nDST1millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS );
- nDST1InMillis = static_cast<sal_Int32>(nDST1) * 60000 +
- (nDST1 < 0 ? -1 : 1) * static_cast<sal_uInt16>(nDST1millis);
- nDateTime -= (double)(nZoneInMillis + nDST1InMillis) / 1000.0 / 60.0 / 60.0 / 24.0;
- xCal->setDateTime( nDateTime );
- nDST2 = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET );
- nDST2millis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS );
- nDST2InMillis = static_cast<sal_Int32>(nDST2) * 60000 +
- (nDST2 < 0 ? -1 : 1) * static_cast<sal_uInt16>(nDST2millis);
- if ( nDST1InMillis != nDST2InMillis )
- {
- nDateTime = 0.0 - (double)(nZoneInMillis + nDST2InMillis) / 1000.0 / 60.0 / 60.0 / 24.0;
- xCal->setDateTime( nDateTime );
- }
- nDaySet = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH );
- nMonthSet = xCal->getValue( i18n::CalendarFieldIndex::MONTH );
- nYearSet = xCal->getValue( i18n::CalendarFieldIndex::YEAR );
- nHourSet = xCal->getValue( i18n::CalendarFieldIndex::HOUR );
- nMinuteSet = xCal->getValue( i18n::CalendarFieldIndex::MINUTE );
- nSecondSet = xCal->getValue( i18n::CalendarFieldIndex::SECOND );
- nZO = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET );
- nZOmillis = xCal->getValue( i18n::CalendarFieldIndex::ZONE_OFFSET_SECOND_MILLIS );
- nDST = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET );
- nDSTmillis = xCal->getValue( i18n::CalendarFieldIndex::DST_OFFSET_SECOND_MILLIS );
- xCal->setValue( i18n::CalendarFieldIndex::DAY_OF_MONTH, nDaySet );
- xCal->setValue( i18n::CalendarFieldIndex::MONTH, nMonthSet );
- xCal->setValue( i18n::CalendarFieldIndex::YEAR, nYearSet );
- xCal->setValue( i18n::CalendarFieldIndex::HOUR, nHourSet );
- xCal->setValue( i18n::CalendarFieldIndex::MINUTE, nMinuteSet );
- xCal->setValue( i18n::CalendarFieldIndex::SECOND, nSecondSet );
- bValid = xCal->isValid();
- nDay = xCal->getValue( i18n::CalendarFieldIndex::DAY_OF_MONTH );
- nMyMonth= xCal->getValue( i18n::CalendarFieldIndex::MONTH );
- nYear = xCal->getValue( i18n::CalendarFieldIndex::YEAR );
- nHour = xCal->getValue( i18n::CalendarFieldIndex::HOUR );
- nMinute = xCal->getValue( i18n::CalendarFieldIndex::MINUTE );
- nSecond = xCal->getValue( i18n::CalendarFieldIndex::SECOND );
- bValid = bValid && nDay == nDaySet && nMyMonth == nMonthSet && nYear ==
- nYearSet && nHour == nHourSet && nMinute == nMinuteSet && nSecond
- == nSecondSet;
- }
-}
-#endif // NF_TEST_CALENDAR
-
- }
-
- return res;
-}
-
-
-//---------------------------------------------------------------------------
-// ScanStartString
-//
-// ersten String analysieren
-// Alles weg => TRUE
-// sonst => FALSE
-
-BOOL ImpSvNumberInputScan::ScanStartString( const String& rString,
- const SvNumberformat* pFormat )
-{
- xub_StrLen nPos = 0;
- int nDayOfWeek;
-
- // First of all, eat leading blanks
- SkipBlanks(rString, nPos);
-
- // Yes, nMatchedAllStrings should know about the sign position
- nSign = GetSign(rString, nPos);
- if ( nSign ) // sign?
- SkipBlanks(rString, nPos);
-
- // #102371# match against format string only if start string is not a sign character
- if ( nMatchedAllStrings && !(nSign && rString.Len() == 1) )
- { // Match against format in any case, so later on for a "x1-2-3" input
- // we may distinguish between a xy-m-d (or similar) date and a x0-0-0
- // format. No sign detection here!
- if ( ScanStringNumFor( rString, nPos, pFormat, 0, TRUE ) )
- nMatchedAllStrings |= nMatchedStartString;
- else
- nMatchedAllStrings = 0;
- }
-
- if ( GetDecSep(rString, nPos) ) // decimal separator in start string
- {
- nDecPos = 1;
- SkipBlanks(rString, nPos);
- }
- else if ( GetCurrency(rString, nPos, pFormat) ) // currency (DM 1)?
- {
- eScannedType = NUMBERFORMAT_CURRENCY; // !!! it IS currency !!!
- SkipBlanks(rString, nPos);
- if (nSign == 0) // no sign yet
- {
- nSign = GetSign(rString, nPos);
- if ( nSign ) // DM -1
- SkipBlanks(rString, nPos);
- }
- }
- else
- {
- nMonth = GetMonth(rString, nPos);
- if ( nMonth ) // month (Jan 1)?
- {
- eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!!
- nMonthPos = 1; // month at the beginning
- if ( nMonth < 0 )
- SkipChar( '.', rString, nPos ); // abbreviated
- SkipBlanks(rString, nPos);
- }
- else
- {
- nDayOfWeek = GetDayOfWeek( rString, nPos );
- if ( nDayOfWeek )
- { // day of week is just parsed away
- eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date !!!
- if ( nPos < rString.Len() )
- {
- if ( nDayOfWeek < 0 )
- { // abbreviated
- if ( rString.GetChar( nPos ) == '.' )
- ++nPos;
- }
- else
- { // full long name
- SkipBlanks(rString, nPos);
- SkipString( pFormatter->GetLocaleData()->getLongDateDayOfWeekSep(), rString, nPos );
- }
- SkipBlanks(rString, nPos);
- nMonth = GetMonth(rString, nPos);
- if ( nMonth ) // month (Jan 1)?
- {
- nMonthPos = 1; // month a the beginning
- if ( nMonth < 0 )
- SkipChar( '.', rString, nPos ); // abbreviated
- SkipBlanks(rString, nPos);
- }
- }
- }
- }
- }
-
- if (nPos < rString.Len()) // not everything consumed
- {
- // Does input StartString equal StartString of format?
- // This time with sign detection!
- if ( !ScanStringNumFor( rString, nPos, pFormat, 0 ) )
- return MatchedReturn();
- }
-
- return TRUE;
-}
-
-
-//---------------------------------------------------------------------------
-// ScanMidString
-//
-// String in der Mitte analysieren
-// Alles weg => TRUE
-// sonst => FALSE
-
-BOOL ImpSvNumberInputScan::ScanMidString( const String& rString,
- USHORT nStringPos, const SvNumberformat* pFormat )
-{
- xub_StrLen nPos = 0;
- short eOldScannedType = eScannedType;
-
- if ( nMatchedAllStrings )
- { // Match against format in any case, so later on for a "1-2-3-4" input
- // we may distinguish between a y-m-d (or similar) date and a 0-0-0-0
- // format.
- if ( ScanStringNumFor( rString, 0, pFormat, nStringPos ) )
- nMatchedAllStrings |= nMatchedMidString;
- else
- nMatchedAllStrings = 0;
- }
-
- SkipBlanks(rString, nPos);
- if (GetDecSep(rString, nPos)) // decimal separator?
- {
- if (nDecPos == 1 || nDecPos == 3) // .12.4 or 1.E2.1
- return MatchedReturn();
- else if (nDecPos == 2) // . dup: 12.4.
- {
- if (bDecSepInDateSeps) // . also date separator
- {
- if ( eScannedType != NUMBERFORMAT_UNDEFINED &&
- eScannedType != NUMBERFORMAT_DATE &&
- eScannedType != NUMBERFORMAT_DATETIME) // already another type
- return MatchedReturn();
- if (eScannedType == NUMBERFORMAT_UNDEFINED)
- eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
- SkipBlanks(rString, nPos);
- }
- else
- return MatchedReturn();
- }
- else
- {
- nDecPos = 2; // . in mid string
- SkipBlanks(rString, nPos);
- }
- }
- else if ( ((eScannedType & NUMBERFORMAT_TIME) == NUMBERFORMAT_TIME)
- && GetTime100SecSep( rString, nPos ) )
- { // hundredth seconds separator
- if ( nDecPos )
- return MatchedReturn();
- nDecPos = 2; // . in mid string
- SkipBlanks(rString, nPos);
- }
-
- if (SkipChar('/', rString, nPos)) // fraction?
- {
- if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
- && eScannedType != NUMBERFORMAT_DATE) // except date
- return MatchedReturn(); // => jan/31/1994
- else if ( eScannedType != NUMBERFORMAT_DATE // analyzed date until now
- && ( eSetType == NUMBERFORMAT_FRACTION // and preset was fraction
- || (nAnzNums == 3 // or 3 numbers
- && nStringPos > 2) ) ) // and what ???
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_FRACTION; // !!! it IS a fraction
- }
- else
- nPos--; // put '/' back
- }
-
- if (GetThousandSep(rString, nPos, nStringPos)) // 1,000
- {
- if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
- && eScannedType != NUMBERFORMAT_CURRENCY) // except currency
- return MatchedReturn();
- nThousand++;
- }
-
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
- const String& rDate = pFormatter->GetDateSep();
- const String& rTime = pLoc->getTimeSep();
- sal_Unicode cTime = rTime.GetChar(0);
- SkipBlanks(rString, nPos);
- if ( SkipString(rDate, rString, nPos) // 10., 10-, 10/
- || ((cTime != '.') && SkipChar('.', rString, nPos)) // TRICKY:
- || ((cTime != '/') && SkipChar('/', rString, nPos)) // short boolean
- || ((cTime != '-') && SkipChar('-', rString, nPos)) ) // evaluation!
- {
- if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
- && eScannedType != NUMBERFORMAT_DATE) // except date
- return MatchedReturn();
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
- short nTmpMonth = GetMonth(rString, nPos); // 10. Jan 94
- if (nMonth && nTmpMonth) // month dup
- return MatchedReturn();
- if (nTmpMonth)
- {
- nMonth = nTmpMonth;
- nMonthPos = 2; // month in the middle
- if ( nMonth < 0 && SkipChar( '.', rString, nPos ) )
- ; // short month may be abbreviated Jan.
- else if ( SkipChar( '-', rString, nPos ) )
- ; // #79632# recognize 17-Jan-2001 to be a date
- // #99065# short and long month name
- else
- SkipString( pLoc->getLongDateMonthSep(), rString, nPos );
- SkipBlanks(rString, nPos);
- }
- }
-
- short nTempMonth = GetMonth(rString, nPos); // month in the middle (10 Jan 94)
- if (nTempMonth)
- {
- if (nMonth != 0) // month dup
- return MatchedReturn();
- if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
- && eScannedType != NUMBERFORMAT_DATE) // except date
- return MatchedReturn();
- eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
- nMonth = nTempMonth;
- nMonthPos = 2; // month in the middle
- if ( nMonth < 0 )
- SkipChar( '.', rString, nPos ); // abbreviated
- SkipString( pLoc->getLongDateMonthSep(), rString, nPos );
- SkipBlanks(rString, nPos);
- }
-
- if ( SkipChar('E', rString, nPos) // 10E, 10e, 10,Ee
- || SkipChar('e', rString, nPos) )
- {
- if (eScannedType != NUMBERFORMAT_UNDEFINED) // already another type
- return MatchedReturn();
- else
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_SCIENTIFIC; // !!! it IS scientific
- if ( nThousand+2 == nAnzNums // special case 1.E2
- && nDecPos == 2 )
- nDecPos = 3; // 1,100.E2 1,100,100.E3
- }
- nESign = GetESign(rString, nPos); // signed exponent?
- SkipBlanks(rString, nPos);
- }
-
- if ( SkipString(rTime, rString, nPos) ) // time separator?
- {
- if (nDecPos) // already . => maybe error
- {
- if (bDecSepInDateSeps) // . also date sep
- {
- if ( eScannedType != NUMBERFORMAT_DATE && // already another type than date
- eScannedType != NUMBERFORMAT_DATETIME) // or date time
- return MatchedReturn();
- if (eScannedType == NUMBERFORMAT_DATE)
- nDecPos = 0; // reset for time transition
- }
- else
- return MatchedReturn();
- }
- if ( ( eScannedType == NUMBERFORMAT_DATE // already date type
- || eScannedType == NUMBERFORMAT_DATETIME) // or date time
- && nAnzNums > 3) // and more than 3 numbers? (31.Dez.94 8:23)
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_DATETIME; // !!! it IS date with time
- }
- else if ( eScannedType != NUMBERFORMAT_UNDEFINED // already another type
- && eScannedType != NUMBERFORMAT_TIME) // except time
- return MatchedReturn();
- else
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_TIME; // !!! it IS a time
- }
- if ( !nTimePos )
- nTimePos = nStringPos + 1;
- }
-
- if (nPos < rString.Len())
- {
- switch (eScannedType)
- {
- case NUMBERFORMAT_DATE:
- if (nMonthPos == 1 && pLoc->getLongDateFormat() == MDY)
- {
- // #68232# recognize long date separators like ", " in "September 5, 1999"
- if (SkipString( pLoc->getLongDateDaySep(), rString, nPos ))
- SkipBlanks( rString, nPos );
- }
- else if (nStringPos == 5 && nPos == 0 && rString.Len() == 1 &&
- rString.GetChar(0) == 'T' && MayBeIso8601())
- {
- // ISO 8601 combined date and time, yyyy-mm-ddThh:mm
- ++nPos;
- }
- break;
-#if NF_RECOGNIZE_ISO8601_TIMEZONES
- case NUMBERFORMAT_DATETIME:
- if (nPos == 0 && rString.Len() == 1 && nStringPos >= 9 &&
- MayBeIso8601())
- {
- // ISO 8601 timezone offset
- switch (rString.GetChar(0))
- {
- case '+':
- case '-':
- if (nStringPos == nAnzStrings-2 ||
- nStringPos == nAnzStrings-4)
- {
- ++nPos; // yyyy-mm-ddThh:mm[:ss]+xx[[:]yy]
- // nTimezonePos needed for GetTimeRef()
- if (!nTimezonePos)
- nTimezonePos = nStringPos + 1;
- }
- break;
- case ':':
- if (nTimezonePos && nStringPos >= 11 &&
- nStringPos == nAnzStrings-2)
- ++nPos; // yyyy-mm-ddThh:mm[:ss]+xx:yy
- break;
- }
- }
- break;
-#endif
- }
- }
-
- if (nPos < rString.Len()) // not everything consumed?
- {
- if ( nMatchedAllStrings & ~nMatchedVirgin )
- eScannedType = eOldScannedType;
- else
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-//---------------------------------------------------------------------------
-// ScanEndString
-//
-// Schlussteil analysieren
-// Alles weg => TRUE
-// sonst => FALSE
-
-BOOL ImpSvNumberInputScan::ScanEndString( const String& rString,
- const SvNumberformat* pFormat )
-{
- xub_StrLen nPos = 0;
-
- if ( nMatchedAllStrings )
- { // Match against format in any case, so later on for a "1-2-3-4" input
- // we may distinguish between a y-m-d (or similar) date and a 0-0-0-0
- // format.
- if ( ScanStringNumFor( rString, 0, pFormat, 0xFFFF ) )
- nMatchedAllStrings |= nMatchedEndString;
- else
- nMatchedAllStrings = 0;
- }
-
- SkipBlanks(rString, nPos);
- if (GetDecSep(rString, nPos)) // decimal separator?
- {
- if (nDecPos == 1 || nDecPos == 3) // .12.4 or 12.E4.
- return MatchedReturn();
- else if (nDecPos == 2) // . dup: 12.4.
- {
- if (bDecSepInDateSeps) // . also date sep
- {
- if ( eScannedType != NUMBERFORMAT_UNDEFINED &&
- eScannedType != NUMBERFORMAT_DATE &&
- eScannedType != NUMBERFORMAT_DATETIME) // already another type
- return MatchedReturn();
- if (eScannedType == NUMBERFORMAT_UNDEFINED)
- eScannedType = NUMBERFORMAT_DATE; // !!! it IS a date
- SkipBlanks(rString, nPos);
- }
- else
- return MatchedReturn();
- }
- else
- {
- nDecPos = 3; // . in end string
- SkipBlanks(rString, nPos);
- }
- }
-
- if ( nSign == 0 // conflict - not signed
- && eScannedType != NUMBERFORMAT_DATE) // and not date
-//!? catch time too?
- { // not signed yet
- nSign = GetSign(rString, nPos); // 1- DM
- if (nNegCheck) // '(' as sign
- return MatchedReturn();
- }
-
- SkipBlanks(rString, nPos);
- if (nNegCheck && SkipChar(')', rString, nPos)) // skip ')' if appropriate
- {
- nNegCheck = 0;
- SkipBlanks(rString, nPos);
- }
-
- if ( GetCurrency(rString, nPos, pFormat) ) // currency symbol?
- {
- if (eScannedType != NUMBERFORMAT_UNDEFINED) // currency dup
- return MatchedReturn();
- else
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_CURRENCY;
- } // behind currency a '-' is allowed
- if (nSign == 0) // not signed yet
- {
- nSign = GetSign(rString, nPos); // DM -
- SkipBlanks(rString, nPos);
- if (nNegCheck) // 3 DM (
- return MatchedReturn();
- }
- if ( nNegCheck && eScannedType == NUMBERFORMAT_CURRENCY
- && SkipChar(')', rString, nPos) )
- {
- nNegCheck = 0; // ')' skipped
- SkipBlanks(rString, nPos); // only if currency
- }
- }
-
- if ( SkipChar('%', rString, nPos) ) // 1 %
- {
- if (eScannedType != NUMBERFORMAT_UNDEFINED) // already another type
- return MatchedReturn();
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_PERCENT;
- }
-
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
- const String& rDate = pFormatter->GetDateSep();
- const String& rTime = pLoc->getTimeSep();
- if ( SkipString(rTime, rString, nPos) ) // 10:
- {
- if (nDecPos) // already , => error
- return MatchedReturn();
- if (eScannedType == NUMBERFORMAT_DATE && nAnzNums > 2) // 31.Dez.94 8:
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_DATETIME;
- }
- else if (eScannedType != NUMBERFORMAT_UNDEFINED &&
- eScannedType != NUMBERFORMAT_TIME) // already another type
- return MatchedReturn();
- else
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_TIME;
- }
- if ( !nTimePos )
- nTimePos = nAnzStrings;
- }
-
- sal_Unicode cTime = rTime.GetChar(0);
- if ( SkipString(rDate, rString, nPos) // 10., 10-, 10/
- || ((cTime != '.') && SkipChar('.', rString, nPos)) // TRICKY:
- || ((cTime != '/') && SkipChar('/', rString, nPos)) // short boolean
- || ((cTime != '-') && SkipChar('-', rString, nPos)) ) // evaluation!
- {
- if (eScannedType != NUMBERFORMAT_UNDEFINED &&
- eScannedType != NUMBERFORMAT_DATE) // already another type
- return MatchedReturn();
- else
- {
- SkipBlanks(rString, nPos);
- eScannedType = NUMBERFORMAT_DATE;
- }
- short nTmpMonth = GetMonth(rString, nPos); // 10. Jan
- if (nMonth && nTmpMonth) // month dup
- return MatchedReturn();
- if (nTmpMonth)
- {
- nMonth = nTmpMonth;
- nMonthPos = 3; // month at end
- if ( nMonth < 0 )
- SkipChar( '.', rString, nPos ); // abbreviated
- SkipBlanks(rString, nPos);
- }
- }
-
- short nTempMonth = GetMonth(rString, nPos); // 10 Jan
- if (nTempMonth)
- {
- if (nMonth) // month dup
- return MatchedReturn();
- if (eScannedType != NUMBERFORMAT_UNDEFINED &&
- eScannedType != NUMBERFORMAT_DATE) // already another type
- return MatchedReturn();
- eScannedType = NUMBERFORMAT_DATE;
- nMonth = nTempMonth;
- nMonthPos = 3; // month at end
- if ( nMonth < 0 )
- SkipChar( '.', rString, nPos ); // abbreviated
- SkipBlanks(rString, nPos);
- }
-
- xub_StrLen nOrigPos = nPos;
- if (GetTimeAmPm(rString, nPos))
- {
- if (eScannedType != NUMBERFORMAT_UNDEFINED &&
- eScannedType != NUMBERFORMAT_TIME &&
- eScannedType != NUMBERFORMAT_DATETIME) // already another type
- return MatchedReturn();
- else
- {
- // If not already scanned as time, 6.78am does not result in 6
- // seconds and 78 hundredths in the morning. Keep as suffix.
- if (eScannedType != NUMBERFORMAT_TIME && nDecPos == 2 && nAnzNums == 2)
- nPos = nOrigPos; // rewind am/pm
- else
- {
- SkipBlanks(rString, nPos);
- if ( eScannedType != NUMBERFORMAT_DATETIME )
- eScannedType = NUMBERFORMAT_TIME;
- }
- }
- }
-
- if ( nNegCheck && SkipChar(')', rString, nPos) )
- {
- if (eScannedType == NUMBERFORMAT_CURRENCY) // only if currency
- {
- nNegCheck = 0; // skip ')'
- SkipBlanks(rString, nPos);
- }
- else
- return MatchedReturn();
- }
-
- if ( nPos < rString.Len() &&
- (eScannedType == NUMBERFORMAT_DATE
- || eScannedType == NUMBERFORMAT_DATETIME) )
- { // day of week is just parsed away
- xub_StrLen nOldPos = nPos;
- const String& rSep = pFormatter->GetLocaleData()->getLongDateDayOfWeekSep();
- if ( StringContains( rSep, rString, nPos ) )
- {
- nPos = nPos + rSep.Len();
- SkipBlanks(rString, nPos);
- }
- int nDayOfWeek = GetDayOfWeek( rString, nPos );
- if ( nDayOfWeek )
- {
- if ( nPos < rString.Len() )
- {
- if ( nDayOfWeek < 0 )
- { // short
- if ( rString.GetChar( nPos ) == '.' )
- ++nPos;
- }
- SkipBlanks(rString, nPos);
- }
- }
- else
- nPos = nOldPos;
- }
-
-#if NF_RECOGNIZE_ISO8601_TIMEZONES
- if (nPos == 0 && eScannedType == NUMBERFORMAT_DATETIME &&
- rString.Len() == 1 && rString.GetChar(0) == 'Z' && MayBeIso8601())
- {
- // ISO 8601 timezone UTC yyyy-mm-ddThh:mmZ
- ++nPos;
- }
-#endif
-
- if (nPos < rString.Len()) // everything consumed?
- {
- // does input EndString equal EndString in Format?
- if ( !ScanStringNumFor( rString, nPos, pFormat, 0xFFFF ) )
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-BOOL ImpSvNumberInputScan::ScanStringNumFor(
- const String& rString, // String to scan
- xub_StrLen nPos, // Position until which was consumed
- const SvNumberformat* pFormat, // The format to match
- USHORT nString, // Substring of format, 0xFFFF => last
- BOOL bDontDetectNegation // Suppress sign detection
- )
-{
- if ( !pFormat )
- return FALSE;
- const ::utl::TransliterationWrapper* pTransliteration = pFormatter->GetTransliteration();
- const String* pStr;
- String aString( rString );
- BOOL bFound = FALSE;
- BOOL bFirst = TRUE;
- BOOL bContinue = TRUE;
- USHORT nSub;
- do
- {
- // Don't try "lower" subformats ff the very first match was the second
- // or third subformat.
- nSub = nStringScanNumFor;
- do
- { // Step through subformats, first positive, then negative, then
- // other, but not the last (text) subformat.
- pStr = pFormat->GetNumForString( nSub, nString, TRUE );
- if ( pStr && pTransliteration->isEqual( aString, *pStr ) )
- {
- bFound = TRUE;
- bContinue = FALSE;
- }
- else if ( nSub < 2 )
- ++nSub;
- else
- bContinue = FALSE;
- } while ( bContinue );
- if ( !bFound && bFirst && nPos )
- { // try remaining substring
- bFirst = FALSE;
- aString.Erase( 0, nPos );
- bContinue = TRUE;
- }
- } while ( bContinue );
-
- if ( !bFound )
- {
- if ( !bDontDetectNegation && (nString == 0) && !bFirst && (nSign < 0)
- && pFormat->IsNegativeRealNegative() )
- { // simply negated twice? --1
- aString.EraseAllChars( ' ' );
- if ( (aString.Len() == 1) && (aString.GetChar(0) == '-') )
- {
- bFound = TRUE;
- nStringScanSign = -1;
- nSub = 0; //! not 1
- }
- }
- if ( !bFound )
- return FALSE;
- }
- else if ( !bDontDetectNegation && (nSub == 1) &&
- pFormat->IsNegativeRealNegative() )
- { // negative
- if ( nStringScanSign < 0 )
- {
- if ( (nSign < 0) && (nStringScanNumFor != 1) )
- nStringScanSign = 1; // triple negated --1 yyy
- }
- else if ( nStringScanSign == 0 )
- {
- if ( nSign < 0 )
- { // nSign and nStringScanSign will be combined later,
- // flip sign if doubly negated
- if ( (nString == 0) && !bFirst
- && SvNumberformat::HasStringNegativeSign( aString ) )
- nStringScanSign = -1; // direct double negation
- else if ( pFormat->IsNegativeWithoutSign() )
- nStringScanSign = -1; // indirect double negation
- }
- else
- nStringScanSign = -1;
- }
- else // > 0
- nStringScanSign = -1;
- }
- nStringScanNumFor = nSub;
- return TRUE;
-}
-
-
-//---------------------------------------------------------------------------
-// IsNumberFormatMain
-//
-// Recognizes types of number, exponential, fraction, percent, currency, date, time.
-// Else text => return FALSE
-
-BOOL ImpSvNumberInputScan::IsNumberFormatMain(
- const String& rString, // string to be analyzed
- double& , // OUT: result as number, if possible
- const SvNumberformat* pFormat ) // maybe number format set to match against
-{
- Reset();
- NumberStringDivision( rString ); // breakdown into strings and numbers
- if (nAnzStrings >= SV_MAX_ANZ_INPUT_STRINGS) // too many elements
- return FALSE; // Njet, Nope, ...
-
- if (nAnzNums == 0) // no number in input
- {
- if ( nAnzStrings > 0 )
- {
- // Here we may change the original, we don't need it anymore.
- // This saves copies and ToUpper() in GetLogical() and is faster.
- String& rStrArray = sStrArray[0];
- rStrArray.EraseTrailingChars( ' ' );
- rStrArray.EraseLeadingChars( ' ' );
- nLogical = GetLogical( rStrArray );
- if ( nLogical )
- {
- eScannedType = NUMBERFORMAT_LOGICAL; // !!! it's a BOOLEAN
- nMatchedAllStrings &= ~nMatchedVirgin;
- return TRUE;
- }
- else
- return FALSE; // simple text
- }
- else
- return FALSE; // simple text
- }
-
- USHORT i = 0; // mark any symbol
- USHORT j = 0; // mark only numbers
-
- switch ( nAnzNums )
- {
- case 1 : // Exactly 1 number in input
- { // nAnzStrings >= 1
- if (GetNextNumber(i,j)) // i=1,0
- { // Number at start
- if (eSetType == NUMBERFORMAT_FRACTION) // Fraction 1 = 1/1
- {
- if (i >= nAnzStrings || // no end string nor decimal separator
- sStrArray[i] == pFormatter->GetNumDecimalSep())
- {
- eScannedType = NUMBERFORMAT_FRACTION;
- nMatchedAllStrings &= ~nMatchedVirgin;
- return TRUE;
- }
- }
- }
- else
- { // Analyze start string
- if (!ScanStartString( sStrArray[i], pFormat )) // i=0
- return FALSE; // already an error
- i++; // next symbol, i=1
- }
- GetNextNumber(i,j); // i=1,2
- if (eSetType == NUMBERFORMAT_FRACTION) // Fraction -1 = -1/1
- {
- if (nSign && !nNegCheck && // Sign +, -
- eScannedType == NUMBERFORMAT_UNDEFINED && // not date or currency
- nDecPos == 0 && // no previous decimal separator
- (i >= nAnzStrings || // no end string nor decimal separator
- sStrArray[i] == pFormatter->GetNumDecimalSep())
- )
- {
- eScannedType = NUMBERFORMAT_FRACTION;
- nMatchedAllStrings &= ~nMatchedVirgin;
- return TRUE;
- }
- }
- if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
- return FALSE;
- }
- break;
- case 2 : // Exactly 2 numbers in input
- { // nAnzStrings >= 3
- if (!GetNextNumber(i,j)) // i=1,0
- { // Analyze start string
- if (!ScanStartString( sStrArray[i], pFormat ))
- return FALSE; // already an error
- i++; // i=1
- }
- GetNextNumber(i,j); // i=1,2
- if ( !ScanMidString( sStrArray[i], i, pFormat ) )
- return FALSE;
- i++; // next symbol, i=2,3
- GetNextNumber(i,j); // i=3,4
- if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
- return FALSE;
- if (eSetType == NUMBERFORMAT_FRACTION) // -1,200. as fraction
- {
- if (!nNegCheck && // no sign '('
- eScannedType == NUMBERFORMAT_UNDEFINED &&
- (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end
- )
- {
- eScannedType = NUMBERFORMAT_FRACTION;
- nMatchedAllStrings &= ~nMatchedVirgin;
- return TRUE;
- }
- }
- }
- break;
- case 3 : // Exactly 3 numbers in input
- { // nAnzStrings >= 5
- if (!GetNextNumber(i,j)) // i=1,0
- { // Analyze start string
- if (!ScanStartString( sStrArray[i], pFormat ))
- return FALSE; // already an error
- i++; // i=1
- if (nDecPos == 1) // decimal separator at start => error
- return FALSE;
- }
- GetNextNumber(i,j); // i=1,2
- if ( !ScanMidString( sStrArray[i], i, pFormat ) )
- return FALSE;
- i++; // i=2,3
- if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end
- return FALSE;
- GetNextNumber(i,j); // i=3,4
- if ( !ScanMidString( sStrArray[i], i, pFormat ) )
- return FALSE;
- i++; // i=4,5
- GetNextNumber(i,j); // i=5,6
- if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
- return FALSE;
- if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction
- {
- if (!nNegCheck && // no sign '('
- eScannedType == NUMBERFORMAT_UNDEFINED &&
- (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end
- )
- {
- eScannedType = NUMBERFORMAT_FRACTION;
- nMatchedAllStrings &= ~nMatchedVirgin;
- return TRUE;
- }
- }
- if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos )
- return FALSE; // #36857# not a real fraction
- }
- break;
- default: // More than 3 numbers in input
- { // nAnzStrings >= 7
- if (!GetNextNumber(i,j)) // i=1,0
- { // Analyze startstring
- if (!ScanStartString( sStrArray[i], pFormat ))
- return FALSE; // already an error
- i++; // i=1
- if (nDecPos == 1) // decimal separator at start => error
- return FALSE;
- }
- GetNextNumber(i,j); // i=1,2
- if ( !ScanMidString( sStrArray[i], i, pFormat ) )
- return FALSE;
- i++; // i=2,3
- USHORT nThOld = 10; // just not 0 or 1
- while (nThOld != nThousand && j < nAnzNums-1)
- // Execute at least one time
- // but leave one number.
- { // Loop over group separators
- nThOld = nThousand;
- if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at end
- return FALSE;
- GetNextNumber(i,j);
- if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) )
- return FALSE;
- i++;
- }
- if (eScannedType == NUMBERFORMAT_DATE || // long date or
- eScannedType == NUMBERFORMAT_TIME || // long time or
- eScannedType == NUMBERFORMAT_UNDEFINED) // long number
- {
- for (USHORT k = j; k < nAnzNums-1; k++)
- {
- if (eScannedType == NUMBERFORMAT_SCIENTIFIC) // E only at endd
- return FALSE;
- GetNextNumber(i,j);
- if ( i < nAnzStrings && !ScanMidString( sStrArray[i], i, pFormat ) )
- return FALSE;
- i++;
- }
- }
- GetNextNumber(i,j);
- if (i < nAnzStrings && !ScanEndString( sStrArray[i], pFormat ))
- return FALSE;
- if (eSetType == NUMBERFORMAT_FRACTION) // -1,200,100. as fraction
- {
- if (!nNegCheck && // no sign '('
- eScannedType == NUMBERFORMAT_UNDEFINED &&
- (nDecPos == 0 || nDecPos == 3) // no decimal separator or at end
- )
- {
- eScannedType = NUMBERFORMAT_FRACTION;
- nMatchedAllStrings &= ~nMatchedVirgin;
- return TRUE;
- }
- }
- if ( eScannedType == NUMBERFORMAT_FRACTION && nDecPos )
- return FALSE; // #36857# not a real fraction
- }
- }
-
- if (eScannedType == NUMBERFORMAT_UNDEFINED)
- {
- nMatchedAllStrings &= ~nMatchedVirgin;
- // did match including nMatchedUsedAsReturn
- BOOL bDidMatch = (nMatchedAllStrings != 0);
- if ( nMatchedAllStrings )
- {
- BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual(
- nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE);
- if ( !bMatch )
- nMatchedAllStrings = 0;
- }
- if ( nMatchedAllStrings )
- eScannedType = eSetType;
- else if ( bDidMatch )
- return FALSE;
- else
- eScannedType = NUMBERFORMAT_NUMBER;
- // everything else should have been recognized by now
- }
- else if ( eScannedType == NUMBERFORMAT_DATE )
- { // the very relaxed date input checks may interfere with a preset format
- nMatchedAllStrings &= ~nMatchedVirgin;
- BOOL bWasReturn = ((nMatchedAllStrings & nMatchedUsedAsReturn) != 0);
- if ( nMatchedAllStrings )
- {
- BOOL bMatch = (pFormat ? pFormat->IsNumForStringElementCountEqual(
- nStringScanNumFor, nAnzStrings, nAnzNums ) : FALSE);
- if ( !bMatch )
- nMatchedAllStrings = 0;
- }
- if ( nMatchedAllStrings )
- eScannedType = eSetType;
- else if ( bWasReturn )
- return FALSE;
- }
- else
- nMatchedAllStrings = 0; // reset flag to no substrings matched
-
- return TRUE;
-}
-
-
-//---------------------------------------------------------------------------
-// return TRUE or FALSE depending on the nMatched... state and remember usage
-BOOL ImpSvNumberInputScan::MatchedReturn()
-{
- if ( nMatchedAllStrings & ~nMatchedVirgin )
- {
- nMatchedAllStrings |= nMatchedUsedAsReturn;
- return TRUE;
- }
- return FALSE;
-}
-
-
-//---------------------------------------------------------------------------
-// Initialize uppercase months and weekdays
-
-void ImpSvNumberInputScan::InitText()
-{
- sal_Int32 j, nElems;
- const CharClass* pChrCls = pFormatter->GetCharClass();
- const CalendarWrapper* pCal = pFormatter->GetCalendar();
- delete [] pUpperMonthText;
- delete [] pUpperAbbrevMonthText;
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::CalendarItem > xElems
- = pCal->getMonths();
- nElems = xElems.getLength();
- pUpperMonthText = new String[nElems];
- pUpperAbbrevMonthText = new String[nElems];
- for ( j=0; j<nElems; j++ )
- {
- pUpperMonthText[j] = pChrCls->upper( xElems[j].FullName );
- pUpperAbbrevMonthText[j] = pChrCls->upper( xElems[j].AbbrevName );
- }
- delete [] pUpperDayText;
- delete [] pUpperAbbrevDayText;
- xElems = pCal->getDays();
- nElems = xElems.getLength();
- pUpperDayText = new String[nElems];
- pUpperAbbrevDayText = new String[nElems];
- for ( j=0; j<nElems; j++ )
- {
- pUpperDayText[j] = pChrCls->upper( xElems[j].FullName );
- pUpperAbbrevDayText[j] = pChrCls->upper( xElems[j].AbbrevName );
- }
- bTextInitialized = TRUE;
-}
-
-
-//===========================================================================
-// P U B L I C
-
-//---------------------------------------------------------------------------
-// ChangeIntl
-//
-// MUST be called if International/Locale is changed
-
-void ImpSvNumberInputScan::ChangeIntl()
-{
- sal_Unicode cDecSep = pFormatter->GetNumDecimalSep().GetChar(0);
- bDecSepInDateSeps = ( cDecSep == '-' ||
- cDecSep == '/' ||
- cDecSep == '.' ||
- cDecSep == pFormatter->GetDateSep().GetChar(0) );
- bTextInitialized = FALSE;
- aUpperCurrSymbol.Erase();
-}
-
-
-//---------------------------------------------------------------------------
-// ChangeNullDate
-
-void ImpSvNumberInputScan::ChangeNullDate(
- const USHORT Day,
- const USHORT Month,
- const USHORT Year )
-{
- if ( pNullDate )
- *pNullDate = Date(Day, Month, Year);
- else
- pNullDate = new Date(Day, Month, Year);
-}
-
-
-//---------------------------------------------------------------------------
-// IsNumberFormat
-//
-// => does rString represent a number (also date, time et al)
-
-BOOL ImpSvNumberInputScan::IsNumberFormat(
- const String& rString, // string to be analyzed
- short& F_Type, // IN: old type, OUT: new type
- double& fOutNumber, // OUT: number if convertable
- const SvNumberformat* pFormat ) // maybe a number format to match against
-{
- String sResString;
- String aString;
- BOOL res; // return value
- eSetType = F_Type; // old type set
-
- if ( !rString.Len() )
- res = FALSE;
- else if (rString.Len() > 308) // arbitrary
- res = FALSE;
- else
- {
- // NoMoreUpperNeeded, all comparisons on UpperCase
- aString = pFormatter->GetCharClass()->upper( rString );
- // convert native number to ASCII if necessary
- TransformInput( aString );
- res = IsNumberFormatMain( aString, fOutNumber, pFormat );
- }
-
- if (res)
- {
- if ( nNegCheck // ')' not found for '('
- || (nSign && (eScannedType == NUMBERFORMAT_DATE
- || eScannedType == NUMBERFORMAT_DATETIME))
- ) // signed date/datetime
- res = FALSE;
- else
- { // check count of partial number strings
- switch (eScannedType)
- {
- case NUMBERFORMAT_PERCENT:
- case NUMBERFORMAT_CURRENCY:
- case NUMBERFORMAT_NUMBER:
- if (nDecPos == 1) // .05
- {
- // matched MidStrings function like group separators
- if ( nMatchedAllStrings )
- nThousand = nAnzNums - 1;
- else if ( nAnzNums != 1 )
- res = FALSE;
- }
- else if (nDecPos == 2) // 1.05
- {
- // matched MidStrings function like group separators
- if ( nMatchedAllStrings )
- nThousand = nAnzNums - 1;
- else if ( nAnzNums != nThousand+2 )
- res = FALSE;
- }
- else // 1,100 or 1,100.
- {
- // matched MidStrings function like group separators
- if ( nMatchedAllStrings )
- nThousand = nAnzNums - 1;
- else if ( nAnzNums != nThousand+1 )
- res = FALSE;
- }
- break;
-
- case NUMBERFORMAT_SCIENTIFIC: // 1.0e-2
- if (nDecPos == 1) // .05
- {
- if (nAnzNums != 2)
- res = FALSE;
- }
- else if (nDecPos == 2) // 1.05
- {
- if (nAnzNums != nThousand+3)
- res = FALSE;
- }
- else // 1,100 or 1,100.
- {
- if (nAnzNums != nThousand+2)
- res = FALSE;
- }
- break;
-
- case NUMBERFORMAT_DATE:
- if (nMonth)
- { // month name and numbers
- if (nAnzNums > 2)
- res = FALSE;
- }
- else
- {
- if (nAnzNums > 3)
- res = FALSE;
- }
- break;
-
- case NUMBERFORMAT_TIME:
- if (nDecPos)
- { // hundredth seconds included
- if (nAnzNums > 4)
- res = FALSE;
- }
- else
- {
- if (nAnzNums > 3)
- res = FALSE;
- }
- break;
-
- case NUMBERFORMAT_DATETIME:
- if (nMonth)
- { // month name and numbers
- if (nDecPos)
- { // hundredth seconds included
- if (nAnzNums > 6)
- res = FALSE;
- }
- else
- {
- if (nAnzNums > 5)
- res = FALSE;
- }
- }
- else
- {
- if (nDecPos)
- { // hundredth seconds included
- if (nAnzNums > 7)
- res = FALSE;
- }
- else
- {
- if (nAnzNums > 6)
- res = FALSE;
- }
- }
- break;
-
- default:
- break;
- } // switch
- } // else
- } // if (res)
-
- if (res)
- { // we finally have a number
- switch (eScannedType)
- {
- case NUMBERFORMAT_LOGICAL:
- if (nLogical == 1)
- fOutNumber = 1.0; // True
- else if (nLogical == -1)
- fOutNumber = 0.0; // False
- else
- res = FALSE; // Oops
- break;
-
- case NUMBERFORMAT_PERCENT:
- case NUMBERFORMAT_CURRENCY:
- case NUMBERFORMAT_NUMBER:
- case NUMBERFORMAT_SCIENTIFIC:
- case NUMBERFORMAT_DEFINED: // if no category detected handle as number
- {
- if ( nDecPos == 1 ) // . at start
- sResString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0." ) );
- else
- sResString.Erase();
- USHORT k;
- for ( k = 0; k <= nThousand; k++)
- sResString += sStrArray[nNums[k]]; // integer part
- if ( nDecPos == 2 && k < nAnzNums ) // . somewhere
- {
- sResString += '.';
- USHORT nStop = (eScannedType == NUMBERFORMAT_SCIENTIFIC ?
- nAnzNums-1 : nAnzNums);
- for ( ; k < nStop; k++)
- sResString += sStrArray[nNums[k]]; // fractional part
- }
-
- if (eScannedType != NUMBERFORMAT_SCIENTIFIC)
- fOutNumber = StringToDouble(sResString);
- else
- { // append exponent
- sResString += 'E';
- if ( nESign == -1 )
- sResString += '-';
- sResString += sStrArray[nNums[nAnzNums-1]];
- rtl_math_ConversionStatus eStatus;
- fOutNumber = ::rtl::math::stringToDouble(
- sResString, '.', ',', &eStatus, NULL );
- if ( eStatus == rtl_math_ConversionStatus_OutOfRange )
- {
- F_Type = NUMBERFORMAT_TEXT; // overflow/underflow -> Text
- if (nESign == -1)
- fOutNumber = 0.0;
- else
- fOutNumber = DBL_MAX;
-/*!*/ return TRUE;
- }
- }
-
- if ( nStringScanSign )
- {
- if ( nSign )
- nSign *= nStringScanSign;
- else
- nSign = nStringScanSign;
- }
- if ( nSign < 0 )
- fOutNumber = -fOutNumber;
-
- if (eScannedType == NUMBERFORMAT_PERCENT)
- fOutNumber/= 100.0;
- }
- break;
-
- case NUMBERFORMAT_FRACTION:
- if (nAnzNums == 1)
- fOutNumber = StringToDouble(sStrArray[nNums[0]]);
- else if (nAnzNums == 2)
- {
- if (nThousand == 1)
- {
- sResString = sStrArray[nNums[0]];
- sResString += sStrArray[nNums[1]]; // integer part
- fOutNumber = StringToDouble(sResString);
- }
- else
- {
- double fZaehler = StringToDouble(sStrArray[nNums[0]]);
- double fNenner = StringToDouble(sStrArray[nNums[1]]);
- if (fNenner != 0.0)
- fOutNumber = fZaehler/fNenner;
- else
- res = FALSE;
- }
- }
- else // nAnzNums > 2
- {
- USHORT k = 1;
- sResString = sStrArray[nNums[0]];
- if (nThousand > 0)
- for (k = 1; k <= nThousand; k++)
- sResString += sStrArray[nNums[k]];
- fOutNumber = StringToDouble(sResString);
-
- if (k == nAnzNums-2)
- {
- double fZaehler = StringToDouble(sStrArray[nNums[k]]);
- double fNenner = StringToDouble(sStrArray[nNums[k+1]]);
- if (fNenner != 0.0)
- fOutNumber += fZaehler/fNenner;
- else
- res = FALSE;
- }
- }
-
- if ( nStringScanSign )
- {
- if ( nSign )
- nSign *= nStringScanSign;
- else
- nSign = nStringScanSign;
- }
- if ( nSign < 0 )
- fOutNumber = -fOutNumber;
- break;
-
- case NUMBERFORMAT_TIME:
- GetTimeRef(fOutNumber, 0, nAnzNums);
- if ( nSign < 0 )
- fOutNumber = -fOutNumber;
- break;
-
- case NUMBERFORMAT_DATE:
- {
- USHORT nCounter = 0; // dummy here
- res = GetDateRef( fOutNumber, nCounter, pFormat );
- }
- break;
-
- case NUMBERFORMAT_DATETIME:
- {
- USHORT nCounter = 0; // needed here
- res = GetDateRef( fOutNumber, nCounter, pFormat );
- if ( res )
- {
- double fTime;
- GetTimeRef( fTime, nCounter, nAnzNums - nCounter );
- fOutNumber += fTime;
- }
- }
- break;
-
- default:
- DBG_ERRORFILE( "Some number recognized but what's it?" );
- fOutNumber = 0.0;
- break;
- }
- }
-
- if (res) // overflow/underflow -> Text
- {
- if (fOutNumber < -DBL_MAX) // -1.7E308
- {
- F_Type = NUMBERFORMAT_TEXT;
- fOutNumber = -DBL_MAX;
- return TRUE;
- }
- else if (fOutNumber > DBL_MAX) // 1.7E308
- {
- F_Type = NUMBERFORMAT_TEXT;
- fOutNumber = DBL_MAX;
- return TRUE;
- }
- }
-
- if (res == FALSE)
- {
- eScannedType = NUMBERFORMAT_TEXT;
- fOutNumber = 0.0;
- }
-
- F_Type = eScannedType;
- return res;
-}
-
-
-
diff --git a/svtools/source/numbers/zforlist.cxx b/svtools/source/numbers/zforlist.cxx
deleted file mode 100644
index b76bf3226b50..000000000000
--- a/svtools/source/numbers/zforlist.cxx
+++ /dev/null
@@ -1,4362 +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: zforlist.cxx,v $
- * $Revision: 1.72.60.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-// #include <math.h>
-#include <tools/debug.hxx>
-#ifndef _SOUND_HXX //autogen
-#include <vcl/sound.hxx>
-#endif
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-#include <unotools/charclass.hxx>
-#include <i18npool/mslangid.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
-#include <unotools/calendarwrapper.hxx>
-#include <com/sun/star/i18n/KNumberFormatUsage.hpp>
-#include <com/sun/star/i18n/KNumberFormatType.hpp>
-#include <comphelper/processfactory.hxx>
-
-#define _SVSTDARR_USHORTS
-#include <svtools/svstdarr.hxx>
-
-#define _ZFORLIST_CXX
-#include <osl/mutex.hxx>
-#include <svtools/zforlist.hxx>
-#undef _ZFORLIST_CXX
-
-#include "zforscan.hxx"
-#include "zforfind.hxx"
-#include <svtools/zformat.hxx>
-#include "numhead.hxx"
-
-#include <svtools/syslocaleoptions.hxx>
-#include "listener.hxx"
-#include <svtools/smplhint.hxx>
-#include <unotools/digitgroupingiterator.hxx>
-#include <rtl/logfile.hxx>
-#include <rtl/instance.hxx>
-
-#include <math.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::lang;
-
-
-// Constants for type offsets per Country/Language (CL)
-#define ZF_STANDARD 0
-#define ZF_STANDARD_PERCENT 10
-#define ZF_STANDARD_CURRENCY 20
-#define ZF_STANDARD_DATE 30
-#define ZF_STANDARD_TIME 40
-#define ZF_STANDARD_DATETIME 50
-#define ZF_STANDARD_SCIENTIFIC 60
-#define ZF_STANDARD_FRACTION 70
-#define ZF_STANDARD_NEWEXTENDED 75
-#define ZF_STANDARD_NEWEXTENDEDMAX SV_MAX_ANZ_STANDARD_FORMATE-2 // 98
-#define ZF_STANDARD_LOGICAL SV_MAX_ANZ_STANDARD_FORMATE-1 // 99
-#define ZF_STANDARD_TEXT SV_MAX_ANZ_STANDARD_FORMATE // 100
-
-/* Locale that is set if an unknown locale (from another system) is loaded of
- * legacy documents. Can not be SYSTEM because else, for example, a German "DM"
- * (old currency) is recognized as a date (#53155#). */
-#define UNKNOWN_SUBSTITUTE LANGUAGE_ENGLISH_US
-
-static BOOL bIndexTableInitialized = FALSE;
-static sal_uInt32 __FAR_DATA theIndexTable[NF_INDEX_TABLE_ENTRIES];
-
-
-// ====================================================================
-
-/**
- instead of every number formatter being a listener we have a registry which
- also handles one instance of the SysLocale options
- */
-
-class SvNumberFormatterRegistry_Impl : public SvtListener
-{
- List aFormatters;
- SvtSysLocaleOptions aSysLocaleOptions;
- LanguageType eSysLanguage;
-
-public:
- SvNumberFormatterRegistry_Impl();
- virtual ~SvNumberFormatterRegistry_Impl();
-
- void Insert( SvNumberFormatter* pThis )
- { aFormatters.Insert( pThis, LIST_APPEND ); }
- SvNumberFormatter* Remove( SvNumberFormatter* pThis )
- { return (SvNumberFormatter*)aFormatters.Remove( pThis ); }
- sal_uInt32 Count()
- { return aFormatters.Count(); }
-
- virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
-
-};
-
-
-SvNumberFormatterRegistry_Impl::SvNumberFormatterRegistry_Impl()
-{
- eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
- aSysLocaleOptions.AddListener( *this );
-}
-
-
-SvNumberFormatterRegistry_Impl::~SvNumberFormatterRegistry_Impl()
-{
- aSysLocaleOptions.RemoveListener( *this );
-}
-
-
-void SvNumberFormatterRegistry_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint )
-{
- const SfxSimpleHint* pHint = PTR_CAST( SfxSimpleHint, &rHint );
- if( pHint )
- {
- if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE )
- {
- ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() );
- for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First();
- p; p = (SvNumberFormatter*)aFormatters.Next() )
- {
- p->ReplaceSystemCL( eSysLanguage );
- }
- eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
- }
- if ( pHint->GetId() & SYSLOCALEOPTIONS_HINT_CURRENCY )
- {
- ::osl::MutexGuard aGuard( SvNumberFormatter::GetMutex() );
- for ( SvNumberFormatter* p = (SvNumberFormatter*)aFormatters.First();
- p; p = (SvNumberFormatter*)aFormatters.Next() )
- {
- p->ResetDefaultSystemCurrency();
- }
- }
- }
-}
-
-
-// ====================================================================
-
-SvNumberFormatterRegistry_Impl* SvNumberFormatter::pFormatterRegistry = NULL;
-BOOL SvNumberFormatter::bCurrencyTableInitialized = FALSE;
-namespace
-{
- struct theCurrencyTable :
- public rtl::Static< NfCurrencyTable, theCurrencyTable > {};
-
- struct theLegacyOnlyCurrencyTable :
- public rtl::Static< NfCurrencyTable, theLegacyOnlyCurrencyTable > {};
-}
-USHORT SvNumberFormatter::nSystemCurrencyPosition = 0;
-SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* );
-SV_IMPL_PTRARR( NfWSStringsDtor, String* );
-
-// ob das BankSymbol immer am Ende ist (1 $;-1 $) oder sprachabhaengig
-#define NF_BANKSYMBOL_FIX_POSITION 1
-
-
-/***********************Funktionen SvNumberFormatter**************************/
-
-SvNumberFormatter::SvNumberFormatter(
- const Reference< XMultiServiceFactory >& xSMgr,
- LanguageType eLang )
- :
- xServiceManager( xSMgr )
-{
- ImpConstruct( eLang );
-}
-
-
-SvNumberFormatter::SvNumberFormatter( LanguageType eLang )
-{
- ImpConstruct( eLang );
-}
-
-
-SvNumberFormatter::~SvNumberFormatter()
-{
- {
- ::osl::MutexGuard aGuard( GetMutex() );
- pFormatterRegistry->Remove( this );
- if ( !pFormatterRegistry->Count() )
- {
- delete pFormatterRegistry;
- pFormatterRegistry = NULL;
- }
- }
-
- SvNumberformat* pEntry = aFTable.First();
- while (pEntry)
- {
- delete pEntry;
- pEntry = aFTable.Next();
- }
- delete pFormatTable;
- delete pCharClass;
- delete pStringScanner;
- delete pFormatScanner;
- ClearMergeTable();
- delete pMergeTable;
-}
-
-
-void SvNumberFormatter::ImpConstruct( LanguageType eLang )
-{
- RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpConstruct" );
-
- if ( eLang == LANGUAGE_DONTKNOW )
- eLang = UNKNOWN_SUBSTITUTE;
- IniLnge = eLang;
- ActLnge = eLang;
- eEvalDateFormat = NF_EVALDATEFORMAT_INTL;
- nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
-
- aLocale = MsLangId::convertLanguageToLocale( eLang );
- pCharClass = new CharClass( xServiceManager, aLocale );
- xLocaleData.init( xServiceManager, aLocale, eLang );
- xCalendar.init( xServiceManager, aLocale );
- xTransliteration.init( xServiceManager, eLang,
- ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE );
- xNatNum.init( xServiceManager );
-
- // cached locale data items
- const LocaleDataWrapper* pLoc = GetLocaleData();
- aDecimalSep = pLoc->getNumDecimalSep();
- aThousandSep = pLoc->getNumThousandSep();
- aDateSep = pLoc->getDateSep();
-
- pStringScanner = new ImpSvNumberInputScan( this );
- pFormatScanner = new ImpSvNumberformatScan( this );
- pFormatTable = NULL;
- MaxCLOffset = 0;
- ImpGenerateFormats( 0, FALSE ); // 0 .. 999 for initialized language formats
- pMergeTable = NULL;
- bNoZero = FALSE;
-
- ::osl::MutexGuard aGuard( GetMutex() );
- GetFormatterRegistry().Insert( this );
-}
-
-
-void SvNumberFormatter::ChangeIntl(LanguageType eLnge)
-{
- if (ActLnge != eLnge)
- {
- ActLnge = eLnge;
-
- aLocale = MsLangId::convertLanguageToLocale( eLnge );
- pCharClass->setLocale( aLocale );
- xLocaleData.changeLocale( aLocale, eLnge );
- xCalendar.changeLocale( aLocale );
- xTransliteration.changeLocale( eLnge );
-
- // cached locale data items, initialize BEFORE calling ChangeIntl below
- const LocaleDataWrapper* pLoc = GetLocaleData();
- aDecimalSep = pLoc->getNumDecimalSep();
- aThousandSep = pLoc->getNumThousandSep();
- aDateSep = pLoc->getDateSep();
-
- pFormatScanner->ChangeIntl();
- pStringScanner->ChangeIntl();
- }
-}
-
-
-// static
-::osl::Mutex& SvNumberFormatter::GetMutex()
-{
- static ::osl::Mutex* pMutex = NULL;
- if( !pMutex )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if( !pMutex )
- {
- // #i77768# Due to a static reference in the toolkit lib
- // we need a mutex that lives longer than the svtools library.
- // Otherwise the dtor would use a destructed mutex!!
- pMutex = new ::osl::Mutex;
- }
- }
- return *pMutex;
-}
-
-
-// static
-SvNumberFormatterRegistry_Impl& SvNumberFormatter::GetFormatterRegistry()
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( !pFormatterRegistry )
- pFormatterRegistry = new SvNumberFormatterRegistry_Impl;
- return *pFormatterRegistry;
-}
-
-
-Color* SvNumberFormatter::GetUserDefColor(USHORT nIndex)
-{
- if( aColorLink.IsSet() )
- return (Color*) ( aColorLink.Call( (void*) &nIndex ));
- else
- return NULL;
-}
-
-void SvNumberFormatter::ChangeNullDate(USHORT nDay,
- USHORT nMonth,
- USHORT nYear)
-{
- pFormatScanner->ChangeNullDate(nDay, nMonth, nYear);
- pStringScanner->ChangeNullDate(nDay, nMonth, nYear);
-}
-
-Date* SvNumberFormatter::GetNullDate()
-{
- return pFormatScanner->GetNullDate();
-}
-
-void SvNumberFormatter::ChangeStandardPrec(short nPrec)
-{
- pFormatScanner->ChangeStandardPrec(nPrec);
-}
-
-short SvNumberFormatter::GetStandardPrec()
-{
- return pFormatScanner->GetStandardPrec();
-}
-
-void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, BOOL bLoadingSO5 )
-{
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = UNKNOWN_SUBSTITUTE;
- if (eLnge != IniLnge)
- {
- IniLnge = eLnge;
- ChangeIntl(eLnge);
- SvNumberformat* pEntry = aFTable.First();
- while (pEntry) // delete old formats
- {
- pEntry = (SvNumberformat*) aFTable.Remove(aFTable.GetCurKey());
- delete pEntry;
- pEntry = (SvNumberformat*) aFTable.First();
- }
- ImpGenerateFormats( 0, bLoadingSO5 ); // new standard formats
- }
- else if ( bLoadingSO5 )
- { // delete additional standard formats
- sal_uInt32 nKey;
- aFTable.Seek( SV_MAX_ANZ_STANDARD_FORMATE + 1 );
- while ( (nKey = aFTable.GetCurKey()) > SV_MAX_ANZ_STANDARD_FORMATE &&
- nKey < SV_COUNTRY_LANGUAGE_OFFSET )
- {
- SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey );
- delete pEntry;
- }
- }
-}
-
-
-void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
-{
- sal_uInt32 nCLOffset = ImpGetCLOffset( LANGUAGE_SYSTEM );
- if ( nCLOffset > MaxCLOffset )
- return ; // no SYSTEM entries to replace
-
- const sal_uInt32 nMaxBuiltin = nCLOffset + SV_MAX_ANZ_STANDARD_FORMATE;
- const sal_uInt32 nNextCL = nCLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
- sal_uInt32 nKey;
-
- // remove old builtin formats
- aFTable.Seek( nCLOffset );
- while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey <= nMaxBuiltin && aFTable.Count() )
- {
- SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey );
- delete pEntry;
- }
-
- // move additional and user defined to temporary table
- Table aOldTable;
- while ( (nKey = aFTable.GetCurKey()) >= nCLOffset && nKey < nNextCL && aFTable.Count() )
- {
- SvNumberformat* pEntry = (SvNumberformat*) aFTable.Remove( nKey );
- aOldTable.Insert( nKey, pEntry );
- }
-
- // generate new old builtin formats
- // reset ActLnge otherwise ChangeIntl() wouldn't switch if already LANGUAGE_SYSTEM
- ActLnge = LANGUAGE_DONTKNOW;
- ChangeIntl( LANGUAGE_SYSTEM );
- ImpGenerateFormats( nCLOffset, TRUE );
-
- // convert additional and user defined from old system to new system
- SvNumberformat* pStdFormat = (SvNumberformat*) aFTable.Get( nCLOffset + ZF_STANDARD );
- sal_uInt32 nLastKey = nMaxBuiltin;
- pFormatScanner->SetConvertMode( eOldLanguage, LANGUAGE_SYSTEM, TRUE );
- aOldTable.First();
- while ( aOldTable.Count() )
- {
- nKey = aOldTable.GetCurKey();
- if ( nLastKey < nKey )
- nLastKey = nKey;
- SvNumberformat* pOldEntry = (SvNumberformat*) aOldTable.Remove( nKey );
- String aString( pOldEntry->GetFormatstring() );
- xub_StrLen nCheckPos = STRING_NOTFOUND;
-
- // Same as PutEntry() but assures key position even if format code is
- // a duplicate. Also won't mix up any LastInsertKey.
- ChangeIntl( eOldLanguage );
- LanguageType eLge = eOldLanguage; // ConvertMode changes this
- BOOL bCheck = FALSE;
- SvNumberformat* pNewEntry = new SvNumberformat( aString, pFormatScanner,
- pStringScanner, nCheckPos, eLge );
- if ( nCheckPos != 0 )
- delete pNewEntry;
- else
- {
- short eCheckType = pNewEntry->GetType();
- if ( eCheckType != NUMBERFORMAT_UNDEFINED )
- pNewEntry->SetType( eCheckType | NUMBERFORMAT_DEFINED );
- else
- pNewEntry->SetType( NUMBERFORMAT_DEFINED );
-
- if ( !aFTable.Insert( nKey, pNewEntry ) )
- delete pNewEntry;
- else
- bCheck = TRUE;
- }
- DBG_ASSERT( bCheck, "SvNumberFormatter::ReplaceSystemCL: couldn't convert" );
-
- delete pOldEntry;
- }
- pFormatScanner->SetConvertMode(FALSE);
- pStdFormat->SetLastInsertKey( USHORT(nLastKey - nCLOffset) );
-
- // append new system additional formats
- NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() );
- ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, TRUE );
-}
-
-
-BOOL SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const
-{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
- if (!pFormat)
- return FALSE;
- else
- return pFormat->IsTextFormat();
-}
-
-BOOL SvNumberFormatter::HasTextFormat(sal_uInt32 F_Index) const
-{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
- if (!pFormat)
- return FALSE;
- else
- return pFormat->HasTextFormat();
-}
-
-BOOL SvNumberFormatter::PutEntry(String& rString,
- xub_StrLen& nCheckPos,
- short& nType,
- sal_uInt32& nKey, // Formatnummer
- LanguageType eLnge)
-{
- nKey = 0;
- if (rString.Len() == 0) // keinen Leerstring
- {
- nCheckPos = 1; // -> Fehler
- return FALSE;
- }
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
-
- ChangeIntl(eLnge); // ggfs. austauschen
- LanguageType eLge = eLnge; // Umgehung const fuer ConvertMode
- BOOL bCheck = FALSE;
- SvNumberformat* p_Entry = new SvNumberformat(rString,
- pFormatScanner,
- pStringScanner,
- nCheckPos,
- eLge);
- if (nCheckPos == 0) // Format ok
- { // Typvergleich:
- short eCheckType = p_Entry->GetType();
- if ( eCheckType != NUMBERFORMAT_UNDEFINED)
- {
- p_Entry->SetType(eCheckType | NUMBERFORMAT_DEFINED);
- nType = eCheckType;
- }
- else
- {
- p_Entry->SetType(NUMBERFORMAT_DEFINED);
- nType = NUMBERFORMAT_DEFINED;
- }
- sal_uInt32 CLOffset = ImpGenerateCL(eLge); // ggfs. neu Standard-
- // formate anlegen
- nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLge);
- if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden
- delete p_Entry;
- else
- {
- SvNumberformat* pStdFormat =
- (SvNumberformat*) aFTable.Get(CLOffset + ZF_STANDARD);
- sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey();
- if (nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
- {
- Sound::Beep();
- DBG_ERROR("SvNumberFormatter:: Zu viele Formate pro CL");
- delete p_Entry;
- }
- else if (!aFTable.Insert(nPos+1,p_Entry))
- delete p_Entry;
- else
- {
- bCheck = TRUE;
- nKey = nPos+1;
- pStdFormat->SetLastInsertKey((USHORT) (nKey-CLOffset));
- }
- }
- }
- else
- delete p_Entry;
- return bCheck;
-}
-
-BOOL SvNumberFormatter::PutandConvertEntry(String& rString,
- xub_StrLen& nCheckPos,
- short& nType,
- sal_uInt32& nKey,
- LanguageType eLnge,
- LanguageType eNewLnge)
-{
- BOOL bRes;
- if (eNewLnge == LANGUAGE_DONTKNOW)
- eNewLnge = IniLnge;
-
- pFormatScanner->SetConvertMode(eLnge, eNewLnge);
- bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge);
- pFormatScanner->SetConvertMode(FALSE);
- return bRes;
-}
-
-
-BOOL SvNumberFormatter::PutandConvertEntrySystem(String& rString,
- xub_StrLen& nCheckPos,
- short& nType,
- sal_uInt32& nKey,
- LanguageType eLnge,
- LanguageType eNewLnge)
-{
- BOOL bRes;
- if (eNewLnge == LANGUAGE_DONTKNOW)
- eNewLnge = IniLnge;
-
- pFormatScanner->SetConvertMode(eLnge, eNewLnge, TRUE);
- bRes = PutEntry(rString, nCheckPos, nType, nKey, eLnge);
- pFormatScanner->SetConvertMode(FALSE);
- return bRes;
-}
-
-
-sal_uInt32 SvNumberFormatter::GetIndexPuttingAndConverting( String & rString,
- LanguageType eLnge, LanguageType eSysLnge, short & rType,
- BOOL & rNewInserted, xub_StrLen & rCheckPos )
-{
- sal_uInt32 nKey = NUMBERFORMAT_ENTRY_NOT_FOUND;
- rNewInserted = FALSE;
- rCheckPos = 0;
-
- // #62389# empty format string (of Writer) => General standard format
- if (!rString.Len())
- ; // nothing
- else if (eLnge == LANGUAGE_SYSTEM && eSysLnge !=
- Application::GetSettings().GetLanguage())
- {
- sal_uInt32 nOrig = GetEntryKey( rString, eSysLnge );
- if (nOrig == NUMBERFORMAT_ENTRY_NOT_FOUND)
- nKey = nOrig; // none avaliable, maybe user-defined
- else
- nKey = GetFormatForLanguageIfBuiltIn( nOrig,
- Application::GetSettings().GetLanguage());
- if (nKey == nOrig)
- {
- // Not a builtin format, convert.
- // The format code string may get modified and adapted to the real
- // language and wouldn't match eSysLnge anymore, do that on a copy.
- String aTmp( rString);
- rNewInserted = PutandConvertEntrySystem( aTmp, rCheckPos, rType,
- nKey, eLnge, Application::GetSettings().GetLanguage());
- if (rCheckPos > 0)
- {
- DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for current locale");
- nKey = NUMBERFORMAT_ENTRY_NOT_FOUND;
- }
- }
- }
- else
- {
- nKey = GetEntryKey( rString, eLnge);
- if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
- {
- rNewInserted = PutEntry( rString, rCheckPos, rType, nKey, eLnge);
- if (rCheckPos > 0)
- {
- DBG_ERRORFILE("SvNumberFormatter::GetIndexPuttingAndConverting: bad format code string for specified locale");
- nKey = NUMBERFORMAT_ENTRY_NOT_FOUND;
- }
- }
- }
- if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
- nKey = GetStandardIndex( eLnge);
- rType = GetType( nKey);
- // Convert any (!) old "automatic" currency format to new fixed currency
- // default format.
- if ((rType & NUMBERFORMAT_CURRENCY) != 0)
- {
- const SvNumberformat* pFormat = GetEntry( nKey);
- if (!pFormat->HasNewCurrency())
- {
- if (rNewInserted)
- {
- DeleteEntry( nKey); // don't leave trails of rubbish
- rNewInserted = FALSE;
- }
- nKey = GetStandardFormat( NUMBERFORMAT_CURRENCY, eLnge);
- }
- }
- return nKey;
-}
-
-
-void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey)
-{
- SvNumberformat* pEntry = aFTable.Remove(nKey);
- delete pEntry;
-}
-
-void SvNumberFormatter::PrepareSave()
-{
- SvNumberformat* pFormat = aFTable.First();
- while (pFormat)
- {
- pFormat->SetUsed(FALSE);
- pFormat = aFTable.Next();
- }
-}
-
-void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex)
-{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
- if (pFormat)
- pFormat->SetUsed(TRUE);
-}
-
-BOOL SvNumberFormatter::Load( SvStream& rStream )
-{
- LanguageType eSysLang = Application::GetSettings().GetLanguage();
- SvNumberFormatter* pConverter = NULL;
-
- ImpSvNumMultipleReadHeader aHdr( rStream );
- USHORT nVersion;
- rStream >> nVersion;
- SvNumberformat* pEntry;
- sal_uInt32 nPos;
- LanguageType eSaveSysLang, eLoadSysLang;
- USHORT nSysOnStore, eLge, eDummy; // Dummy fuer kompatibles Format
- rStream >> nSysOnStore >> eLge; // Systemeinstellung aus
- // Dokument
- eSaveSysLang = (nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE ?
- LANGUAGE_SYSTEM : (LanguageType) nSysOnStore);
- LanguageType eLnge = (LanguageType) eLge;
- ImpChangeSysCL( eLnge, TRUE );
-
- rStream >> nPos;
- while (nPos != NUMBERFORMAT_ENTRY_NOT_FOUND)
- {
- rStream >> eDummy >> eLge;
- eLnge = (LanguageType) eLge;
- ImpGenerateCL( eLnge, TRUE ); // ggfs. neue Standardformate anlegen
-
- sal_uInt32 nOffset = nPos % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
- BOOL bUserDefined = (nOffset > SV_MAX_ANZ_STANDARD_FORMATE);
- //! HACK! ER 29.07.97 15:15
- // SaveLang wurde bei SYSTEM nicht gespeichert sondern war auch SYSTEM,
- // erst ab 364i Unterscheidung moeglich
- BOOL bConversionHack;
- if ( eLnge == LANGUAGE_SYSTEM )
- {
- if ( nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE )
- {
- bConversionHack = bUserDefined;
- eLoadSysLang = eSaveSysLang;
- }
- else
- {
- bConversionHack = FALSE;
- eLoadSysLang = eSysLang;
- }
- }
- else
- {
- bConversionHack = FALSE;
- eLoadSysLang = eSaveSysLang;
- }
-
- pEntry = new SvNumberformat(*pFormatScanner, eLnge);
- if ( bConversionHack )
- { // SYSTEM
- // nVersion < SV_NUMBERFORMATTER_VERSION_SYSTORE
- // nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS
- if ( !pConverter )
- pConverter = new SvNumberFormatter( xServiceManager, eSysLang );
- NfHackConversion eHackConversion = pEntry->Load(
- rStream, aHdr, pConverter, *pStringScanner );
- switch ( eHackConversion )
- {
- case NF_CONVERT_GERMAN_ENGLISH :
- pEntry->ConvertLanguage( *pConverter,
- LANGUAGE_ENGLISH_US, eSysLang, TRUE );
- break;
- case NF_CONVERT_ENGLISH_GERMAN :
- switch ( eSysLang )
- {
- case LANGUAGE_GERMAN:
- case LANGUAGE_GERMAN_SWISS:
- case LANGUAGE_GERMAN_AUSTRIAN:
- case LANGUAGE_GERMAN_LUXEMBOURG:
- case LANGUAGE_GERMAN_LIECHTENSTEIN:
- // alles beim alten
- break;
- default:
- pEntry->ConvertLanguage( *pConverter,
- LANGUAGE_GERMAN, eSysLang, TRUE );
- }
- break;
- case NF_CONVERT_NONE :
- break; // -Wall not handled.
- }
-
- }
- else
- {
- pEntry->Load( rStream, aHdr, NULL, *pStringScanner );
- if ( !bUserDefined )
- bUserDefined = (pEntry->GetNewStandardDefined() > SV_NUMBERFORMATTER_VERSION);
- if ( bUserDefined )
- {
- if ( eSaveSysLang != eLoadSysLang )
- { // SYSTEM verschieden
- if ( !pConverter )
- pConverter = new SvNumberFormatter( xServiceManager, eSysLang );
- if ( nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS )
- {
- switch ( eSaveSysLang )
- {
- case LANGUAGE_GERMAN:
- case LANGUAGE_GERMAN_SWISS:
- case LANGUAGE_GERMAN_AUSTRIAN:
- case LANGUAGE_GERMAN_LUXEMBOURG:
- case LANGUAGE_GERMAN_LIECHTENSTEIN:
- // alles beim alten
- pEntry->ConvertLanguage( *pConverter,
- eSaveSysLang, eLoadSysLang, TRUE );
- break;
- default:
- // alte english nach neuem anderen
- pEntry->ConvertLanguage( *pConverter,
- LANGUAGE_ENGLISH_US, eLoadSysLang, TRUE );
- }
- }
- else
- pEntry->ConvertLanguage( *pConverter,
- eSaveSysLang, eLoadSysLang, TRUE );
- }
- else
- { // nicht SYSTEM oder gleiches SYSTEM
- if ( nVersion < SV_NUMBERFORMATTER_VERSION_KEYWORDS )
- {
- LanguageType eLoadLang;
- BOOL bSystem;
- if ( eLnge == LANGUAGE_SYSTEM )
- {
- eLoadLang = eSysLang;
- bSystem = TRUE;
- }
- else
- {
- eLoadLang = eLnge;
- bSystem = FALSE;
- }
- switch ( eLoadLang )
- {
- case LANGUAGE_GERMAN:
- case LANGUAGE_GERMAN_SWISS:
- case LANGUAGE_GERMAN_AUSTRIAN:
- case LANGUAGE_GERMAN_LUXEMBOURG:
- case LANGUAGE_GERMAN_LIECHTENSTEIN:
- // alles beim alten
- break;
- default:
- // alte english nach neuem anderen
- if ( !pConverter )
- pConverter = new SvNumberFormatter( xServiceManager, eSysLang );
- pEntry->ConvertLanguage( *pConverter,
- LANGUAGE_ENGLISH_US, eLoadLang, bSystem );
- }
- }
- }
- }
- }
- if ( nOffset == 0 ) // StandardFormat
- {
- SvNumberformat* pEnt = aFTable.Get(nPos);
- if (pEnt)
- pEnt->SetLastInsertKey(pEntry->GetLastInsertKey());
- }
- if (!aFTable.Insert(nPos, pEntry))
- delete pEntry;
- rStream >> nPos;
- }
-
- // ab SV_NUMBERFORMATTER_VERSION_YEAR2000
- if ( nVersion >= SV_NUMBERFORMATTER_VERSION_YEAR2000 )
- {
- aHdr.StartEntry();
- if ( aHdr.BytesLeft() >= sizeof(UINT16) )
- {
- UINT16 nY2k;
- rStream >> nY2k;
- if ( nVersion < SV_NUMBERFORMATTER_VERSION_TWODIGITYEAR && nY2k < 100 )
- nY2k += 1901; // war vor src513e: 29, jetzt: 1930
- SetYear2000( nY2k );
- }
- aHdr.EndEntry();
- }
-
- if ( pConverter )
- delete pConverter;
-
- // generate additional i18n standard formats for all used locales
- LanguageType eOldLanguage = ActLnge;
- NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() );
- SvUShorts aList;
- GetUsedLanguages( aList );
- USHORT nCount = aList.Count();
- for ( USHORT j=0; j<nCount; j++ )
- {
- LanguageType eLang = aList[j];
- ChangeIntl( eLang );
- sal_uInt32 CLOffset = ImpGetCLOffset( eLang );
- ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, TRUE );
- }
- ChangeIntl( eOldLanguage );
-
- if (rStream.GetError())
- return FALSE;
- else
- return TRUE;
-}
-
-BOOL SvNumberFormatter::Save( SvStream& rStream ) const
-{
- ImpSvNumMultipleWriteHeader aHdr( rStream );
- // ab 364i wird gespeichert was SYSTEM wirklich war, vorher hart LANGUAGE_SYSTEM
- rStream << (USHORT) SV_NUMBERFORMATTER_VERSION;
- rStream << (USHORT) Application::GetSettings().GetLanguage() << (USHORT) IniLnge;
- SvNumberFormatTable* pTable = (SvNumberFormatTable*) &aFTable;
- SvNumberformat* pEntry = (SvNumberformat*) pTable->First();
- while (pEntry)
- {
- // Gespeichert werden alle markierten, benutzerdefinierten Formate und
- // jeweils das Standardformat zu allen angewaehlten CL-Kombinationen
- // sowie NewStandardDefined
- if ( pEntry->GetUsed() || (pEntry->GetType() & NUMBERFORMAT_DEFINED) ||
- pEntry->GetNewStandardDefined() ||
- (pTable->GetCurKey() % SV_COUNTRY_LANGUAGE_OFFSET == 0) )
- {
- rStream << static_cast<sal_uInt32>(pTable->GetCurKey())
- << (USHORT) LANGUAGE_SYSTEM
- << (USHORT) pEntry->GetLanguage();
- pEntry->Save(rStream, aHdr);
- }
- pEntry = (SvNumberformat*) pTable->Next();
- }
- rStream << NUMBERFORMAT_ENTRY_NOT_FOUND; // EndeKennung
-
- // ab SV_NUMBERFORMATTER_VERSION_YEAR2000
- aHdr.StartEntry();
- rStream << (UINT16) GetYear2000();
- aHdr.EndEntry();
-
- if (rStream.GetError())
- return FALSE;
- else
- return TRUE;
-}
-
-// static
-void SvNumberFormatter::SkipNumberFormatterInStream( SvStream& rStream )
-{
- ImpSvNumMultipleReadHeader::Skip( rStream );
-}
-
-void SvNumberFormatter::GetUsedLanguages( SvUShorts& rList )
-{
- rList.Remove( 0, rList.Count() );
-
- sal_uInt32 nOffset = 0;
- while (nOffset <= MaxCLOffset)
- {
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nOffset);
- if (pFormat)
- rList.Insert( pFormat->GetLanguage(), rList.Count() );
- nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
- }
-}
-
-
-void SvNumberFormatter::FillKeywordTable( NfKeywordTable& rKeywords,
- LanguageType eLang )
-{
- ChangeIntl( eLang );
- const String* pTable = pFormatScanner->GetKeywords();
- for ( USHORT i = 0; i < NF_KEYWORD_ENTRIES_COUNT; ++i )
- {
- rKeywords[i] = pTable[i];
- }
-}
-
-
-String SvNumberFormatter::GetKeyword( LanguageType eLnge, USHORT nIndex )
-{
- ChangeIntl(eLnge);
- const String* pTable = pFormatScanner->GetKeywords();
- if ( pTable && nIndex < NF_KEYWORD_ENTRIES_COUNT )
- return pTable[nIndex];
-
- DBG_ERROR("GetKeyword: invalid index");
- return String();
-}
-
-
-String SvNumberFormatter::GetStandardName( LanguageType eLnge )
-{
- ChangeIntl( eLnge );
- return pFormatScanner->GetStandardName();
-}
-
-
-sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const
-{
- SvNumberformat* pFormat;
- sal_uInt32 nOffset = 0;
- while (nOffset <= MaxCLOffset)
- {
- pFormat = (SvNumberformat*) aFTable.Get(nOffset);
- if (pFormat && pFormat->GetLanguage() == eLnge)
- return nOffset;
- nOffset += SV_COUNTRY_LANGUAGE_OFFSET;
- }
- return nOffset;
-}
-
-sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString,
- sal_uInt32 nCLOffset,
- LanguageType eLnge)
-{
-#ifndef NF_COMMENT_IN_FORMATSTRING
-#error NF_COMMENT_IN_FORMATSTRING not defined (zformat.hxx)
-#endif
-#if NF_COMMENT_IN_FORMATSTRING
- String aStr( rString );
- SvNumberformat::EraseComment( aStr );
-#endif
- sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND;
- SvNumberformat* pEntry;
- pEntry = (SvNumberformat*) aFTable.Seek(nCLOffset);
- while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND &&
- pEntry && pEntry->GetLanguage() == eLnge )
- {
-#if NF_COMMENT_IN_FORMATSTRING
- if ( pEntry->GetComment().Len() )
- {
- String aFormat( pEntry->GetFormatstring() );
- SvNumberformat::EraseComment( aFormat );
- if ( aStr == aFormat )
- res = aFTable.GetCurKey();
- else
- pEntry = (SvNumberformat*) aFTable.Next();
- }
- else
- {
- if ( aStr == pEntry->GetFormatstring() )
- res = aFTable.GetCurKey();
- else
- pEntry = (SvNumberformat*) aFTable.Next();
- }
-#else
- if ( rString == pEntry->GetFormatstring() )
- res = aFTable.GetCurKey();
- else
- pEntry = (SvNumberformat*) aFTable.Next();
-#endif
- }
- return res;
-}
-
-
-SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable(
- short& eType,
- sal_uInt32& FIndex,
- LanguageType& rLnge)
-{
- short eTypetmp = eType;
- if (eType == NUMBERFORMAT_ALL) // Leere Zelle oder don't care
- rLnge = IniLnge;
- else
- {
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(FIndex);
- if (!pFormat)
- {
-// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (1)");
- rLnge = IniLnge;
- eType = NUMBERFORMAT_ALL;
- eTypetmp = eType;
- }
- else
- {
- rLnge = pFormat->GetLanguage();
- eType = pFormat->GetType()&~NUMBERFORMAT_DEFINED;
- if (eType == 0)
- {
- eType = NUMBERFORMAT_DEFINED;
- eTypetmp = eType;
- }
- else if (eType == NUMBERFORMAT_DATETIME)
- {
- eTypetmp = eType;
- eType = NUMBERFORMAT_DATE;
- }
- else
- eTypetmp = eType;
- }
- }
- ChangeIntl(rLnge);
- return GetEntryTable(eTypetmp, FIndex, rLnge);
-}
-
-sal_uInt32 SvNumberFormatter::ImpGenerateCL( LanguageType eLnge, BOOL bLoadingSO5 )
-{
- ChangeIntl(eLnge);
- sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge);
- if (CLOffset > MaxCLOffset)
- { // new CL combination
- if (LocaleDataWrapper::areChecksEnabled())
- {
- Locale aLoadedLocale = xLocaleData->getLoadedLocale();
- if ( aLoadedLocale.Language != aLocale.Language ||
- aLoadedLocale.Country != aLocale.Country )
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumerFormatter::ImpGenerateCL: locales don't match:"));
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg ));
- }
- // test XML locale data FormatElement entries
- {
- uno::Sequence< i18n::FormatElement > xSeq =
- xLocaleData->getAllFormats();
- // A test for completeness of formatindex="0" ...
- // formatindex="47" is not needed here since it is done in
- // ImpGenerateFormats().
-
- // Test for dupes of formatindex="..."
- for ( sal_Int32 j = 0; j < xSeq.getLength(); j++ )
- {
- sal_Int16 nIdx = xSeq[j].formatIndex;
- String aDupes;
- for ( sal_Int32 i = 0; i < xSeq.getLength(); i++ )
- {
- if ( i != j && xSeq[i].formatIndex == nIdx )
- {
- aDupes += String::CreateFromInt32( i );
- aDupes += '(';
- aDupes += String( xSeq[i].formatKey );
- aDupes += ')';
- aDupes += ' ';
- }
- }
- if ( aDupes.Len() )
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "XML locale data FormatElement formatindex dupe: "));
- aMsg += String::CreateFromInt32( nIdx );
- aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM(
- "\nFormatElements: "));
- aMsg += String::CreateFromInt32( j );
- aMsg += '(';
- aMsg += String( xSeq[j].formatKey );
- aMsg += ')';
- aMsg += ' ';
- aMsg += aDupes;
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg ));
- }
- }
- }
- }
-
- MaxCLOffset += SV_COUNTRY_LANGUAGE_OFFSET;
- ImpGenerateFormats( MaxCLOffset, bLoadingSO5 );
- CLOffset = MaxCLOffset;
- }
- return CLOffset;
-}
-
-SvNumberFormatTable& SvNumberFormatter::ChangeCL(short eType,
- sal_uInt32& FIndex,
- LanguageType eLnge)
-{
- ImpGenerateCL(eLnge);
- return GetEntryTable(eType, FIndex, ActLnge);
-}
-
-SvNumberFormatTable& SvNumberFormatter::GetEntryTable(
- short eType,
- sal_uInt32& FIndex,
- LanguageType eLnge)
-{
- if ( pFormatTable )
- pFormatTable->Clear();
- else
- pFormatTable = new SvNumberFormatTable;
- ChangeIntl(eLnge);
- sal_uInt32 CLOffset = ImpGetCLOffset(ActLnge);
-
- // Might generate and insert a default format for the given type
- // (e.g. currency) => has to be done before collecting formats.
- sal_uInt32 nDefaultIndex = GetStandardFormat( eType, ActLnge );
-
- SvNumberformat* pEntry;
- pEntry = (SvNumberformat*) aFTable.Seek(CLOffset);
-
- if (eType == NUMBERFORMAT_ALL)
- {
- while (pEntry && pEntry->GetLanguage() == ActLnge)
- { // copy all entries to output table
- pFormatTable->Insert( aFTable.GetCurKey(), pEntry );
- pEntry = (SvNumberformat*) aFTable.Next();
- }
- }
- else
- {
- while (pEntry && pEntry->GetLanguage() == ActLnge)
- { // copy entries of queried type to output table
- if ((pEntry->GetType()) & eType)
- pFormatTable->Insert(aFTable.GetCurKey(),pEntry);
- pEntry = (SvNumberformat*) aFTable.Next();
- }
- }
- if ( pFormatTable->Count() > 0 )
- { // select default if queried format doesn't exist or queried type or
- // language differ from existing format
- pEntry = aFTable.Get(FIndex);
- if ( !pEntry || !(pEntry->GetType() & eType) || pEntry->GetLanguage() != ActLnge )
- FIndex = nDefaultIndex;
- }
- return *pFormatTable;
-}
-
-BOOL SvNumberFormatter::IsNumberFormat(const String& sString,
- sal_uInt32& F_Index,
- double& fOutNumber)
-{
- short FType;
- const SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index);
- if (!pFormat)
- {
-// DBG_ERROR("SvNumberFormatter:: Unbekanntes altes Zahlformat (2)");
- ChangeIntl(IniLnge);
- FType = NUMBERFORMAT_NUMBER;
- }
- else
- {
- FType = pFormat->GetType() &~NUMBERFORMAT_DEFINED;
- if (FType == 0)
- FType = NUMBERFORMAT_DEFINED;
- ChangeIntl(pFormat->GetLanguage());
- }
- BOOL res;
- short RType = FType;
- // Ergebnistyp
- // ohne def-Kennung
- if (RType == NUMBERFORMAT_TEXT) // Zahlzelle ->Stringz.
- res = FALSE;
- else
- res = pStringScanner->IsNumberFormat(sString, RType, fOutNumber, pFormat);
-
- if (res && !IsCompatible(FType, RType)) // unpassender Typ
- {
- switch ( RType )
- {
- case NUMBERFORMAT_TIME :
- {
- if ( pStringScanner->GetDecPos() )
- { // 100stel Sekunden
- if ( pStringScanner->GetAnzNums() > 3 || fOutNumber < 0.0 )
- F_Index = GetFormatIndex( NF_TIME_HH_MMSS00, ActLnge );
- else
- F_Index = GetFormatIndex( NF_TIME_MMSS00, ActLnge );
- }
- else if ( fOutNumber >= 1.0 || fOutNumber < 0.0 )
- F_Index = GetFormatIndex( NF_TIME_HH_MMSS, ActLnge );
- else
- F_Index = GetStandardFormat( RType, ActLnge );
- }
- break;
- default:
- F_Index = GetStandardFormat( RType, ActLnge );
- }
- }
- return res;
-}
-
-BOOL SvNumberFormatter::IsCompatible(short eOldType,
- short eNewType)
-{
- if (eOldType == eNewType)
- return TRUE;
- else if (eOldType == NUMBERFORMAT_DEFINED)
- return TRUE;
- else
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_NUMBER:
- {
- switch (eOldType)
- {
- case NUMBERFORMAT_PERCENT:
- case NUMBERFORMAT_CURRENCY:
- case NUMBERFORMAT_SCIENTIFIC:
- case NUMBERFORMAT_FRACTION:
-// case NUMBERFORMAT_LOGICAL:
- case NUMBERFORMAT_DEFINED:
- return TRUE;
- default:
- return FALSE;
- }
- }
- break;
- case NUMBERFORMAT_DATE:
- {
- switch (eOldType)
- {
- case NUMBERFORMAT_DATETIME:
- return TRUE;
- default:
- return FALSE;
- }
- }
- break;
- case NUMBERFORMAT_TIME:
- {
- switch (eOldType)
- {
- case NUMBERFORMAT_DATETIME:
- return TRUE;
- default:
- return FALSE;
- }
- }
- break;
- case NUMBERFORMAT_DATETIME:
- {
- switch (eOldType)
- {
- case NUMBERFORMAT_TIME:
- case NUMBERFORMAT_DATE:
- return TRUE;
- default:
- return FALSE;
- }
- }
- break;
- default:
- return FALSE;
- }
- return FALSE;
- }
-}
-
-
-sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
-{
- sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge );
- sal_uInt32 nSearch;
- switch( nType )
- {
- case NUMBERFORMAT_DATE :
- nSearch = CLOffset + ZF_STANDARD_DATE;
- break;
- case NUMBERFORMAT_TIME :
- nSearch = CLOffset + ZF_STANDARD_TIME;
- break;
- case NUMBERFORMAT_DATETIME :
- nSearch = CLOffset + ZF_STANDARD_DATETIME;
- break;
- case NUMBERFORMAT_PERCENT :
- nSearch = CLOffset + ZF_STANDARD_PERCENT;
- break;
- case NUMBERFORMAT_SCIENTIFIC:
- nSearch = CLOffset + ZF_STANDARD_SCIENTIFIC;
- break;
- default:
- nSearch = CLOffset + ZF_STANDARD;
- }
- sal_uInt32 nDefaultFormat = (sal_uInt32)(sal_uIntPtr) aDefaultFormatKeys.Get( nSearch );
- if ( !nDefaultFormat )
- nDefaultFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
- if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
- { // look for a defined standard
- sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
- sal_uInt32 nKey;
- aFTable.Seek( CLOffset );
- while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey )
- {
- const SvNumberformat* pEntry =
- (const SvNumberformat*) aFTable.GetCurObject();
- if ( pEntry->IsStandard() && ((pEntry->GetType() &
- ~NUMBERFORMAT_DEFINED) == nType) )
- {
- nDefaultFormat = nKey;
- break; // while
- }
- aFTable.Next();
- }
-
- if ( nDefaultFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
- { // none found, use old fixed standards
- switch( nType )
- {
- case NUMBERFORMAT_DATE :
- nDefaultFormat = CLOffset + ZF_STANDARD_DATE;
- break;
- case NUMBERFORMAT_TIME :
- nDefaultFormat = CLOffset + ZF_STANDARD_TIME+1;
- break;
- case NUMBERFORMAT_DATETIME :
- nDefaultFormat = CLOffset + ZF_STANDARD_DATETIME;
- break;
- case NUMBERFORMAT_PERCENT :
- nDefaultFormat = CLOffset + ZF_STANDARD_PERCENT+1;
- break;
- case NUMBERFORMAT_SCIENTIFIC:
- nDefaultFormat = CLOffset + ZF_STANDARD_SCIENTIFIC;
- break;
- default:
- nDefaultFormat = CLOffset + ZF_STANDARD;
- }
- }
- aDefaultFormatKeys.Insert( nSearch, (void*) nDefaultFormat );
- }
- return nDefaultFormat;
-}
-
-
-sal_uInt32 SvNumberFormatter::GetStandardFormat( short eType, LanguageType eLnge )
-{
- sal_uInt32 CLOffset = ImpGenerateCL(eLnge);
- switch(eType)
- {
- case NUMBERFORMAT_CURRENCY :
- {
- if ( eLnge == LANGUAGE_SYSTEM )
- return ImpGetDefaultSystemCurrencyFormat();
- else
- return ImpGetDefaultCurrencyFormat();
- }
- case NUMBERFORMAT_DATE :
- case NUMBERFORMAT_TIME :
- case NUMBERFORMAT_DATETIME :
- case NUMBERFORMAT_PERCENT :
- case NUMBERFORMAT_SCIENTIFIC:
- return ImpGetDefaultFormat( eType );
-
- case NUMBERFORMAT_FRACTION : return CLOffset + ZF_STANDARD_FRACTION;
- case NUMBERFORMAT_LOGICAL : return CLOffset + ZF_STANDARD_LOGICAL;
- case NUMBERFORMAT_TEXT : return CLOffset + ZF_STANDARD_TEXT;
- case NUMBERFORMAT_ALL :
- case NUMBERFORMAT_DEFINED :
- case NUMBERFORMAT_NUMBER :
- case NUMBERFORMAT_UNDEFINED :
- default : return CLOffset + ZF_STANDARD;
- }
-}
-
-BOOL SvNumberFormatter::IsSpecialStandardFormat( sal_uInt32 nFIndex,
- LanguageType eLnge )
-{
- return
- nFIndex == GetFormatIndex( NF_TIME_MMSS00, eLnge ) ||
- nFIndex == GetFormatIndex( NF_TIME_HH_MMSS00, eLnge ) ||
- nFIndex == GetFormatIndex( NF_TIME_HH_MMSS, eLnge )
- ;
-}
-
-sal_uInt32 SvNumberFormatter::GetStandardFormat( sal_uInt32 nFIndex, short eType,
- LanguageType eLnge )
-{
- if ( IsSpecialStandardFormat( nFIndex, eLnge ) )
- return nFIndex;
- else
- return GetStandardFormat( eType, eLnge );
-}
-
-sal_uInt32 SvNumberFormatter::GetStandardFormat( double fNumber, sal_uInt32 nFIndex,
- short eType, LanguageType eLnge )
-{
- if ( IsSpecialStandardFormat( nFIndex, eLnge ) )
- return nFIndex;
-
- switch( eType )
- {
- case NUMBERFORMAT_TIME :
- {
- BOOL bSign;
- if ( fNumber < 0.0 )
- {
- bSign = TRUE;
- fNumber = -fNumber;
- }
- else
- bSign = FALSE;
- double fSeconds = fNumber * 86400;
- if ( floor( fSeconds + 0.5 ) * 100 != floor( fSeconds * 100 + 0.5 ) )
- { // mit 100stel Sekunden
- if ( bSign || fSeconds >= 3600 )
- return GetFormatIndex( NF_TIME_HH_MMSS00, eLnge );
- else
- return GetFormatIndex( NF_TIME_MMSS00, eLnge );
- }
- else
- {
- if ( bSign || fNumber >= 1.0 )
- return GetFormatIndex( NF_TIME_HH_MMSS, eLnge );
- else
- return GetStandardFormat( eType, eLnge );
- }
- }
- default:
- return GetStandardFormat( eType, eLnge );
- }
-}
-
-void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
- sal_uInt32 nFIndex,
- String& sOutString)
-{
- SvNumberformat* pFormat;
- short nOldPrec;
- Color* pColor;
- pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
- if (!pFormat)
- pFormat = aFTable.Get(ZF_STANDARD);
- LanguageType eLang = pFormat->GetLanguage();
- ChangeIntl( eLang );
- short eType = pFormat->GetType() & ~NUMBERFORMAT_DEFINED;
- if (eType == 0)
- eType = NUMBERFORMAT_DEFINED;
- nOldPrec = -1;
- if (eType == NUMBERFORMAT_NUMBER || eType == NUMBERFORMAT_PERCENT
- || eType == NUMBERFORMAT_CURRENCY
- || eType == NUMBERFORMAT_SCIENTIFIC
- || eType == NUMBERFORMAT_FRACTION)
- {
- if (eType != NUMBERFORMAT_PERCENT) // spaeter Sonderbehandlung %
- eType = NUMBERFORMAT_NUMBER;
- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
- }
- sal_uInt32 nKey = nFIndex;
- switch ( eType )
- { // #61619# immer vierstelliges Jahr editieren
- case NUMBERFORMAT_DATE :
- nKey = GetFormatIndex( NF_DATE_SYS_DDMMYYYY, eLang );
- break;
- case NUMBERFORMAT_DATETIME :
- nKey = GetFormatIndex( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, eLang );
- break;
- default:
- nKey = GetStandardFormat( fOutNumber, nFIndex, eType, eLang );
- }
- if ( nKey != nFIndex )
- pFormat = (SvNumberformat*) aFTable.Get( nKey );
- if (pFormat)
- {
- if ( eType == NUMBERFORMAT_TIME && pFormat->GetFormatPrecision() )
- {
- nOldPrec = pFormatScanner->GetStandardPrec();
- ChangeStandardPrec(300); // Merkwert
- }
- pFormat->GetOutputString(fOutNumber, sOutString, &pColor);
- }
- if (nOldPrec != -1)
- ChangeStandardPrec(nOldPrec);
-}
-
-void SvNumberFormatter::GetOutputString(const double& fOutNumber,
- sal_uInt32 nFIndex,
- String& sOutString,
- Color** ppColor)
-{
- if (bNoZero && fOutNumber == 0.0)
- {
- sOutString.Erase();
- return;
- }
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
- if (!pFormat)
- pFormat = aFTable.Get(ZF_STANDARD);
- ChangeIntl(pFormat->GetLanguage());
- pFormat->GetOutputString(fOutNumber, sOutString, ppColor);
-}
-
-void SvNumberFormatter::GetOutputString(String& sString,
- sal_uInt32 nFIndex,
- String& sOutString,
- Color** ppColor)
-{
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
- if (!pFormat)
- pFormat = aFTable.Get(ZF_STANDARD_TEXT);
- if (!pFormat->IsTextFormat() && !pFormat->HasTextFormat())
- {
- *ppColor = NULL;
- sOutString = sString;
- }
- else
- {
- ChangeIntl(pFormat->GetLanguage());
- pFormat->GetOutputString(sString, sOutString, ppColor);
- }
-}
-
-BOOL SvNumberFormatter::GetPreviewString(const String& sFormatString,
- double fPreviewNumber,
- String& sOutString,
- Color** ppColor,
- LanguageType eLnge)
-{
- if (sFormatString.Len() == 0) // keinen Leerstring
- return FALSE;
-
- xub_StrLen nCheckPos = STRING_NOTFOUND;
- sal_uInt32 nKey;
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- ChangeIntl(eLnge); // ggfs. austauschen
- eLnge = ActLnge;
- String sTmpString = sFormatString;
- SvNumberformat* p_Entry = new SvNumberformat(sTmpString,
- pFormatScanner,
- pStringScanner,
- nCheckPos,
- eLnge);
- if (nCheckPos == 0) // String ok
- {
- sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard-
- // formate anlegen
- nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLnge);
- if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden
- GetOutputString(fPreviewNumber,nKey,sOutString,ppColor);
- else
- p_Entry->GetOutputString(fPreviewNumber,sOutString, ppColor);
- delete p_Entry;
- return TRUE;
- }
- else
- {
- delete p_Entry;
- return FALSE;
- }
-}
-
-BOOL SvNumberFormatter::GetPreviewStringGuess( const String& sFormatString,
- double fPreviewNumber,
- String& sOutString,
- Color** ppColor,
- LanguageType eLnge )
-{
- if (sFormatString.Len() == 0) // keinen Leerstring
- return FALSE;
-
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
-
- ChangeIntl( eLnge );
- eLnge = ActLnge;
- BOOL bEnglish = (eLnge == LANGUAGE_ENGLISH_US);
-
- String aFormatStringUpper( pCharClass->upper( sFormatString ) );
- sal_uInt32 nCLOffset = ImpGenerateCL( eLnge );
- sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge );
- if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND )
- { // Zielformat vorhanden
- GetOutputString( fPreviewNumber, nKey, sOutString, ppColor );
- return TRUE;
- }
-
- SvNumberformat *pEntry = NULL;
- xub_StrLen nCheckPos = STRING_NOTFOUND;
- String sTmpString;
-
- if ( bEnglish )
- {
- sTmpString = sFormatString;
- pEntry = new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eLnge );
- }
- else
- {
- nCLOffset = ImpGenerateCL( LANGUAGE_ENGLISH_US );
- nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, LANGUAGE_ENGLISH_US );
- BOOL bEnglishFormat = (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND);
-
- // try english --> other bzw. english nach other konvertieren
- LanguageType eFormatLang = LANGUAGE_ENGLISH_US;
- pFormatScanner->SetConvertMode( LANGUAGE_ENGLISH_US, eLnge );
- sTmpString = sFormatString;
- pEntry = new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eFormatLang );
- pFormatScanner->SetConvertMode( FALSE );
- ChangeIntl( eLnge );
-
- if ( !bEnglishFormat )
- {
- if ( nCheckPos > 0 || xTransliteration->isEqual( sFormatString,
- pEntry->GetFormatstring() ) )
- { // other Format
- delete pEntry;
- sTmpString = sFormatString;
- pEntry = new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eLnge );
- }
- else
- { // verify english
- xub_StrLen nCheckPos2 = STRING_NOTFOUND;
- // try other --> english
- eFormatLang = eLnge;
- pFormatScanner->SetConvertMode( eLnge, LANGUAGE_ENGLISH_US );
- sTmpString = sFormatString;
- SvNumberformat* pEntry2 = new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos2, eFormatLang );
- pFormatScanner->SetConvertMode( FALSE );
- ChangeIntl( eLnge );
- if ( nCheckPos2 == 0 && !xTransliteration->isEqual( sFormatString,
- pEntry2->GetFormatstring() ) )
- { // other Format
- delete pEntry;
- sTmpString = sFormatString;
- pEntry = new SvNumberformat( sTmpString, pFormatScanner,
- pStringScanner, nCheckPos, eLnge );
- }
- delete pEntry2;
- }
- }
- }
-
- if (nCheckPos == 0) // String ok
- {
- ImpGenerateCL( eLnge ); // ggfs. neu Standardformate anlegen
- pEntry->GetOutputString( fPreviewNumber, sOutString, ppColor );
- delete pEntry;
- return TRUE;
- }
- delete pEntry;
- return FALSE;
-}
-
-sal_uInt32 SvNumberFormatter::TestNewString(const String& sFormatString,
- LanguageType eLnge)
-{
- if (sFormatString.Len() == 0) // keinen Leerstring
- return NUMBERFORMAT_ENTRY_NOT_FOUND;
-
- xub_StrLen nCheckPos = STRING_NOTFOUND;
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- ChangeIntl(eLnge); // ggfs. austauschen
- eLnge = ActLnge;
- sal_uInt32 nRes;
- String sTmpString = sFormatString;
- SvNumberformat* pEntry = new SvNumberformat(sTmpString,
- pFormatScanner,
- pStringScanner,
- nCheckPos,
- eLnge);
- if (nCheckPos == 0) // String ok
- {
- sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard-
- // formate anlegen
- nRes = ImpIsEntry(pEntry->GetFormatstring(),CLOffset, eLnge);
- // schon vorhanden ?
- }
- else
- nRes = NUMBERFORMAT_ENTRY_NOT_FOUND;
- delete pEntry;
- return nRes;
-}
-
-SvNumberformat* SvNumberFormatter::ImpInsertFormat(
- const ::com::sun::star::i18n::NumberFormatCode& rCode,
- sal_uInt32 nPos, BOOL bAfterLoadingSO5, sal_Int16 nOrgIndex )
-{
- String aCodeStr( rCode.Code );
- if ( rCode.Index < NF_INDEX_TABLE_ENTRIES &&
- rCode.Usage == ::com::sun::star::i18n::KNumberFormatUsage::CURRENCY &&
- rCode.Index != NF_CURRENCY_1000DEC2_CCC )
- { // strip surrounding [$...] on automatic currency
- if ( aCodeStr.SearchAscii( "[$" ) != STRING_NOTFOUND )
- aCodeStr = SvNumberformat::StripNewCurrencyDelimiters( aCodeStr, FALSE );
- else
- {
- if (LocaleDataWrapper::areChecksEnabled() &&
- rCode.Index != NF_CURRENCY_1000DEC2_CCC )
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpInsertFormat: no [$...] on currency format code, index "));
- aMsg += String::CreateFromInt32( rCode.Index );
- aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ":\n"));
- aMsg += String( rCode.Code );
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- }
- }
- xub_StrLen nCheckPos = 0;
- SvNumberformat* pFormat = new SvNumberformat(aCodeStr,
- pFormatScanner,
- pStringScanner,
- nCheckPos,
- ActLnge);
- if ( !pFormat || nCheckPos > 0 )
- {
- if (LocaleDataWrapper::areChecksEnabled())
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpInsertFormat: bad format code, index "));
- aMsg += String::CreateFromInt32( rCode.Index );
- aMsg += '\n';
- aMsg += String( rCode.Code );
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- delete pFormat;
- return NULL;
- }
- if ( rCode.Index >= NF_INDEX_TABLE_ENTRIES )
- {
- sal_uInt32 nCLOffset = nPos - (nPos % SV_COUNTRY_LANGUAGE_OFFSET);
- sal_uInt32 nKey = ImpIsEntry( aCodeStr, nCLOffset, ActLnge );
- if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND )
- {
- if (LocaleDataWrapper::areChecksEnabled())
- {
- switch ( nOrgIndex )
- {
- // These may be dupes of integer versions for locales where
- // currencies have no decimals like Italian Lira.
- case NF_CURRENCY_1000DEC2 : // NF_CURRENCY_1000INT
- case NF_CURRENCY_1000DEC2_RED : // NF_CURRENCY_1000INT_RED
- case NF_CURRENCY_1000DEC2_DASHED : // NF_CURRENCY_1000INT_RED
- break;
- default:
- if ( !bAfterLoadingSO5 )
- { // If bAfterLoadingSO5 there will definitely be some dupes,
- // don't cry. But we need this test for verification of locale
- // data if not loading old SO5 documents.
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpInsertFormat: dup format code, index "));
- aMsg += String::CreateFromInt32( rCode.Index );
- aMsg += '\n';
- aMsg += String( rCode.Code );
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- }
- }
- delete pFormat;
- return NULL;
- }
- else if ( nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET )
- {
- if (LocaleDataWrapper::areChecksEnabled())
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpInsertFormat: too many format codes, index "));
- aMsg += String::CreateFromInt32( rCode.Index );
- aMsg += '\n';
- aMsg += String( rCode.Code );
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- delete pFormat;
- return NULL;
- }
- }
- if ( !aFTable.Insert( nPos, pFormat ) )
- {
- if (LocaleDataWrapper::areChecksEnabled())
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "ImpInsertFormat: can't insert number format key pos: "));
- aMsg += String::CreateFromInt32( nPos );
- aMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ", code index "));
- aMsg += String::CreateFromInt32( rCode.Index );
- aMsg += '\n';
- aMsg += String( rCode.Code );
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- delete pFormat;
- return NULL;
- }
- if ( rCode.Default )
- pFormat->SetStandard();
- if ( rCode.DefaultName.getLength() )
- pFormat->SetComment( rCode.DefaultName );
- return pFormat;
-}
-
-SvNumberformat* SvNumberFormatter::ImpInsertNewStandardFormat(
- const ::com::sun::star::i18n::NumberFormatCode& rCode,
- sal_uInt32 nPos, USHORT nVersion, BOOL bAfterLoadingSO5,
- sal_Int16 nOrgIndex )
-{
- SvNumberformat* pNewFormat = ImpInsertFormat( rCode, nPos,
- bAfterLoadingSO5, nOrgIndex );
- if (pNewFormat)
- pNewFormat->SetNewStandardDefined( nVersion );
- // so that it gets saved, displayed properly, and converted by old versions
- return pNewFormat;
-}
-
-void SvNumberFormatter::GetFormatSpecialInfo(sal_uInt32 nFormat,
- BOOL& bThousand,
- BOOL& IsRed,
- USHORT& nPrecision,
- USHORT& nAnzLeading)
-
-{
- const SvNumberformat* pFormat = aFTable.Get(nFormat);
- if (pFormat)
- pFormat->GetFormatSpecialInfo(bThousand, IsRed,
- nPrecision, nAnzLeading);
- else
- {
- bThousand = FALSE;
- IsRed = FALSE;
- nPrecision = pFormatScanner->GetStandardPrec();
- nAnzLeading = 0;
- }
-}
-
-USHORT SvNumberFormatter::GetFormatPrecision( sal_uInt32 nFormat ) const
-{
- const SvNumberformat* pFormat = aFTable.Get( nFormat );
- if ( pFormat )
- return pFormat->GetFormatPrecision();
- else
- return pFormatScanner->GetStandardPrec();
-}
-
-
-String SvNumberFormatter::GetFormatDecimalSep( sal_uInt32 nFormat ) const
-{
- const SvNumberformat* pFormat = aFTable.Get( nFormat );
- if ( !pFormat || pFormat->GetLanguage() == ActLnge )
- return GetNumDecimalSep();
-
- String aRet;
- LanguageType eSaveLang = xLocaleData.getCurrentLanguage();
- if ( pFormat->GetLanguage() == eSaveLang )
- aRet = xLocaleData->getNumDecimalSep();
- else
- {
- ::com::sun::star::lang::Locale aSaveLocale( xLocaleData->getLocale() );
- ::com::sun::star::lang::Locale aTmpLocale(MsLangId::convertLanguageToLocale(pFormat->GetLanguage()));
- ((SvNumberFormatter*)this)->xLocaleData.changeLocale(aTmpLocale, pFormat->GetLanguage() );
- aRet = xLocaleData->getNumDecimalSep();
- ((SvNumberFormatter*)this)->xLocaleData.changeLocale( aSaveLocale, eSaveLang );
- }
- return aRet;
-}
-
-
-sal_uInt32 SvNumberFormatter::GetFormatSpecialInfo( const String& rFormatString,
- BOOL& bThousand, BOOL& IsRed, USHORT& nPrecision,
- USHORT& nAnzLeading, LanguageType eLnge )
-
-{
- xub_StrLen nCheckPos = 0;
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- ChangeIntl(eLnge); // ggfs. austauschen
- eLnge = ActLnge;
- String aTmpStr( rFormatString );
- SvNumberformat* pFormat = new SvNumberformat( aTmpStr,
- pFormatScanner, pStringScanner, nCheckPos, eLnge );
- if ( nCheckPos == 0 )
- pFormat->GetFormatSpecialInfo( bThousand, IsRed, nPrecision, nAnzLeading );
- else
- {
- bThousand = FALSE;
- IsRed = FALSE;
- nPrecision = pFormatScanner->GetStandardPrec();
- nAnzLeading = 0;
- }
- delete pFormat;
- return nCheckPos;
-}
-
-
-inline sal_uInt32 SetIndexTable( NfIndexTableOffset nTabOff, sal_uInt32 nIndOff )
-{
- if ( !bIndexTableInitialized )
- {
- DBG_ASSERT( theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND,
- "SetIndexTable: theIndexTable[nTabOff] already occupied" );
- theIndexTable[nTabOff] = nIndOff;
- }
- return nIndOff;
-}
-
-
-sal_Int32 SvNumberFormatter::ImpGetFormatCodeIndex(
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::NumberFormatCode >& rSeq,
- const NfIndexTableOffset nTabOff )
-{
- const sal_Int32 nLen = rSeq.getLength();
- for ( sal_Int32 j=0; j<nLen; j++ )
- {
- if ( rSeq[j].Index == nTabOff )
- return j;
- }
- if (LocaleDataWrapper::areChecksEnabled() && (nTabOff < NF_CURRENCY_START
- || NF_CURRENCY_END < nTabOff || nTabOff == NF_CURRENCY_1000INT
- || nTabOff == NF_CURRENCY_1000INT_RED
- || nTabOff == NF_CURRENCY_1000DEC2_CCC))
- { // currency entries with decimals might not exist, e.g. Italian Lira
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpGetFormatCodeIndex: not found: "));
- aMsg += String::CreateFromInt32( nTabOff );
- LocaleDataWrapper::outputCheckMessage( xLocaleData->appendLocaleInfo(
- aMsg));
- }
- if ( nLen )
- {
- sal_Int32 j;
- // look for a preset default
- for ( j=0; j<nLen; j++ )
- {
- if ( rSeq[j].Default )
- return j;
- }
- // currencies are special, not all format codes must exist, but all
- // builtin number format key index positions must have a format assigned
- if ( NF_CURRENCY_START <= nTabOff && nTabOff <= NF_CURRENCY_END )
- {
- // look for a format with decimals
- for ( j=0; j<nLen; j++ )
- {
- if ( rSeq[j].Index == NF_CURRENCY_1000DEC2 )
- return j;
- }
- // last resort: look for a format without decimals
- for ( j=0; j<nLen; j++ )
- {
- if ( rSeq[j].Index == NF_CURRENCY_1000INT )
- return j;
- }
- }
- }
- else
- { // we need at least _some_ format
- rSeq.realloc(1);
- rSeq[0] = ::com::sun::star::i18n::NumberFormatCode();
- String aTmp( '0' );
- aTmp += GetNumDecimalSep();
- aTmp.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "############" ) );
- rSeq[0].Code = aTmp;
- }
- return 0;
-}
-
-
-sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault(
- ::com::sun::star::i18n::NumberFormatCode * pFormatArr,
- sal_Int32 nCnt, BOOL bCheckCorrectness )
-{
- using namespace ::com::sun::star;
-
- if ( !nCnt )
- return -1;
- if (bCheckCorrectness && LocaleDataWrapper::areChecksEnabled())
- { // check the locale data for correctness
- ByteString aMsg;
- sal_Int32 nElem, nShort, nMedium, nLong, nShortDef, nMediumDef, nLongDef;
- nShort = nMedium = nLong = nShortDef = nMediumDef = nLongDef = -1;
- for ( nElem = 0; nElem < nCnt; nElem++ )
- {
- switch ( pFormatArr[nElem].Type )
- {
- case i18n::KNumberFormatType::SHORT :
- nShort = nElem;
- break;
- case i18n::KNumberFormatType::MEDIUM :
- nMedium = nElem;
- break;
- case i18n::KNumberFormatType::LONG :
- nLong = nElem;
- break;
- default:
- aMsg = "unknown type";
- }
- if ( pFormatArr[nElem].Default )
- {
- switch ( pFormatArr[nElem].Type )
- {
- case i18n::KNumberFormatType::SHORT :
- if ( nShortDef != -1 )
- aMsg = "dupe short type default";
- nShortDef = nElem;
- break;
- case i18n::KNumberFormatType::MEDIUM :
- if ( nMediumDef != -1 )
- aMsg = "dupe medium type default";
- nMediumDef = nElem;
- break;
- case i18n::KNumberFormatType::LONG :
- if ( nLongDef != -1 )
- aMsg = "dupe long type default";
- nLongDef = nElem;
- break;
- }
- }
- if ( aMsg.Len() )
- {
- aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 );
- aMsg += "\nXML locale data FormatElement formatindex: ";
- aMsg += ByteString::CreateFromInt32( pFormatArr[nElem].Index );
- String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US);
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aUMsg));
- aMsg.Erase();
- }
- }
- if ( nShort != -1 && nShortDef == -1 )
- aMsg += "no short type default ";
- if ( nMedium != -1 && nMediumDef == -1 )
- aMsg += "no medium type default ";
- if ( nLong != -1 && nLongDef == -1 )
- aMsg += "no long type default ";
- if ( aMsg.Len() )
- {
- aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 );
- aMsg += "\nXML locale data FormatElement group of: ";
- String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US);
- aUMsg += String( pFormatArr[0].NameID );
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aUMsg));
- aMsg.Erase();
- }
- }
- // find the default (medium preferred, then long) and reset all other defaults
- sal_Int32 nElem, nDef, nMedium;
- nDef = nMedium = -1;
- for ( nElem = 0; nElem < nCnt; nElem++ )
- {
- if ( pFormatArr[nElem].Default )
- {
- switch ( pFormatArr[nElem].Type )
- {
- case i18n::KNumberFormatType::MEDIUM :
- nDef = nMedium = nElem;
- break;
- case i18n::KNumberFormatType::LONG :
- if ( nMedium == -1 )
- nDef = nElem;
- // fallthru
- default:
- if ( nDef == -1 )
- nDef = nElem;
- pFormatArr[nElem].Default = sal_False;
- }
- }
- }
- if ( nDef == -1 )
- nDef = 0;
- pFormatArr[nDef].Default = sal_True;
- return nDef;
-}
-
-
-void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, BOOL bLoadingSO5 )
-{
- using namespace ::com::sun::star;
-
- if ( !bIndexTableInitialized )
- {
- for ( USHORT j=0; j<NF_INDEX_TABLE_ENTRIES; j++ )
- {
- theIndexTable[j] = NUMBERFORMAT_ENTRY_NOT_FOUND;
- }
- }
- BOOL bOldConvertMode = pFormatScanner->GetConvertMode();
- if (bOldConvertMode)
- pFormatScanner->SetConvertMode(FALSE); // switch off for this function
-
- NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() );
-
- xub_StrLen nCheckPos = 0;
- SvNumberformat* pNewFormat = NULL;
- String aFormatCode;
- sal_Int32 nIdx;
- sal_Bool bDefault;
-
- // Counter for additional builtin formats not fitting into the first 10
- // of a category (TLOT:=The Legacy Of Templin), altogether about 20 formats.
- // Has to be incremented on each ImpInsertNewStandardformat, new formats
- // must be appended, not inserted!
- USHORT nNewExtended = ZF_STANDARD_NEWEXTENDED;
-
- // Number
- uno::Sequence< i18n::NumberFormatCode > aFormatSeq
- = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::FIXED_NUMBER );
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
-
- // General
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_STANDARD );
- SvNumberformat* pStdFormat = ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_NUMBER_STANDARD, ZF_STANDARD ));
- if (pStdFormat)
- {
- // This is _the_ standard format.
- if (LocaleDataWrapper::areChecksEnabled() &&
- pStdFormat->GetType() != NUMBERFORMAT_NUMBER)
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpGenerateFormats: General format not NUMBER"));
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- pStdFormat->SetType( NUMBERFORMAT_NUMBER );
- pStdFormat->SetStandard();
- pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE );
- }
- else
- {
- if (LocaleDataWrapper::areChecksEnabled())
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "SvNumberFormatter::ImpGenerateFormats: General format not insertable, nothing will work"));
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- }
-
- // Boolean
- aFormatCode = pFormatScanner->GetBooleanString();
- pNewFormat = new SvNumberformat( aFormatCode,
- pFormatScanner, pStringScanner, nCheckPos, ActLnge );
- pNewFormat->SetType(NUMBERFORMAT_LOGICAL);
- pNewFormat->SetStandard();
- if ( !aFTable.Insert(
- CLOffset + SetIndexTable( NF_BOOLEAN, ZF_STANDARD_LOGICAL ),
- pNewFormat))
- delete pNewFormat;
-
- // Text
- aFormatCode = '@';
- pNewFormat = new SvNumberformat( aFormatCode,
- pFormatScanner, pStringScanner, nCheckPos, ActLnge );
- pNewFormat->SetType(NUMBERFORMAT_TEXT);
- pNewFormat->SetStandard();
- if ( !aFTable.Insert(
- CLOffset + SetIndexTable( NF_TEXT, ZF_STANDARD_TEXT ),
- pNewFormat))
- delete pNewFormat;
-
-
-
- // 0
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_INT );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_NUMBER_INT, ZF_STANDARD+1 ));
-
- // 0.00
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_DEC2 );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_NUMBER_DEC2, ZF_STANDARD+2 ));
-
- // #,##0
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000INT );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_NUMBER_1000INT, ZF_STANDARD+3 ));
-
- // #,##0.00
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_1000DEC2 );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_NUMBER_1000DEC2, ZF_STANDARD+4 ));
-
- // #.##0,00 System country/language dependent since number formatter version 6
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_NUMBER_SYSTEM );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_NUMBER_SYSTEM, ZF_STANDARD+5 ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
-
- // Percent number
- aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::PERCENT_NUMBER );
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
-
- // 0%
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_INT );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_PERCENT_INT, ZF_STANDARD_PERCENT ));
-
- // 0.00%
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_PERCENT_DEC2 );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_PERCENT_DEC2, ZF_STANDARD_PERCENT+1 ));
-
-
-
- // Currency. NO default standard option! Default is determined of locale
- // data default currency and format is generated if needed.
- aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY );
- if (LocaleDataWrapper::areChecksEnabled())
- {
- // though no default desired here, test for correctness of locale data
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
- }
-
- // #,##0
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = sal_False;
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_CURRENCY_1000INT, ZF_STANDARD_CURRENCY ));
- aFormatSeq[nIdx].Default = bDefault;
-
- // #,##0.00
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2 );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = sal_False;
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2, ZF_STANDARD_CURRENCY+1 ));
- aFormatSeq[nIdx].Default = bDefault;
-
- // #,##0 negative red
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000INT_RED );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = sal_False;
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_CURRENCY_1000INT_RED, ZF_STANDARD_CURRENCY+2 ));
- aFormatSeq[nIdx].Default = bDefault;
-
- // #,##0.00 negative red
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_RED );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = sal_False;
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_RED, ZF_STANDARD_CURRENCY+3 ));
- aFormatSeq[nIdx].Default = bDefault;
-
- // #,##0.00 USD since number formatter version 3
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_CCC );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = sal_False;
- pNewFormat = ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_CCC, ZF_STANDARD_CURRENCY+4 ));
- if ( pNewFormat )
- pNewFormat->SetUsed(TRUE); // must be saved for older versions
- aFormatSeq[nIdx].Default = bDefault;
-
- // #.##0,-- since number formatter version 6
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_CURRENCY_1000DEC2_DASHED );
- bDefault = aFormatSeq[nIdx].Default;
- aFormatSeq[nIdx].Default = sal_False;
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_CURRENCY_1000DEC2_DASHED, ZF_STANDARD_CURRENCY+5 ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
- aFormatSeq[nIdx].Default = bDefault;
-
-
-
- // Date
- aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE );
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
-
- // DD.MM.YY System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_SHORT );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYSTEM_SHORT, ZF_STANDARD_DATE ));
-
- // NN DD.MMM YY
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DEF_NNDDMMMYY );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_DEF_NNDDMMMYY, ZF_STANDARD_DATE+1 ));
-
- // DD.MM.YY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_MMYY );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_MMYY, ZF_STANDARD_DATE+2 ));
-
- // DD MMM
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMM );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_DDMMM, ZF_STANDARD_DATE+3 ));
-
- // MMMM
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_MMMM );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_MMMM, ZF_STANDARD_DATE+4 ));
-
- // QQ YY
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_QQJJ );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_QQJJ, ZF_STANDARD_DATE+5 ));
-
- // DD.MM.YYYY since number formatter version 2, was DD.MM.[YY]YY
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYYYY );
- pNewFormat = ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYYYY, ZF_STANDARD_DATE+6 ));
- if ( pNewFormat )
- pNewFormat->SetUsed(TRUE); // must be saved for older versions
-
- // DD.MM.YY def/System, since number formatter version 6
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DDMMYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_DDMMYY, ZF_STANDARD_DATE+7 ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // NNN, D. MMMM YYYY System
- // Long day of week: "NNNN" instead of "NNN," because of compatibility
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYSTEM_LONG );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYSTEM_LONG, ZF_STANDARD_DATE+8 ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // Hard coded but system (regional settings) delimiters dependent long date formats
- // since numberformatter version 6
-
- // D. MMM YY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYY, ZF_STANDARD_DATE+9 ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- //! Unfortunally TLOT intended only 10 builtin formats per category, more
- //! would overwrite the next category (ZF_STANDARD_TIME) :-((
- //! Therefore they are inserted with nNewExtended++ (which is also limited)
-
- // D. MMM YYYY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMYYYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_DMMMYYYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // D. MMMM YYYY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_DMMMMYYYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_DMMMMYYYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // NN, D. MMM YY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // NN, D. MMMM YYYY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNDMMMMYYYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_NNDMMMMYYYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // NNN, D. MMMM YYYY def/System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_SYS_NNNNDMMMMYYYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_SYS_NNNNDMMMMYYYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // Hard coded DIN (Deutsche Industrie Norm) and EN (European Norm) date formats
-
- // D. MMM. YYYY DIN/EN
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMYYYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_DIN_DMMMYYYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // D. MMMM YYYY DIN/EN
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_DMMMMYYYY );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_DIN_DMMMMYYYY, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // MM-DD DIN/EN
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_MMDD );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_DIN_MMDD, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // YY-MM-DD DIN/EN
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYMMDD );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_DIN_YYMMDD, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
- // YYYY-MM-DD DIN/EN
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATE_DIN_YYYYMMDD );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATE_DIN_YYYYMMDD, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NEWSTANDARD );
-
-
-
- // Time
- aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::TIME );
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
-
- // HH:MM
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMM );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_HHMM, ZF_STANDARD_TIME ));
-
- // HH:MM:SS
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSS );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_HHMMSS, ZF_STANDARD_TIME+1 ));
-
- // HH:MM AM/PM
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMAMPM );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_HHMMAMPM, ZF_STANDARD_TIME+2 ));
-
- // HH:MM:SS AM/PM
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HHMMSSAMPM );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_HHMMSSAMPM, ZF_STANDARD_TIME+3 ));
-
- // [HH]:MM:SS
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_HH_MMSS, ZF_STANDARD_TIME+4 ));
-
- // MM:SS,00
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_MMSS00 );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_MMSS00, ZF_STANDARD_TIME+5 ));
-
- // [HH]:MM:SS,00
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_TIME_HH_MMSS00 );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_TIME_HH_MMSS00, ZF_STANDARD_TIME+6 ),
- SV_NUMBERFORMATTER_VERSION_NF_TIME_HH_MMSS00 );
-
-
-
- // DateTime
- aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::DATE_TIME );
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
-
- // DD.MM.YY HH:MM System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYSTEM_SHORT_HHMM );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATETIME_SYSTEM_SHORT_HHMM, ZF_STANDARD_DATETIME ));
-
- // DD.MM.YYYY HH:MM:SS System
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_DATETIME_SYS_DDMMYYYY_HHMMSS );
- ImpInsertNewStandardFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_DATETIME_SYS_DDMMYYYY_HHMMSS, ZF_STANDARD_DATETIME+1 ),
- SV_NUMBERFORMATTER_VERSION_NF_DATETIME_SYS_DDMMYYYY_HHMMSS );
-
-
-
- // Scientific number
- aFormatSeq = aNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::SCIENTIFIC_NUMBER );
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), aFormatSeq.getLength() );
-
- // 0.00E+000
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E000 );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_SCIENTIFIC_000E000, ZF_STANDARD_SCIENTIFIC ));
-
- // 0.00E+00
- nIdx = ImpGetFormatCodeIndex( aFormatSeq, NF_SCIENTIFIC_000E00 );
- ImpInsertFormat( aFormatSeq[nIdx],
- CLOffset + SetIndexTable( NF_SCIENTIFIC_000E00, ZF_STANDARD_SCIENTIFIC+1 ));
-
-
-
- // Fraction number (no default option)
- i18n::NumberFormatCode aSingleFormatCode;
-
- // # ?/?
- aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) );
- String s25( RTL_CONSTASCII_USTRINGPARAM( "# ?/?" ) ); // # ?/?
- ImpInsertFormat( aSingleFormatCode,
- CLOffset + SetIndexTable( NF_FRACTION_1, ZF_STANDARD_FRACTION ));
-
- // # ??/??
- //! "??/" would be interpreted by the compiler as a trigraph for '\'
- aSingleFormatCode.Code = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "# ?\?/?\?" ) );
- ImpInsertFormat( aSingleFormatCode,
- CLOffset + SetIndexTable( NF_FRACTION_2, ZF_STANDARD_FRACTION+1 ));
-
- // Week of year must be appended here because of nNewExtended
- const String* pKeyword = pFormatScanner->GetKeywords();
- aSingleFormatCode.Code = pKeyword[NF_KEY_WW];
- ImpInsertNewStandardFormat( aSingleFormatCode,
- CLOffset + SetIndexTable( NF_DATE_WW, nNewExtended++ ),
- SV_NUMBERFORMATTER_VERSION_NF_DATE_WW );
-
-
-
- bIndexTableInitialized = TRUE;
- DBG_ASSERT( nNewExtended <= ZF_STANDARD_NEWEXTENDEDMAX,
- "ImpGenerateFormats: overflow of nNewExtended standard formats" );
-
- // Now all additional format codes provided by I18N, but only if not
- // loading from old SO5 file format, then they are appended last.
- if ( !bLoadingSO5 )
- ImpGenerateAdditionalFormats( CLOffset, aNumberFormatCode, FALSE );
-
- if (bOldConvertMode)
- pFormatScanner->SetConvertMode(TRUE);
-}
-
-
-void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
- NumberFormatCodeWrapper& rNumberFormatCode, BOOL bAfterLoadingSO5 )
-{
- using namespace ::com::sun::star;
-
- SvNumberformat* pStdFormat =
- (SvNumberformat*) aFTable.Get( CLOffset + ZF_STANDARD );
- if ( !pStdFormat )
- {
- DBG_ERRORFILE( "ImpGenerateAdditionalFormats: no GENERAL format" );
- return ;
- }
- sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey();
- rNumberFormatCode.setLocale( GetLocale() );
- sal_Int32 j;
-
- // All currencies, this time with [$...] which was stripped in
- // ImpGenerateFormats for old "automatic" currency formats.
- uno::Sequence< i18n::NumberFormatCode > aFormatSeq =
- rNumberFormatCode.getAllFormatCode( i18n::KNumberFormatUsage::CURRENCY );
- i18n::NumberFormatCode * pFormatArr = aFormatSeq.getArray();
- sal_Int32 nCodes = aFormatSeq.getLength();
- ImpAdjustFormatCodeDefault( aFormatSeq.getArray(), nCodes );
- for ( j = 0; j < nCodes; j++ )
- {
- if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET )
- {
- DBG_ERRORFILE( "ImpGenerateAdditionalFormats: too many formats" );
- break; // for
- }
- if ( pFormatArr[j].Index < NF_INDEX_TABLE_ENTRIES &&
- pFormatArr[j].Index != NF_CURRENCY_1000DEC2_CCC )
- { // Insert only if not already inserted, but internal index must be
- // above so ImpInsertFormat can distinguish it.
- sal_Int16 nOrgIndex = pFormatArr[j].Index;
- pFormatArr[j].Index = sal::static_int_cast< sal_Int16 >(
- pFormatArr[j].Index + nCodes + NF_INDEX_TABLE_ENTRIES);
- //! no default on currency
- sal_Bool bDefault = aFormatSeq[j].Default;
- aFormatSeq[j].Default = sal_False;
- if ( ImpInsertNewStandardFormat( pFormatArr[j], nPos+1,
- SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS,
- bAfterLoadingSO5, nOrgIndex ) )
- nPos++;
- pFormatArr[j].Index = nOrgIndex;
- aFormatSeq[j].Default = bDefault;
- }
- }
-
- // all additional format codes provided by I18N that are not old standard index
- aFormatSeq = rNumberFormatCode.getAllFormatCodes();
- nCodes = aFormatSeq.getLength();
- if ( nCodes )
- {
- pFormatArr = aFormatSeq.getArray();
- // don't check ALL
- sal_Int32 nDef = ImpAdjustFormatCodeDefault( pFormatArr, nCodes, FALSE);
- // don't have any defaults here
- pFormatArr[nDef].Default = sal_False;
- for ( j = 0; j < nCodes; j++ )
- {
- if ( nPos - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET )
- {
- DBG_ERRORFILE( "ImpGenerateAdditionalFormats: too many formats" );
- break; // for
- }
- if ( pFormatArr[j].Index >= NF_INDEX_TABLE_ENTRIES )
- if ( ImpInsertNewStandardFormat( pFormatArr[j], nPos+1,
- SV_NUMBERFORMATTER_VERSION_ADDITIONAL_I18N_FORMATS,
- bAfterLoadingSO5 ) )
- nPos++;
- }
- }
-
- pStdFormat->SetLastInsertKey( (USHORT)(nPos - CLOffset) );
-}
-
-
-void SvNumberFormatter::ImpGetPosCurrFormat( String& sPosStr, const String& rCurrSymbol )
-{
- NfCurrencyEntry::CompletePositiveFormatString( sPosStr,
- rCurrSymbol, xLocaleData->getCurrPositiveFormat() );
-}
-
-void SvNumberFormatter::ImpGetNegCurrFormat( String& sNegStr, const String& rCurrSymbol )
-{
- NfCurrencyEntry::CompleteNegativeFormatString( sNegStr,
- rCurrSymbol, xLocaleData->getCurrNegativeFormat() );
-}
-
-void SvNumberFormatter::GenerateFormat(String& sString,
- sal_uInt32 nIndex,
- LanguageType eLnge,
- BOOL bThousand,
- BOOL IsRed,
- USHORT nPrecision,
- USHORT nAnzLeading)
-{
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- short eType = GetType(nIndex);
- USHORT i;
- ImpGenerateCL(eLnge); // ggfs. neu Standard-
- // formate anlegen
- sString.Erase();
-
- utl::DigitGroupingIterator aGrouping( xLocaleData->getDigitGrouping());
- const xub_StrLen nDigitsInFirstGroup = static_cast<xub_StrLen>(aGrouping.get());
- const String& rThSep = GetNumThousandSep();
- if (nAnzLeading == 0)
- {
- if (!bThousand)
- sString += '#';
- else
- {
- sString += '#';
- sString += rThSep;
- sString.Expand( sString.Len() + nDigitsInFirstGroup, '#' );
- }
- }
- else
- {
- for (i = 0; i < nAnzLeading; i++)
- {
- if (bThousand && i > 0 && i == aGrouping.getPos())
- {
- sString.Insert( rThSep, 0 );
- aGrouping.advance();
- }
- sString.Insert('0',0);
- }
- if (bThousand && nAnzLeading < nDigitsInFirstGroup + 1)
- {
- for (i = nAnzLeading; i < nDigitsInFirstGroup + 1; i++)
- {
- if (bThousand && i % nDigitsInFirstGroup == 0)
- sString.Insert( rThSep, 0 );
- sString.Insert('#',0);
- }
- }
- }
- if (nPrecision > 0)
- {
- sString += GetNumDecimalSep();
- sString.Expand( sString.Len() + nPrecision, '0' );
- }
- if (eType == NUMBERFORMAT_PERCENT)
- sString += '%';
- else if (eType == NUMBERFORMAT_CURRENCY)
- {
- String sNegStr = sString;
- String aCurr;
- const NfCurrencyEntry* pEntry;
- BOOL bBank;
- if ( GetNewCurrencySymbolString( nIndex, aCurr, &pEntry, &bBank ) )
- {
- if ( pEntry )
- {
- USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
- xLocaleData->getCurrPositiveFormat(),
- pEntry->GetPositiveFormat(), bBank );
- USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
- xLocaleData->getCurrNegativeFormat(),
- pEntry->GetNegativeFormat(), bBank );
- pEntry->CompletePositiveFormatString( sString, bBank,
- nPosiForm );
- pEntry->CompleteNegativeFormatString( sNegStr, bBank,
- nNegaForm );
- }
- else
- { // assume currency abbreviation (AKA banking symbol), not symbol
- USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
- xLocaleData->getCurrPositiveFormat(),
- xLocaleData->getCurrPositiveFormat(), TRUE );
- USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
- xLocaleData->getCurrNegativeFormat(),
- xLocaleData->getCurrNegativeFormat(), TRUE );
- NfCurrencyEntry::CompletePositiveFormatString( sString, aCurr,
- nPosiForm );
- NfCurrencyEntry::CompleteNegativeFormatString( sNegStr, aCurr,
- nNegaForm );
- }
- }
- else
- { // "automatic" old style
- String aSymbol, aAbbrev;
- GetCompatibilityCurrency( aSymbol, aAbbrev );
- ImpGetPosCurrFormat( sString, aSymbol );
- ImpGetNegCurrFormat( sNegStr, aSymbol );
- }
- if (IsRed)
- {
- sString += ';';
- sString += '[';
- sString += pFormatScanner->GetRedString();
- sString += ']';
- }
- else
- sString += ';';
- sString += sNegStr;
- }
- if (IsRed && eType != NUMBERFORMAT_CURRENCY)
- {
- String sTmpStr = sString;
- sTmpStr += ';';
- sTmpStr += '[';
- sTmpStr += pFormatScanner->GetRedString();
- sTmpStr += ']';
- sTmpStr += '-';
- sTmpStr +=sString;
- sString = sTmpStr;
- }
-}
-
-BOOL SvNumberFormatter::IsUserDefined(const String& sStr,
- LanguageType eLnge)
-{
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard-
- // formate anlegen
- eLnge = ActLnge;
- sal_uInt32 nKey = ImpIsEntry(sStr, CLOffset, eLnge);
- if (nKey == NUMBERFORMAT_ENTRY_NOT_FOUND)
- return TRUE;
- SvNumberformat* pEntry = aFTable.Get(nKey);
- if ( pEntry && ((pEntry->GetType() & NUMBERFORMAT_DEFINED) != 0) )
- return TRUE;
- return FALSE;
-}
-
-sal_uInt32 SvNumberFormatter::GetEntryKey(const String& sStr,
- LanguageType eLnge)
-{
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // ggfs. neu Standard-
- // formate anlegen
- return ImpIsEntry(sStr, CLOffset, eLnge);
-}
-
-sal_uInt32 SvNumberFormatter::GetStandardIndex(LanguageType eLnge)
-{
- if (eLnge == LANGUAGE_DONTKNOW)
- eLnge = IniLnge;
- return GetStandardFormat(NUMBERFORMAT_NUMBER, eLnge);
-}
-
-short SvNumberFormatter::GetType(sal_uInt32 nFIndex)
-{
- short eType;
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex);
- if (!pFormat)
- eType = NUMBERFORMAT_UNDEFINED;
- else
- {
- eType = pFormat->GetType() &~NUMBERFORMAT_DEFINED;
- if (eType == 0)
- eType = NUMBERFORMAT_DEFINED;
- }
- return eType;
-}
-
-void SvNumberFormatter::ClearMergeTable()
-{
- if ( pMergeTable )
- {
- sal_uInt32* pIndex = (sal_uInt32*) pMergeTable->First();
- while (pIndex)
- {
- delete pIndex;
- pIndex = pMergeTable->Next();
- }
- pMergeTable->Clear();
- }
-}
-
-SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter& rTable)
-{
- if ( pMergeTable )
- ClearMergeTable();
- else
- pMergeTable = new SvNumberFormatterIndexTable;
- sal_uInt32 nCLOffset = 0;
- sal_uInt32 nOldKey, nOffset, nNewKey;
- sal_uInt32* pNewIndex;
- SvNumberformat* pNewEntry;
- SvNumberformat* pFormat = rTable.aFTable.First();
- while (pFormat)
- {
- nOldKey = rTable.aFTable.GetCurKey();
- nOffset = nOldKey % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
- if (nOffset == 0) // 1. Format von CL
- nCLOffset = ImpGenerateCL(pFormat->GetLanguage());
-
- if (nOffset <= SV_MAX_ANZ_STANDARD_FORMATE) // Std.form.
- {
- nNewKey = nCLOffset + nOffset;
- if (!aFTable.Get(nNewKey)) // noch nicht da
- {
-// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!!
- pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner );
- if (!aFTable.Insert(nNewKey, pNewEntry))
- delete pNewEntry;
- }
- if (nNewKey != nOldKey) // neuer Index
- {
- pNewIndex = new sal_uInt32(nNewKey);
- if (!pMergeTable->Insert(nOldKey,pNewIndex))
- delete pNewIndex;
- }
- }
- else // benutzerdef.
- {
-// pNewEntry = new SvNumberformat(*pFormat); // Copy reicht nicht !!!
- pNewEntry = new SvNumberformat( *pFormat, *pFormatScanner );
- nNewKey = ImpIsEntry(pNewEntry->GetFormatstring(),
- nCLOffset,
- pFormat->GetLanguage());
- if (nNewKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // schon vorhanden
- delete pNewEntry;
- else
- {
- SvNumberformat* pStdFormat =
- (SvNumberformat*) aFTable.Get(nCLOffset + ZF_STANDARD);
- sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey();
- nNewKey = nPos+1;
- if (nPos - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
- {
- Sound::Beep();
- DBG_ERROR(
- "SvNumberFormatter:: Zu viele Formate pro CL");
- delete pNewEntry;
- }
- else if (!aFTable.Insert(nNewKey, pNewEntry))
- delete pNewEntry;
- else
- pStdFormat->SetLastInsertKey((USHORT) (nNewKey - nCLOffset));
- }
- if (nNewKey != nOldKey) // neuer Index
- {
- pNewIndex = new sal_uInt32(nNewKey);
- if (!pMergeTable->Insert(nOldKey,pNewIndex))
- delete pNewIndex;
- }
- }
- pFormat = rTable.aFTable.Next();
- }
- return pMergeTable;
-}
-
-
-SvNumberFormatterMergeMap SvNumberFormatter::ConvertMergeTableToMap()
-{
- if (!HasMergeFmtTbl())
- return SvNumberFormatterMergeMap();
-
- SvNumberFormatterMergeMap aMap;
- for (sal_uInt32* pIndex = pMergeTable->First(); pIndex; pIndex = pMergeTable->Next())
- {
- sal_uInt32 nOldKey = pMergeTable->GetCurKey();
- aMap.insert( SvNumberFormatterMergeMap::value_type( nOldKey, *pIndex));
- }
- ClearMergeTable();
- return aMap;
-}
-
-
-sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 nFormat,
- LanguageType eLnge )
-{
- if ( eLnge == LANGUAGE_DONTKNOW )
- eLnge = IniLnge;
- if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLnge == IniLnge )
- return nFormat; // es bleibt wie es ist
- sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
- if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE )
- return nFormat; // kein eingebautes Format
- sal_uInt32 nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren
- return nCLOffset + nOffset;
-}
-
-
-sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff,
- LanguageType eLnge )
-{
- if ( nTabOff >= NF_INDEX_TABLE_ENTRIES
- || theIndexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND )
- return NUMBERFORMAT_ENTRY_NOT_FOUND;
- if ( eLnge == LANGUAGE_DONTKNOW )
- eLnge = IniLnge;
- sal_uInt32 nCLOffset = ImpGenerateCL(eLnge); // ggbf. generieren
- return nCLOffset + theIndexTable[nTabOff];
-}
-
-
-NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat ) const
-{
- sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relativIndex
- if ( nOffset > SV_MAX_ANZ_STANDARD_FORMATE )
- return NF_INDEX_TABLE_ENTRIES; // kein eingebautes Format
- for ( USHORT j = 0; j < NF_INDEX_TABLE_ENTRIES; j++ )
- {
- if ( theIndexTable[j] == nOffset )
- return (NfIndexTableOffset) j;
- }
- return NF_INDEX_TABLE_ENTRIES; // bad luck
-}
-
-
-void SvNumberFormatter::SetYear2000( USHORT nVal )
-{
- pStringScanner->SetYear2000( nVal );
-}
-
-
-USHORT SvNumberFormatter::GetYear2000() const
-{
- return pStringScanner->GetYear2000();
-}
-
-
-USHORT SvNumberFormatter::ExpandTwoDigitYear( USHORT nYear ) const
-{
- if ( nYear < 100 )
- return SvNumberFormatter::ExpandTwoDigitYear( nYear,
- pStringScanner->GetYear2000() );
- return nYear;
-}
-
-
-// static
-USHORT SvNumberFormatter::GetYear2000Default()
-{
- return Application::GetSettings().GetMiscSettings().GetTwoDigitYearStart();
-}
-
-
-// static
-const NfCurrencyTable& SvNumberFormatter::GetTheCurrencyTable()
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- while ( !bCurrencyTableInitialized )
- ImpInitCurrencyTable();
- return theCurrencyTable::get();
-}
-
-
-// static
-const NfCurrencyEntry* SvNumberFormatter::MatchSystemCurrency()
-{
- // MUST call GetTheCurrencyTable() before accessing nSystemCurrencyPosition
- const NfCurrencyTable& rTable = GetTheCurrencyTable();
- return nSystemCurrencyPosition ? rTable[nSystemCurrencyPosition] : NULL;
-}
-
-
-// static
-const NfCurrencyEntry& SvNumberFormatter::GetCurrencyEntry( LanguageType eLang )
-{
- if ( eLang == LANGUAGE_SYSTEM )
- {
- const NfCurrencyEntry* pCurr = MatchSystemCurrency();
- return pCurr ? *pCurr : *(GetTheCurrencyTable()[0]);
- }
- else
- {
- eLang = MsLangId::getRealLanguage( eLang );
- const NfCurrencyTable& rTable = GetTheCurrencyTable();
- USHORT nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( USHORT j = 0; j < nCount; j++, ppData++ )
- {
- if ( (*ppData)->GetLanguage() == eLang )
- return **ppData;
- }
- return *(rTable[0]);
- }
-}
-
-
-// static
-const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry(
- const String& rAbbrev, LanguageType eLang )
-{
- eLang = MsLangId::getRealLanguage( eLang );
- const NfCurrencyTable& rTable = GetTheCurrencyTable();
- USHORT nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( USHORT j = 0; j < nCount; j++, ppData++ )
- {
- if ( (*ppData)->GetLanguage() == eLang &&
- (*ppData)->GetBankSymbol() == rAbbrev )
- return *ppData;
- }
- return NULL;
-}
-
-
-// static
-const NfCurrencyEntry* SvNumberFormatter::GetLegacyOnlyCurrencyEntry(
- const String& rSymbol, const String& rAbbrev )
-{
- if (!bCurrencyTableInitialized)
- GetTheCurrencyTable(); // just for initialization
- const NfCurrencyTable& rTable = theLegacyOnlyCurrencyTable::get();
- USHORT nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( USHORT j = 0; j < nCount; j++, ppData++ )
- {
- if ( (*ppData)->GetSymbol() == rSymbol &&
- (*ppData)->GetBankSymbol() == rAbbrev )
- return *ppData;
- }
- return NULL;
-}
-
-
-// static
-IMPL_STATIC_LINK_NOINSTANCE( SvNumberFormatter, CurrencyChangeLink, void*, EMPTYARG )
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- String aAbbrev;
- LanguageType eLang = LANGUAGE_SYSTEM;
- SvtSysLocaleOptions().GetCurrencyAbbrevAndLanguage( aAbbrev, eLang );
- SetDefaultSystemCurrency( aAbbrev, eLang );
- return 0;
-}
-
-
-// static
-void SvNumberFormatter::SetDefaultSystemCurrency( const String& rAbbrev, LanguageType eLang )
-{
- ::osl::MutexGuard aGuard( GetMutex() );
- if ( eLang == LANGUAGE_SYSTEM )
- eLang = Application::GetSettings().GetLanguage();
- const NfCurrencyTable& rTable = GetTheCurrencyTable();
- USHORT nCount = rTable.Count();
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- if ( rAbbrev.Len() )
- {
- for ( USHORT j = 0; j < nCount; j++, ppData++ )
- {
- if ( (*ppData)->GetLanguage() == eLang && (*ppData)->GetBankSymbol() == rAbbrev )
- {
- nSystemCurrencyPosition = j;
- return ;
- }
- }
- }
- else
- {
- for ( USHORT j = 0; j < nCount; j++, ppData++ )
- {
- if ( (*ppData)->GetLanguage() == eLang )
- {
- nSystemCurrencyPosition = j;
- return ;
- }
- }
- }
- nSystemCurrencyPosition = 0; // not found => simple SYSTEM
-}
-
-
-void SvNumberFormatter::ResetDefaultSystemCurrency()
-{
- nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
-}
-
-
-sal_uInt32 SvNumberFormatter::ImpGetDefaultSystemCurrencyFormat()
-{
- if ( nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
- {
- xub_StrLen nCheck;
- short nType;
- NfWSStringsDtor aCurrList;
- USHORT nDefault = GetCurrencyFormatStrings( aCurrList,
- GetCurrencyEntry( LANGUAGE_SYSTEM ), FALSE );
- DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency System standard format?!?" );
- // if already loaded or user defined nDefaultSystemCurrencyFormat
- // will be set to the right value
- PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType,
- nDefaultSystemCurrencyFormat, LANGUAGE_SYSTEM );
- DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
- DBG_ASSERT( nDefaultSystemCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
- "nDefaultSystemCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" );
- }
- return nDefaultSystemCurrencyFormat;
-}
-
-
-sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
-{
- sal_uInt32 CLOffset = ImpGetCLOffset( ActLnge );
- sal_uInt32 nDefaultCurrencyFormat =
- (sal_uInt32)(sal_uIntPtr) aDefaultFormatKeys.Get( CLOffset + ZF_STANDARD_CURRENCY );
- if ( !nDefaultCurrencyFormat )
- nDefaultCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND;
- if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
- {
- // look for a defined standard
- sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
- sal_uInt32 nKey;
- aFTable.Seek( CLOffset );
- while ( (nKey = aFTable.GetCurKey()) >= CLOffset && nKey < nStopKey )
- {
- const SvNumberformat* pEntry =
- (const SvNumberformat*) aFTable.GetCurObject();
- if ( pEntry->IsStandard() && (pEntry->GetType() & NUMBERFORMAT_CURRENCY) )
- {
- nDefaultCurrencyFormat = nKey;
- break; // while
- }
- aFTable.Next();
- }
-
- if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
- { // none found, create one
- xub_StrLen nCheck;
- short nType;
- NfWSStringsDtor aCurrList;
- USHORT nDefault = GetCurrencyFormatStrings( aCurrList,
- GetCurrencyEntry( ActLnge ), FALSE );
- DBG_ASSERT( aCurrList.Count(), "where is the NewCurrency standard format?" );
- if ( aCurrList.Count() )
- {
- // if already loaded or user defined nDefaultSystemCurrencyFormat
- // will be set to the right value
- PutEntry( *aCurrList.GetObject( nDefault ), nCheck, nType,
- nDefaultCurrencyFormat, ActLnge );
- DBG_ASSERT( nCheck == 0, "NewCurrency CheckError" );
- DBG_ASSERT( nDefaultCurrencyFormat != NUMBERFORMAT_ENTRY_NOT_FOUND,
- "nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND" );
- }
- // old automatic currency format as a last resort
- if ( nDefaultCurrencyFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
- nDefaultCurrencyFormat = CLOffset + ZF_STANDARD_CURRENCY+3;
- else
- { // mark as standard so that it is found next time
- SvNumberformat* pEntry = aFTable.Get( nDefaultCurrencyFormat );
- if ( pEntry )
- pEntry->SetStandard();
- }
- }
- aDefaultFormatKeys.Insert( CLOffset + ZF_STANDARD_CURRENCY,
- (void*) nDefaultCurrencyFormat );
- }
- return nDefaultCurrencyFormat;
-}
-
-
-// static
-// try to make it inline if possible since this a loop body
-// TRUE: continue; FALSE: break loop, if pFoundEntry==NULL dupe found
-#ifdef PRODUCT
-inline
-#endif
- BOOL SvNumberFormatter::ImpLookupCurrencyEntryLoopBody(
- const NfCurrencyEntry*& pFoundEntry, BOOL& bFoundBank,
- const NfCurrencyEntry* pData, USHORT nPos, const String& rSymbol )
-{
- BOOL bFound;
- if ( pData->GetSymbol() == rSymbol )
- {
- bFound = TRUE;
- bFoundBank = FALSE;
- }
- else if ( pData->GetBankSymbol() == rSymbol )
- {
- bFound = TRUE;
- bFoundBank = TRUE;
- }
- else
- bFound = FALSE;
- if ( bFound )
- {
- if ( pFoundEntry && pFoundEntry != pData )
- {
- pFoundEntry = NULL;
- return FALSE; // break loop, not unique
- }
- if ( nPos == 0 )
- { // first entry is SYSTEM
- pFoundEntry = MatchSystemCurrency();
- if ( pFoundEntry )
- return FALSE; // break loop
- // even if there are more matching entries
- // this one is propably the one we are looking for
- else
- pFoundEntry = pData;
- }
- else
- pFoundEntry = pData;
- }
- return TRUE;
-}
-
-
-BOOL SvNumberFormatter::GetNewCurrencySymbolString( sal_uInt32 nFormat,
- String& rStr, const NfCurrencyEntry** ppEntry /* = NULL */,
- BOOL* pBank /* = NULL */ ) const
-{
- rStr.Erase();
- if ( ppEntry )
- *ppEntry = NULL;
- if ( pBank )
- *pBank = FALSE;
- SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get( nFormat );
- if ( pFormat )
- {
- String aSymbol, aExtension;
- if ( pFormat->GetNewCurrencySymbol( aSymbol, aExtension ) )
- {
- if ( ppEntry )
- {
- BOOL bFoundBank = FALSE;
- // we definiteley need an entry matching the format code string
- const NfCurrencyEntry* pFoundEntry = GetCurrencyEntry(
- bFoundBank, aSymbol, aExtension, pFormat->GetLanguage(),
- TRUE );
- if ( pFoundEntry )
- {
- *ppEntry = pFoundEntry;
- if ( pBank )
- *pBank = bFoundBank;
- pFoundEntry->BuildSymbolString( rStr, bFoundBank );
- }
- }
- if ( !rStr.Len() )
- { // analog zu BuildSymbolString
- rStr = '[';
- rStr += '$';
- if ( aSymbol.Search( '-' ) != STRING_NOTFOUND ||
- aSymbol.Search( ']' ) != STRING_NOTFOUND )
- {
- rStr += '"';
- rStr += aSymbol;
- rStr += '"';
- }
- else
- rStr += aSymbol;
- if ( aExtension.Len() )
- rStr += aExtension;
- rStr += ']';
- }
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-// static
-const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( BOOL & bFoundBank,
- const String& rSymbol, const String& rExtension,
- LanguageType eFormatLanguage, BOOL bOnlyStringLanguage )
-{
- xub_StrLen nExtLen = rExtension.Len();
- LanguageType eExtLang;
- if ( nExtLen )
- {
- sal_Int32 nExtLang = ::rtl::OUString( rExtension ).toInt32( 16 );
- if ( !nExtLang )
- eExtLang = LANGUAGE_DONTKNOW;
- else
- eExtLang = (LanguageType) ((nExtLang < 0) ?
- -nExtLang : nExtLang);
- }
- else
- eExtLang = LANGUAGE_DONTKNOW;
- const NfCurrencyEntry* pFoundEntry = NULL;
- const NfCurrencyTable& rTable = GetTheCurrencyTable();
- USHORT nCount = rTable.Count();
- BOOL bCont = TRUE;
-
- // first try with given extension language/country
- if ( nExtLen )
- {
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ )
- {
- LanguageType eLang = (*ppData)->GetLanguage();
- if ( eLang == eExtLang ||
- ((eExtLang == LANGUAGE_DONTKNOW) &&
- (eLang == LANGUAGE_SYSTEM))
- )
- {
- bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank,
- *ppData, j, rSymbol );
- }
- }
- }
-
- // ok?
- if ( pFoundEntry || !bCont || (bOnlyStringLanguage && nExtLen) )
- return pFoundEntry;
-
- if ( !bOnlyStringLanguage )
- {
- // now try the language/country of the number format
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ )
- {
- LanguageType eLang = (*ppData)->GetLanguage();
- if ( eLang == eFormatLanguage ||
- ((eFormatLanguage == LANGUAGE_DONTKNOW) &&
- (eLang == LANGUAGE_SYSTEM))
- )
- {
- bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank,
- *ppData, j, rSymbol );
- }
- }
-
- // ok?
- if ( pFoundEntry || !bCont )
- return pFoundEntry;
- }
-
- // then try without language/country if no extension specified
- if ( !nExtLen )
- {
- const NfCurrencyEntryPtr* ppData = rTable.GetData();
- for ( USHORT j = 0; j < nCount && bCont; j++, ppData++ )
- {
- bCont = ImpLookupCurrencyEntryLoopBody( pFoundEntry, bFoundBank,
- *ppData, j, rSymbol );
- }
- }
-
- return pFoundEntry;
-}
-
-
-void SvNumberFormatter::GetCompatibilityCurrency( String& rSymbol, String& rAbbrev ) const
-{
- ::com::sun::star::uno::Sequence< ::com::sun::star::i18n::Currency2 >
- xCurrencies = xLocaleData->getAllCurrencies();
- sal_Int32 nCurrencies = xCurrencies.getLength();
- sal_Int32 j;
- for ( j=0; j < nCurrencies; ++j )
- {
- if ( xCurrencies[j].UsedInCompatibleFormatCodes )
- {
- rSymbol = xCurrencies[j].Symbol;
- rAbbrev = xCurrencies[j].BankSymbol;
- break;
- }
- }
- if ( j >= nCurrencies )
- {
- if (LocaleDataWrapper::areChecksEnabled())
- {
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
- "GetCompatibilityCurrency: none?"));
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aMsg));
- }
- rSymbol = xLocaleData->getCurrSymbol();
- rAbbrev = xLocaleData->getCurrBankSymbol();
- }
-}
-
-
-void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr )
-{
- short nPos = -1; // -1:=unknown, 0:=vorne, 1:=hinten
- short nNeg = -1;
- switch ( rCurr.GetPositiveFormat() )
- {
- case 0: // $1
- nPos = 0;
- break;
- case 1: // 1$
- nPos = 1;
- break;
- case 2: // $ 1
- nPos = 0;
- break;
- case 3: // 1 $
- nPos = 1;
- break;
- default:
- LocaleDataWrapper::outputCheckMessage(
- "lcl_CheckCurrencySymbolPosition: unknown PositiveFormat");
- break;
- }
- switch ( rCurr.GetNegativeFormat() )
- {
- case 0: // ($1)
- nNeg = 0;
- break;
- case 1: // -$1
- nNeg = 0;
- break;
- case 2: // $-1
- nNeg = 0;
- break;
- case 3: // $1-
- nNeg = 0;
- break;
- case 4: // (1$)
- nNeg = 1;
- break;
- case 5: // -1$
- nNeg = 1;
- break;
- case 6: // 1-$
- nNeg = 1;
- break;
- case 7: // 1$-
- nNeg = 1;
- break;
- case 8: // -1 $
- nNeg = 1;
- break;
- case 9: // -$ 1
- nNeg = 0;
- break;
- case 10: // 1 $-
- nNeg = 1;
- break;
- case 11: // $ -1
- nNeg = 0;
- break;
- case 12 : // $ 1-
- nNeg = 0;
- break;
- case 13 : // 1- $
- nNeg = 1;
- break;
- case 14 : // ($ 1)
- nNeg = 0;
- break;
- case 15 : // (1 $)
- nNeg = 1;
- break;
- default:
- LocaleDataWrapper::outputCheckMessage(
- "lcl_CheckCurrencySymbolPosition: unknown NegativeFormat");
- break;
- }
- if ( nPos >= 0 && nNeg >= 0 && nPos != nNeg )
- {
- ByteString aStr( "positions of currency symbols differ\nLanguage: " );
- aStr += ByteString::CreateFromInt32( rCurr.GetLanguage() );
- aStr += " <";
- aStr += ByteString( rCurr.GetSymbol(), RTL_TEXTENCODING_UTF8 );
- aStr += "> positive: ";
- aStr += ByteString::CreateFromInt32( rCurr.GetPositiveFormat() );
- aStr += ( nPos ? " (postfix)" : " (prefix)" );
- aStr += ", negative: ";
- aStr += ByteString::CreateFromInt32( rCurr.GetNegativeFormat() );
- aStr += ( nNeg ? " (postfix)" : " (prefix)" );
-#if 0
-// seems that there really are some currencies which differ, e.g. YugoDinar
- DBG_ERRORFILE( aStr.GetBuffer() );
-#endif
- }
-}
-
-
-// static
-void SvNumberFormatter::ImpInitCurrencyTable()
-{
- // racing condition possible:
- // ::osl::MutexGuard aGuard( GetMutex() );
- // while ( !bCurrencyTableInitialized )
- // ImpInitCurrencyTable();
- static BOOL bInitializing = FALSE;
- if ( bCurrencyTableInitialized || bInitializing )
- return ;
- bInitializing = TRUE;
-
- RTL_LOGFILE_CONTEXT_AUTHOR( aTimeLog, "svtools", "er93726", "SvNumberFormatter::ImpInitCurrencyTable" );
-
- LanguageType eSysLang = Application::GetSettings().GetLanguage();
- LocaleDataWrapper* pLocaleData = new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(),
- MsLangId::convertLanguageToLocale( eSysLang ) );
- // get user configured currency
- String aConfiguredCurrencyAbbrev;
- LanguageType eConfiguredCurrencyLanguage = LANGUAGE_SYSTEM;
- SvtSysLocaleOptions().GetCurrencyAbbrevAndLanguage(
- aConfiguredCurrencyAbbrev, eConfiguredCurrencyLanguage );
- USHORT nSecondarySystemCurrencyPosition = 0;
- USHORT nMatchingSystemCurrencyPosition = 0;
- NfCurrencyEntryPtr pEntry;
-
- // first entry is SYSTEM
- pEntry = new NfCurrencyEntry( *pLocaleData, LANGUAGE_SYSTEM );
- theCurrencyTable::get().Insert( pEntry, 0 );
- USHORT nCurrencyPos = 1;
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > xLoc =
- LocaleDataWrapper::getInstalledLocaleNames();
- sal_Int32 nLocaleCount = xLoc.getLength();
- RTL_LOGFILE_CONTEXT_TRACE1( aTimeLog, "number of locales: %ld", nLocaleCount );
- Locale const * const pLocales = xLoc.getConstArray();
- NfCurrencyTable &rCurrencyTable = theCurrencyTable::get();
- NfCurrencyTable &rLegacyOnlyCurrencyTable = theLegacyOnlyCurrencyTable::get();
- USHORT nLegacyOnlyCurrencyPos = 0;
- for ( sal_Int32 nLocale = 0; nLocale < nLocaleCount; nLocale++ )
- {
- LanguageType eLang = MsLangId::convertLocaleToLanguage(
- pLocales[nLocale]);
-#if OSL_DEBUG_LEVEL > 1
- LanguageType eReal = MsLangId::getRealLanguage( eLang );
- if ( eReal != eLang ) {
- BOOL bBreak;
- bBreak = TRUE;
- }
-#endif
- pLocaleData->setLocale( pLocales[nLocale] );
- Sequence< Currency2 > aCurrSeq = pLocaleData->getAllCurrencies();
- sal_Int32 nCurrencyCount = aCurrSeq.getLength();
- Currency2 const * const pCurrencies = aCurrSeq.getConstArray();
-
- // one default currency for each locale, insert first so it is found first
- sal_Int32 nDefault;
- for ( nDefault = 0; nDefault < nCurrencyCount; nDefault++ )
- {
- if ( pCurrencies[nDefault].Default )
- break;
- }
- if ( nDefault < nCurrencyCount )
- pEntry = new NfCurrencyEntry( pCurrencies[nDefault], *pLocaleData, eLang );
- else
- pEntry = new NfCurrencyEntry( *pLocaleData, eLang ); // first or ShellsAndPebbles
-
- if (LocaleDataWrapper::areChecksEnabled())
- lcl_CheckCurrencySymbolPosition( *pEntry );
-
- rCurrencyTable.Insert( pEntry, nCurrencyPos++ );
- if ( !nSystemCurrencyPosition && (aConfiguredCurrencyAbbrev.Len() ?
- pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev &&
- pEntry->GetLanguage() == eConfiguredCurrencyLanguage : FALSE) )
- nSystemCurrencyPosition = nCurrencyPos-1;
- if ( !nMatchingSystemCurrencyPosition &&
- pEntry->GetLanguage() == eSysLang )
- nMatchingSystemCurrencyPosition = nCurrencyPos-1;
-
- // all remaining currencies for each locale
- if ( nCurrencyCount > 1 )
- {
- sal_Int32 nCurrency;
- for ( nCurrency = 0; nCurrency < nCurrencyCount; nCurrency++ )
- {
- if (pCurrencies[nCurrency].LegacyOnly)
- {
- pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang );
- rLegacyOnlyCurrencyTable.Insert( pEntry, nLegacyOnlyCurrencyPos++ );
- }
- else if ( nCurrency != nDefault )
- {
- pEntry = new NfCurrencyEntry( pCurrencies[nCurrency], *pLocaleData, eLang );
- // no dupes
- BOOL bInsert = TRUE;
- NfCurrencyEntry const * const * pData = rCurrencyTable.GetData();
- USHORT n = rCurrencyTable.Count();
- pData++; // skip first SYSTEM entry
- for ( USHORT j=1; j<n; j++ )
- {
- if ( *(*pData++) == *pEntry )
- {
- bInsert = FALSE;
- break; // for
- }
- }
- if ( !bInsert )
- delete pEntry;
- else
- {
- rCurrencyTable.Insert( pEntry, nCurrencyPos++ );
- if ( !nSecondarySystemCurrencyPosition &&
- (aConfiguredCurrencyAbbrev.Len() ?
- pEntry->GetBankSymbol() == aConfiguredCurrencyAbbrev :
- pEntry->GetLanguage() == eConfiguredCurrencyLanguage) )
- nSecondarySystemCurrencyPosition = nCurrencyPos-1;
- if ( !nMatchingSystemCurrencyPosition &&
- pEntry->GetLanguage() == eSysLang )
- nMatchingSystemCurrencyPosition = nCurrencyPos-1;
- }
- }
- }
- }
- }
- if ( !nSystemCurrencyPosition )
- nSystemCurrencyPosition = nSecondarySystemCurrencyPosition;
- if ((aConfiguredCurrencyAbbrev.Len() && !nSystemCurrencyPosition) &&
- LocaleDataWrapper::areChecksEnabled())
- LocaleDataWrapper::outputCheckMessage(
- "SvNumberFormatter::ImpInitCurrencyTable: configured currency not in I18N locale data.");
- // match SYSTEM if no configured currency found
- if ( !nSystemCurrencyPosition )
- nSystemCurrencyPosition = nMatchingSystemCurrencyPosition;
- if ((!aConfiguredCurrencyAbbrev.Len() && !nSystemCurrencyPosition) &&
- LocaleDataWrapper::areChecksEnabled())
- LocaleDataWrapper::outputCheckMessage(
- "SvNumberFormatter::ImpInitCurrencyTable: system currency not in I18N locale data.");
- delete pLocaleData;
- SvtSysLocaleOptions::SetCurrencyChangeLink(
- STATIC_LINK( NULL, SvNumberFormatter, CurrencyChangeLink ) );
- bInitializing = FALSE;
- bCurrencyTableInitialized = TRUE;
-}
-
-
-USHORT SvNumberFormatter::GetCurrencyFormatStrings( NfWSStringsDtor& rStrArr,
- const NfCurrencyEntry& rCurr, BOOL bBank ) const
-{
- USHORT nDefault = 0;
- if ( bBank )
- { // nur Bankensymbole
- String aPositiveBank, aNegativeBank;
- rCurr.BuildPositiveFormatString( aPositiveBank, TRUE, *xLocaleData, 1 );
- rCurr.BuildNegativeFormatString( aNegativeBank, TRUE, *xLocaleData, 1 );
-
- WSStringPtr pFormat1 = new String( aPositiveBank );
- *pFormat1 += ';';
- WSStringPtr pFormat2 = new String( *pFormat1 );
-
- String aRed( '[' );
- aRed += pFormatScanner->GetRedString();
- aRed += ']';
-
- *pFormat2 += aRed;
-
- *pFormat1 += aNegativeBank;
- *pFormat2 += aNegativeBank;
-
- rStrArr.Insert( pFormat1, rStrArr.Count() );
- rStrArr.Insert( pFormat2, rStrArr.Count() );
- nDefault = rStrArr.Count() - 1;
- }
- else
- { // gemischte Formate wie in SvNumberFormatter::ImpGenerateFormats
- // aber keine doppelten, wenn keine Nachkommastellen in Waehrung
- String aPositive, aNegative, aPositiveNoDec, aNegativeNoDec,
- aPositiveDashed, aNegativeDashed;
- WSStringPtr pFormat1, pFormat2, pFormat3, pFormat4, pFormat5;
-
- String aRed( '[' );
- aRed += pFormatScanner->GetRedString();
- aRed += ']';
-
- rCurr.BuildPositiveFormatString( aPositive, FALSE, *xLocaleData, 1 );
- rCurr.BuildNegativeFormatString( aNegative, FALSE, *xLocaleData, 1 );
- if ( rCurr.GetDigits() )
- {
- rCurr.BuildPositiveFormatString( aPositiveNoDec, FALSE, *xLocaleData, 0 );
- rCurr.BuildNegativeFormatString( aNegativeNoDec, FALSE, *xLocaleData, 0 );
- rCurr.BuildPositiveFormatString( aPositiveDashed, FALSE, *xLocaleData, 2 );
- rCurr.BuildNegativeFormatString( aNegativeDashed, FALSE, *xLocaleData, 2 );
-
- pFormat1 = new String( aPositiveNoDec );
- *pFormat1 += ';';
- pFormat3 = new String( *pFormat1 );
- pFormat5 = new String( aPositiveDashed );
- *pFormat5 += ';';
-
- *pFormat1 += aNegativeNoDec;
-
- *pFormat3 += aRed;
- *pFormat5 += aRed;
-
- *pFormat3 += aNegativeNoDec;
- *pFormat5 += aNegativeDashed;
- }
- else
- {
- pFormat1 = NULL;
- pFormat3 = NULL;
- pFormat5 = NULL;
- }
-
- pFormat2 = new String( aPositive );
- *pFormat2 += ';';
- pFormat4 = new String( *pFormat2 );
-
- *pFormat2 += aNegative;
-
- *pFormat4 += aRed;
- *pFormat4 += aNegative;
-
- if ( pFormat1 )
- rStrArr.Insert( pFormat1, rStrArr.Count() );
- rStrArr.Insert( pFormat2, rStrArr.Count() );
- if ( pFormat3 )
- rStrArr.Insert( pFormat3, rStrArr.Count() );
- rStrArr.Insert( pFormat4, rStrArr.Count() );
- nDefault = rStrArr.Count() - 1;
- if ( pFormat5 )
- rStrArr.Insert( pFormat5, rStrArr.Count() );
- }
- return nDefault;
-}
-
-
-//--- NfCurrencyEntry ----------------------------------------------------
-
-NfCurrencyEntry::NfCurrencyEntry()
- : eLanguage( LANGUAGE_DONTKNOW ),
- nPositiveFormat(3),
- nNegativeFormat(8),
- nDigits(2),
- cZeroChar('0')
-{
-}
-
-
-NfCurrencyEntry::NfCurrencyEntry( const LocaleDataWrapper& rLocaleData, LanguageType eLang )
-{
- aSymbol = rLocaleData.getCurrSymbol();
- aBankSymbol = rLocaleData.getCurrBankSymbol();
- eLanguage = eLang;
- nPositiveFormat = rLocaleData.getCurrPositiveFormat();
- nNegativeFormat = rLocaleData.getCurrNegativeFormat();
- nDigits = rLocaleData.getCurrDigits();
- cZeroChar = rLocaleData.getCurrZeroChar();
-}
-
-
-NfCurrencyEntry::NfCurrencyEntry( const ::com::sun::star::i18n::Currency & rCurr,
- const LocaleDataWrapper& rLocaleData, LanguageType eLang )
-{
- aSymbol = rCurr.Symbol;
- aBankSymbol = rCurr.BankSymbol;
- eLanguage = eLang;
- nPositiveFormat = rLocaleData.getCurrPositiveFormat();
- nNegativeFormat = rLocaleData.getCurrNegativeFormat();
- nDigits = rCurr.DecimalPlaces;
- cZeroChar = rLocaleData.getCurrZeroChar();
-}
-
-
-BOOL NfCurrencyEntry::operator==( const NfCurrencyEntry& r ) const
-{
- return aSymbol == r.aSymbol
- && aBankSymbol == r.aBankSymbol
- && eLanguage == r.eLanguage
- ;
-}
-
-
-void NfCurrencyEntry::SetEuro()
-{
- aSymbol = NfCurrencyEntry::GetEuroSymbol();
- aBankSymbol.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "EUR" ) );
- eLanguage = LANGUAGE_DONTKNOW;
- nPositiveFormat = 3;
- nNegativeFormat = 8;
- nDigits = 2;
- cZeroChar = '0';
-}
-
-
-BOOL NfCurrencyEntry::IsEuro() const
-{
- if ( aBankSymbol.EqualsAscii( "EUR" ) )
- return TRUE;
- String aEuro( NfCurrencyEntry::GetEuroSymbol() );
- return aSymbol == aEuro;
-}
-
-
-void NfCurrencyEntry::ApplyVariableInformation( const NfCurrencyEntry& r )
-{
- nPositiveFormat = r.nPositiveFormat;
- nNegativeFormat = r.nNegativeFormat;
- cZeroChar = r.cZeroChar;
-}
-
-
-void NfCurrencyEntry::BuildSymbolString( String& rStr, BOOL bBank,
- BOOL bWithoutExtension ) const
-{
- rStr = '[';
- rStr += '$';
- if ( bBank )
- rStr += aBankSymbol;
- else
- {
- if ( aSymbol.Search( '-' ) != STRING_NOTFOUND || aSymbol.Search( ']' ) != STRING_NOTFOUND )
- {
- rStr += '"';
- rStr += aSymbol;
- rStr += '"';
- }
- else
- rStr += aSymbol;
- if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM )
- {
- rStr += '-';
- rStr += String::CreateFromInt32( sal_Int32( eLanguage ), 16 ).ToUpperAscii();
- }
- }
- rStr += ']';
-}
-
-
-void NfCurrencyEntry::Impl_BuildFormatStringNumChars( String& rStr,
- const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const
-{
- rStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###0" ) );
- rStr.Insert( rLoc.getNumThousandSep(), 1 );
- if ( nDecimalFormat && nDigits )
- {
- rStr += rLoc.getNumDecimalSep();
- rStr.Expand( rStr.Len() + nDigits, (nDecimalFormat == 2 ? '-' : cZeroChar) );
- }
-}
-
-
-void NfCurrencyEntry::BuildPositiveFormatString( String& rStr, BOOL bBank,
- const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const
-{
- Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat );
- USHORT nPosiForm = NfCurrencyEntry::GetEffectivePositiveFormat(
- rLoc.getCurrPositiveFormat(), nPositiveFormat, bBank );
- CompletePositiveFormatString( rStr, bBank, nPosiForm );
-}
-
-
-void NfCurrencyEntry::BuildNegativeFormatString( String& rStr, BOOL bBank,
- const LocaleDataWrapper& rLoc, USHORT nDecimalFormat ) const
-{
- Impl_BuildFormatStringNumChars( rStr, rLoc, nDecimalFormat );
- USHORT nNegaForm = NfCurrencyEntry::GetEffectiveNegativeFormat(
- rLoc.getCurrNegativeFormat(), nNegativeFormat, bBank );
- CompleteNegativeFormatString( rStr, bBank, nNegaForm );
-}
-
-
-void NfCurrencyEntry::CompletePositiveFormatString( String& rStr, BOOL bBank,
- USHORT nPosiForm ) const
-{
- String aSymStr;
- BuildSymbolString( aSymStr, bBank );
- NfCurrencyEntry::CompletePositiveFormatString( rStr, aSymStr, nPosiForm );
-}
-
-
-void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr, BOOL bBank,
- USHORT nNegaForm ) const
-{
- String aSymStr;
- BuildSymbolString( aSymStr, bBank );
- NfCurrencyEntry::CompleteNegativeFormatString( rStr, aSymStr, nNegaForm );
-}
-
-
-// static
-void NfCurrencyEntry::CompletePositiveFormatString( String& rStr,
- const String& rSymStr, USHORT nPositiveFormat )
-{
- switch( nPositiveFormat )
- {
- case 0: // $1
- rStr.Insert( rSymStr , 0 );
- break;
- case 1: // 1$
- rStr += rSymStr;
- break;
- case 2: // $ 1
- {
- rStr.Insert( ' ', 0 );
- rStr.Insert( rSymStr, 0 );
- }
- break;
- case 3: // 1 $
- {
- rStr += ' ';
- rStr += rSymStr;
- }
- break;
- default:
- DBG_ERROR("NfCurrencyEntry::CompletePositiveFormatString: unknown option");
- break;
- }
-}
-
-
-// static
-void NfCurrencyEntry::CompleteNegativeFormatString( String& rStr,
- const String& rSymStr, USHORT nNegativeFormat )
-{
- switch( nNegativeFormat )
- {
- case 0: // ($1)
- {
- rStr.Insert( rSymStr, 0);
- rStr.Insert('(',0);
- rStr += ')';
- }
- break;
- case 1: // -$1
- {
- rStr.Insert( rSymStr, 0);
- rStr.Insert('-',0);
- }
- break;
- case 2: // $-1
- {
- rStr.Insert('-',0);
- rStr.Insert( rSymStr, 0);
- }
- break;
- case 3: // $1-
- {
- rStr.Insert( rSymStr, 0);
- rStr += '-';
- }
- break;
- case 4: // (1$)
- {
- rStr.Insert('(',0);
- rStr += rSymStr;
- rStr += ')';
- }
- break;
- case 5: // -1$
- {
- rStr += rSymStr;
- rStr.Insert('-',0);
- }
- break;
- case 6: // 1-$
- {
- rStr += '-';
- rStr += rSymStr;
- }
- break;
- case 7: // 1$-
- {
- rStr += rSymStr;
- rStr += '-';
- }
- break;
- case 8: // -1 $
- {
- rStr += ' ';
- rStr += rSymStr;
- rStr.Insert('-',0);
- }
- break;
- case 9: // -$ 1
- {
- rStr.Insert(' ',0);
- rStr.Insert( rSymStr, 0);
- rStr.Insert('-',0);
- }
- break;
- case 10: // 1 $-
- {
- rStr += ' ';
- rStr += rSymStr;
- rStr += '-';
- }
- break;
- case 11: // $ -1
- {
- String aTmp( rSymStr );
- aTmp += ' ';
- aTmp += '-';
- rStr.Insert( aTmp, 0 );
- }
- break;
- case 12 : // $ 1-
- {
- rStr.Insert(' ', 0);
- rStr.Insert( rSymStr, 0);
- rStr += '-';
- }
- break;
- case 13 : // 1- $
- {
- rStr += '-';
- rStr += ' ';
- rStr += rSymStr;
- }
- break;
- case 14 : // ($ 1)
- {
- rStr.Insert(' ',0);
- rStr.Insert( rSymStr, 0);
- rStr.Insert('(',0);
- rStr += ')';
- }
- break;
- case 15 : // (1 $)
- {
- rStr.Insert('(',0);
- rStr += ' ';
- rStr += rSymStr;
- rStr += ')';
- }
- break;
- default:
- DBG_ERROR("NfCurrencyEntry::CompleteNegativeFormatString: unknown option");
- break;
- }
-}
-
-
-// static
-USHORT NfCurrencyEntry::GetEffectivePositiveFormat( USHORT
-#if ! NF_BANKSYMBOL_FIX_POSITION
- nIntlFormat
-#endif
- , USHORT nCurrFormat, BOOL bBank )
-{
- if ( bBank )
- {
-#if NF_BANKSYMBOL_FIX_POSITION
- return 3;
-#else
- switch ( nIntlFormat )
- {
- case 0: // $1
- nIntlFormat = 2; // $ 1
- break;
- case 1: // 1$
- nIntlFormat = 3; // 1 $
- break;
- case 2: // $ 1
- break;
- case 3: // 1 $
- break;
- default:
- DBG_ERROR("NfCurrencyEntry::GetEffectivePositiveFormat: unknown option");
- break;
- }
- return nIntlFormat;
-#endif
- }
- else
- return nCurrFormat;
-}
-
-
-// nur aufrufen, wenn nCurrFormat wirklich mit Klammern ist
-USHORT lcl_MergeNegativeParenthesisFormat( USHORT nIntlFormat, USHORT nCurrFormat )
-{
- short nSign = 0; // -1:=Klammer 0:=links, 1:=mitte, 2:=rechts
- switch ( nIntlFormat )
- {
- case 0: // ($1)
- case 4: // (1$)
- case 14 : // ($ 1)
- case 15 : // (1 $)
- return nCurrFormat;
- case 1: // -$1
- case 5: // -1$
- case 8: // -1 $
- case 9: // -$ 1
- nSign = 0;
- break;
- case 2: // $-1
- case 6: // 1-$
- case 11 : // $ -1
- case 13 : // 1- $
- nSign = 1;
- break;
- case 3: // $1-
- case 7: // 1$-
- case 10: // 1 $-
- case 12 : // $ 1-
- nSign = 2;
- break;
- default:
- DBG_ERROR("lcl_MergeNegativeParenthesisFormat: unknown option");
- break;
- }
-
- switch ( nCurrFormat )
- {
- case 0: // ($1)
- switch ( nSign )
- {
- case 0:
- return 1; // -$1
- case 1:
- return 2; // $-1
- case 2:
- return 3; // $1-
- }
- break;
- case 4: // (1$)
- switch ( nSign )
- {
- case 0:
- return 5; // -1$
- case 1:
- return 6; // 1-$
- case 2:
- return 7; // 1$-
- }
- break;
- case 14 : // ($ 1)
- switch ( nSign )
- {
- case 0:
- return 9; // -$ 1
- case 1:
- return 11; // $ -1
- case 2:
- return 12; // $ 1-
- }
- break;
- case 15 : // (1 $)
- switch ( nSign )
- {
- case 0:
- return 8; // -1 $
- case 1:
- return 13; // 1- $
- case 2:
- return 10; // 1 $-
- }
- break;
- }
- return nCurrFormat;
-}
-
-
-// static
-USHORT NfCurrencyEntry::GetEffectiveNegativeFormat( USHORT nIntlFormat,
- USHORT nCurrFormat, BOOL bBank )
-{
- if ( bBank )
- {
-#if NF_BANKSYMBOL_FIX_POSITION
- return 8;
-#else
- switch ( nIntlFormat )
- {
- case 0: // ($1)
-// nIntlFormat = 14; // ($ 1)
- nIntlFormat = 9; // -$ 1
- break;
- case 1: // -$1
- nIntlFormat = 9; // -$ 1
- break;
- case 2: // $-1
- nIntlFormat = 11; // $ -1
- break;
- case 3: // $1-
- nIntlFormat = 12; // $ 1-
- break;
- case 4: // (1$)
-// nIntlFormat = 15; // (1 $)
- nIntlFormat = 8; // -1 $
- break;
- case 5: // -1$
- nIntlFormat = 8; // -1 $
- break;
- case 6: // 1-$
- nIntlFormat = 13; // 1- $
- break;
- case 7: // 1$-
- nIntlFormat = 10; // 1 $-
- break;
- case 8: // -1 $
- break;
- case 9: // -$ 1
- break;
- case 10: // 1 $-
- break;
- case 11: // $ -1
- break;
- case 12 : // $ 1-
- break;
- case 13 : // 1- $
- break;
- case 14 : // ($ 1)
-// nIntlFormat = 14; // ($ 1)
- nIntlFormat = 9; // -$ 1
- break;
- case 15 : // (1 $)
-// nIntlFormat = 15; // (1 $)
- nIntlFormat = 8; // -1 $
- break;
- default:
- DBG_ERROR("NfCurrencyEntry::GetEffectiveNegativeFormat: unknown option");
- break;
- }
-#endif
- }
- else if ( nIntlFormat != nCurrFormat )
- {
- switch ( nCurrFormat )
- {
- case 0: // ($1)
- nIntlFormat = lcl_MergeNegativeParenthesisFormat(
- nIntlFormat, nCurrFormat );
- break;
- case 1: // -$1
- nIntlFormat = nCurrFormat;
- break;
- case 2: // $-1
- nIntlFormat = nCurrFormat;
- break;
- case 3: // $1-
- nIntlFormat = nCurrFormat;
- break;
- case 4: // (1$)
- nIntlFormat = lcl_MergeNegativeParenthesisFormat(
- nIntlFormat, nCurrFormat );
- break;
- case 5: // -1$
- nIntlFormat = nCurrFormat;
- break;
- case 6: // 1-$
- nIntlFormat = nCurrFormat;
- break;
- case 7: // 1$-
- nIntlFormat = nCurrFormat;
- break;
- case 8: // -1 $
- nIntlFormat = nCurrFormat;
- break;
- case 9: // -$ 1
- nIntlFormat = nCurrFormat;
- break;
- case 10: // 1 $-
- nIntlFormat = nCurrFormat;
- break;
- case 11: // $ -1
- nIntlFormat = nCurrFormat;
- break;
- case 12 : // $ 1-
- nIntlFormat = nCurrFormat;
- break;
- case 13 : // 1- $
- nIntlFormat = nCurrFormat;
- break;
- case 14 : // ($ 1)
- nIntlFormat = lcl_MergeNegativeParenthesisFormat(
- nIntlFormat, nCurrFormat );
- break;
- case 15 : // (1 $)
- nIntlFormat = lcl_MergeNegativeParenthesisFormat(
- nIntlFormat, nCurrFormat );
- break;
- default:
- DBG_ERROR("NfCurrencyEntry::GetEffectiveNegativeFormat: unknown option");
- break;
- }
- }
- return nIntlFormat;
-}
-
-
-// we only support default encodings here
-// static
-sal_Char NfCurrencyEntry::GetEuroSymbol( rtl_TextEncoding eTextEncoding )
-{
- switch ( eTextEncoding )
- {
- case RTL_TEXTENCODING_MS_1252 : // WNT Ansi
- case RTL_TEXTENCODING_ISO_8859_1 : // UNX for use with TrueType fonts
- return '\x80';
- case RTL_TEXTENCODING_ISO_8859_15 : // UNX real
- return '\xA4';
- case RTL_TEXTENCODING_IBM_850 : // OS2
- return '\xD5';
- case RTL_TEXTENCODING_APPLE_ROMAN : // MAC
- return '\xDB';
- default: // default system
-#if WNT
- return '\x80';
-#elif OS2
- return '\xD5';
-#elif UNX
-// return '\xA4'; // #56121# 0xA4 waere korrekt fuer iso-8859-15
- return '\x80'; // aber Windoze-Code fuer die konvertierten TrueType-Fonts
-#else
-#error EuroSymbol is what?
- return '\x80';
-#endif
- }
- return '\x80';
-}
-
-
-
diff --git a/svtools/source/numbers/zformat.cxx b/svtools/source/numbers/zformat.cxx
deleted file mode 100644
index 0afbf3b4a3f5..000000000000
--- a/svtools/source/numbers/zformat.cxx
+++ /dev/null
@@ -1,4480 +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: zformat.cxx,v $
- * $Revision: 1.78.138.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#include <stdio.h>
-#include <ctype.h>
-#include <float.h>
-// #include <math.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <tools/debug.hxx>
-#include <i18npool/mslangid.hxx>
-#include <rtl/math.hxx>
-#include <rtl/instance.hxx>
-#include <unotools/charclass.hxx>
-#include <unotools/calendarwrapper.hxx>
-#include <unotools/nativenumberwrapper.hxx>
-#include <com/sun/star/i18n/CalendarFieldIndex.hpp>
-#include <com/sun/star/i18n/CalendarDisplayIndex.hpp>
-#include <com/sun/star/i18n/CalendarDisplayCode.hpp>
-#include <com/sun/star/i18n/AmPmValue.hpp>
-
-#define _ZFORMAT_CXX
-#include <svtools/zformat.hxx>
-#include "zforscan.hxx"
-
-#include "zforfind.hxx"
-#include <svtools/zforlist.hxx>
-#include "numhead.hxx"
-#include <unotools/digitgroupingiterator.hxx>
-#include "nfsymbol.hxx"
-using namespace svt;
-
-namespace {
-struct Gregorian
- : public rtl::StaticWithInit<const ::rtl::OUString, Gregorian> {
- const ::rtl::OUString operator () () {
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("gregorian"));
- }
-};
-}
-
-const double _D_MAX_U_LONG_ = (double) 0xffffffff; // 4294967295.0
-const double _D_MAX_LONG_ = (double) 0x7fffffff; // 2147483647.0
-const USHORT _MAX_FRACTION_PREC = 3;
-const double D_EPS = 1.0E-2;
-
-const double _D_MAX_D_BY_100 = 1.7E306;
-const double _D_MIN_M_BY_1000 = 2.3E-305;
-
-static BYTE cCharWidths[ 128-32 ] = {
- 1,1,1,2,2,3,2,1,1,1,1,2,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,1,1,2,2,2,2,
- 3,2,2,2,2,2,2,3,2,1,2,2,2,3,3,3,
- 2,3,2,2,2,2,2,3,2,2,2,1,1,1,2,2,
- 1,2,2,2,2,2,1,2,2,1,1,2,1,3,2,2,
- 2,2,1,2,1,2,2,2,2,2,2,1,1,1,2,1
-};
-
-// static
-xub_StrLen SvNumberformat::InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c )
-{
- if( c >= 32 )
- {
- USHORT n = 2; // Default fuer Zeichen > 128 (HACK!)
- if( c <= 127 )
- n = cCharWidths[ c - 32 ];
- while( n-- )
- r.Insert( ' ', nPos++ );
- }
- return nPos;
-}
-
-static long GetPrecExp( double fAbsVal )
-{
- DBG_ASSERT( fAbsVal > 0.0, "GetPrecExp: fAbsVal <= 0.0" );
- if ( fAbsVal < 1e-7 || fAbsVal > 1e7 )
- { // die Schere, ob's schneller ist oder nicht, liegt zwischen 1e6 und 1e7
- return (long) floor( log10( fAbsVal ) ) + 1;
- }
- else
- {
- long nPrecExp = 1;
- while( fAbsVal < 1 )
- {
- fAbsVal *= 10;
- nPrecExp--;
- }
- while( fAbsVal >= 10 )
- {
- fAbsVal /= 10;
- nPrecExp++;
- }
- return nPrecExp;
- }
-}
-
-const USHORT nNewCurrencyVersionId = 0x434E; // "NC"
-const sal_Unicode cNewCurrencyMagic = 0x01; // Magic for format code in comment
-const USHORT nNewStandardFlagVersionId = 0x4653; // "SF"
-
-/***********************Funktion SvNumberformatInfo******************************/
-
-void ImpSvNumberformatInfo::Copy( const ImpSvNumberformatInfo& rNumFor, USHORT nAnz )
-{
- for (USHORT i = 0; i < nAnz; i++)
- {
- sStrArray[i] = rNumFor.sStrArray[i];
- nTypeArray[i] = rNumFor.nTypeArray[i];
- }
- eScannedType = rNumFor.eScannedType;
- bThousand = rNumFor.bThousand;
- nThousand = rNumFor.nThousand;
- nCntPre = rNumFor.nCntPre;
- nCntPost = rNumFor.nCntPost;
- nCntExp = rNumFor.nCntExp;
-}
-
-void ImpSvNumberformatInfo::Save(SvStream& rStream, USHORT nAnz) const
-{
- for (USHORT i = 0; i < nAnz; i++)
- {
- rStream.WriteByteString( sStrArray[i], rStream.GetStreamCharSet() );
- short nType = nTypeArray[i];
- switch ( nType )
- { // der Krampf fuer Versionen vor SV_NUMBERFORMATTER_VERSION_NEW_CURR
- case NF_SYMBOLTYPE_CURRENCY :
- rStream << short( NF_SYMBOLTYPE_STRING );
- break;
- case NF_SYMBOLTYPE_CURRDEL :
- case NF_SYMBOLTYPE_CURREXT :
- rStream << short(0); // werden ignoriert (hoffentlich..)
- break;
- default:
- if ( nType > NF_KEY_LASTKEYWORD_SO5 )
- rStream << short( NF_SYMBOLTYPE_STRING ); // all new keywords are string
- else
- rStream << nType;
- }
-
- }
- rStream << eScannedType << bThousand << nThousand
- << nCntPre << nCntPost << nCntExp;
-}
-
-void ImpSvNumberformatInfo::Load(SvStream& rStream, USHORT nAnz)
-{
- for (USHORT i = 0; i < nAnz; i++)
- {
- SvNumberformat::LoadString( rStream, sStrArray[i] );
- rStream >> nTypeArray[i];
- }
- rStream >> eScannedType >> bThousand >> nThousand
- >> nCntPre >> nCntPost >> nCntExp;
-}
-
-
-//============================================================================
-
-// static
-BYTE SvNumberNatNum::MapDBNumToNatNum( BYTE nDBNum, LanguageType eLang, BOOL bDate )
-{
- BYTE nNatNum = 0;
- eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc.
- eLang &= 0x03FF; // 10 bit primary language
- if ( bDate )
- {
- if ( nDBNum == 4 && eLang == LANGUAGE_KOREAN )
- nNatNum = 9;
- else if ( nDBNum <= 3 )
- nNatNum = nDBNum; // known to be good for: zh,ja,ko / 1,2,3
- }
- else
- {
- switch ( nDBNum )
- {
- case 1:
- switch ( eLang )
- {
- case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 4; break;
- case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 1; break;
- case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 1; break;
- }
- break;
- case 2:
- switch ( eLang )
- {
- case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 5; break;
- case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 4; break;
- case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 2; break;
- }
- break;
- case 3:
- switch ( eLang )
- {
- case (LANGUAGE_CHINESE & 0x03FF) : nNatNum = 6; break;
- case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 5; break;
- case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 3; break;
- }
- break;
- case 4:
- switch ( eLang )
- {
- case (LANGUAGE_JAPANESE & 0x03FF) : nNatNum = 7; break;
- case (LANGUAGE_KOREAN & 0x03FF) : nNatNum = 9; break;
- }
- break;
- }
- }
- return nNatNum;
-}
-
-
-// static
-BYTE SvNumberNatNum::MapNatNumToDBNum( BYTE nNatNum, LanguageType eLang, BOOL bDate )
-{
- BYTE nDBNum = 0;
- eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc.
- eLang &= 0x03FF; // 10 bit primary language
- if ( bDate )
- {
- if ( nNatNum == 9 && eLang == LANGUAGE_KOREAN )
- nDBNum = 4;
- else if ( nNatNum <= 3 )
- nDBNum = nNatNum; // known to be good for: zh,ja,ko / 1,2,3
- }
- else
- {
- switch ( nNatNum )
- {
- case 1:
- switch ( eLang )
- {
- case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 1; break;
- case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 1; break;
- }
- break;
- case 2:
- switch ( eLang )
- {
- case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 2; break;
- }
- break;
- case 3:
- switch ( eLang )
- {
- case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 3; break;
- }
- break;
- case 4:
- switch ( eLang )
- {
- case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 1; break;
- case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 2; break;
- }
- break;
- case 5:
- switch ( eLang )
- {
- case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 2; break;
- case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 3; break;
- }
- break;
- case 6:
- switch ( eLang )
- {
- case (LANGUAGE_CHINESE & 0x03FF) : nDBNum = 3; break;
- }
- break;
- case 7:
- switch ( eLang )
- {
- case (LANGUAGE_JAPANESE & 0x03FF) : nDBNum = 4; break;
- }
- break;
- case 8:
- break;
- case 9:
- switch ( eLang )
- {
- case (LANGUAGE_KOREAN & 0x03FF) : nDBNum = 4; break;
- }
- break;
- case 10:
- break;
- case 11:
- break;
- }
- }
- return nDBNum;
-}
-
-/***********************Funktionen SvNumFor******************************/
-
-ImpSvNumFor::ImpSvNumFor()
-{
- nAnzStrings = 0;
- aI.nTypeArray = NULL;
- aI.sStrArray = NULL;
- aI.eScannedType = NUMBERFORMAT_UNDEFINED;
- aI.bThousand = FALSE;
- aI.nThousand = 0;
- aI.nCntPre = 0;
- aI.nCntPost = 0;
- aI.nCntExp = 0;
- pColor = NULL;
-}
-
-ImpSvNumFor::~ImpSvNumFor()
-{
- for (USHORT i = 0; i < nAnzStrings; i++)
- aI.sStrArray[i].Erase();
- delete [] aI.sStrArray;
- delete [] aI.nTypeArray;
-}
-
-void ImpSvNumFor::Enlarge(USHORT nAnz)
-{
- if ( nAnzStrings != nAnz )
- {
- if ( aI.nTypeArray )
- delete [] aI.nTypeArray;
- if ( aI.sStrArray )
- delete [] aI.sStrArray;
- nAnzStrings = nAnz;
- if ( nAnz )
- {
- aI.nTypeArray = new short[nAnz];
- aI.sStrArray = new String[nAnz];
- }
- else
- {
- aI.nTypeArray = NULL;
- aI.sStrArray = NULL;
- }
- }
-}
-
-void ImpSvNumFor::Copy( const ImpSvNumFor& rNumFor, ImpSvNumberformatScan* pSc )
-{
- Enlarge( rNumFor.nAnzStrings );
- aI.Copy( rNumFor.aI, nAnzStrings );
- sColorName = rNumFor.sColorName;
- if ( pSc )
- pColor = pSc->GetColor( sColorName ); // #121103# don't copy pointer between documents
- else
- pColor = rNumFor.pColor;
- aNatNum = rNumFor.aNatNum;
-}
-
-void ImpSvNumFor::Save(SvStream& rStream) const
-{
- rStream << nAnzStrings;
- aI.Save(rStream, nAnzStrings);
- rStream.WriteByteString( sColorName, rStream.GetStreamCharSet() );
-}
-
-void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc,
- String& rLoadedColorName )
-{
- USHORT nAnz;
- rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge
- Enlarge( nAnz );
- aI.Load( rStream, nAnz );
- rStream.ReadByteString( sColorName, rStream.GetStreamCharSet() );
- rLoadedColorName = sColorName;
- pColor = rSc.GetColor(sColorName);
-}
-
-
-BOOL ImpSvNumFor::HasNewCurrency() const
-{
- for ( USHORT j=0; j<nAnzStrings; j++ )
- {
- if ( aI.nTypeArray[j] == NF_SYMBOLTYPE_CURRENCY )
- return TRUE;
- }
- return FALSE;
-}
-
-
-BOOL ImpSvNumFor::GetNewCurrencySymbol( String& rSymbol,
- String& rExtension ) const
-{
- for ( USHORT j=0; j<nAnzStrings; j++ )
- {
- if ( aI.nTypeArray[j] == NF_SYMBOLTYPE_CURRENCY )
- {
- rSymbol = aI.sStrArray[j];
- if ( j < nAnzStrings-1 && aI.nTypeArray[j+1] == NF_SYMBOLTYPE_CURREXT )
- rExtension = aI.sStrArray[j+1];
- else
- rExtension.Erase();
- return TRUE;
- }
- }
- //! kein Erase an rSymbol, rExtension
- return FALSE;
-}
-
-
-void ImpSvNumFor::SaveNewCurrencyMap( SvStream& rStream ) const
-{
- USHORT j;
- USHORT nCnt = 0;
- for ( j=0; j<nAnzStrings; j++ )
- {
- switch ( aI.nTypeArray[j] )
- {
- case NF_SYMBOLTYPE_CURRENCY :
- case NF_SYMBOLTYPE_CURRDEL :
- case NF_SYMBOLTYPE_CURREXT :
- nCnt++;
- break;
- }
- }
- rStream << nCnt;
- for ( j=0; j<nAnzStrings; j++ )
- {
- switch ( aI.nTypeArray[j] )
- {
- case NF_SYMBOLTYPE_CURRENCY :
- case NF_SYMBOLTYPE_CURRDEL :
- case NF_SYMBOLTYPE_CURREXT :
- rStream << j << aI.nTypeArray[j];
- break;
- }
- }
-}
-
-
-void ImpSvNumFor::LoadNewCurrencyMap( SvStream& rStream )
-{
- USHORT nCnt;
- rStream >> nCnt;
- for ( USHORT j=0; j<nCnt; j++ )
- {
- USHORT nPos;
- short nType;
- rStream >> nPos >> nType;
- if ( nPos < nAnzStrings )
- aI.nTypeArray[nPos] = nType;
- }
-}
-
-
-/***********************Funktionen SvNumberformat************************/
-
-enum BracketFormatSymbolType
-{
- BRACKET_SYMBOLTYPE_FORMAT = -1, // subformat string
- BRACKET_SYMBOLTYPE_COLOR = -2, // color
- BRACKET_SYMBOLTYPE_ERROR = -3, // error
- BRACKET_SYMBOLTYPE_DBNUM1 = -4, // DoubleByteNumber, represent numbers
- BRACKET_SYMBOLTYPE_DBNUM2 = -5, // using CJK characters, Excel compatible.
- BRACKET_SYMBOLTYPE_DBNUM3 = -6,
- BRACKET_SYMBOLTYPE_DBNUM4 = -7,
- BRACKET_SYMBOLTYPE_DBNUM5 = -8,
- BRACKET_SYMBOLTYPE_DBNUM6 = -9,
- BRACKET_SYMBOLTYPE_DBNUM7 = -10,
- BRACKET_SYMBOLTYPE_DBNUM8 = -11,
- BRACKET_SYMBOLTYPE_DBNUM9 = -12,
- BRACKET_SYMBOLTYPE_LOCALE = -13,
- BRACKET_SYMBOLTYPE_NATNUM0 = -14, // Our NativeNumber support, ASCII
- BRACKET_SYMBOLTYPE_NATNUM1 = -15, // Our NativeNumber support, represent
- BRACKET_SYMBOLTYPE_NATNUM2 = -16, // numbers using CJK, CTL, ...
- BRACKET_SYMBOLTYPE_NATNUM3 = -17,
- BRACKET_SYMBOLTYPE_NATNUM4 = -18,
- BRACKET_SYMBOLTYPE_NATNUM5 = -19,
- BRACKET_SYMBOLTYPE_NATNUM6 = -20,
- BRACKET_SYMBOLTYPE_NATNUM7 = -21,
- BRACKET_SYMBOLTYPE_NATNUM8 = -22,
- BRACKET_SYMBOLTYPE_NATNUM9 = -23,
- BRACKET_SYMBOLTYPE_NATNUM10 = -24,
- BRACKET_SYMBOLTYPE_NATNUM11 = -25,
- BRACKET_SYMBOLTYPE_NATNUM12 = -26,
- BRACKET_SYMBOLTYPE_NATNUM13 = -27,
- BRACKET_SYMBOLTYPE_NATNUM14 = -28,
- BRACKET_SYMBOLTYPE_NATNUM15 = -29,
- BRACKET_SYMBOLTYPE_NATNUM16 = -30,
- BRACKET_SYMBOLTYPE_NATNUM17 = -31,
- BRACKET_SYMBOLTYPE_NATNUM18 = -32,
- BRACKET_SYMBOLTYPE_NATNUM19 = -33
-};
-
-SvNumberformat::SvNumberformat( ImpSvNumberformatScan& rSc, LanguageType eLge )
- :
- rScan(rSc),
- eLnge(eLge),
- nNewStandardDefined(0),
- bStarFlag( FALSE )
-{
-}
-
-void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat )
-{
- sFormatstring = rFormat.sFormatstring;
- eType = rFormat.eType;
- eLnge = rFormat.eLnge;
- fLimit1 = rFormat.fLimit1;
- fLimit2 = rFormat.fLimit2;
- eOp1 = rFormat.eOp1;
- eOp2 = rFormat.eOp2;
- bStandard = rFormat.bStandard;
- bIsUsed = rFormat.bIsUsed;
- sComment = rFormat.sComment;
- nNewStandardDefined = rFormat.nNewStandardDefined;
-
- // #121103# when copying between documents, get color pointers from own scanner
- ImpSvNumberformatScan* pColorSc = ( &rScan != &rFormat.rScan ) ? &rScan : NULL;
-
- for (USHORT i = 0; i < 4; i++)
- NumFor[i].Copy(rFormat.NumFor[i], pColorSc);
-}
-
-SvNumberformat::SvNumberformat( SvNumberformat& rFormat )
- : rScan(rFormat.rScan), bStarFlag( rFormat.bStarFlag )
-{
- ImpCopyNumberformat( rFormat );
-}
-
-SvNumberformat::SvNumberformat( SvNumberformat& rFormat, ImpSvNumberformatScan& rSc )
- : rScan(rSc), bStarFlag( rFormat.bStarFlag )
-{
- ImpCopyNumberformat( rFormat );
-}
-
-
-BOOL lcl_SvNumberformat_IsBracketedPrefix( short nSymbolType )
-{
- if ( nSymbolType > 0 )
- return TRUE; // conditions
- switch ( nSymbolType )
- {
- case BRACKET_SYMBOLTYPE_COLOR :
- case BRACKET_SYMBOLTYPE_DBNUM1 :
- case BRACKET_SYMBOLTYPE_DBNUM2 :
- case BRACKET_SYMBOLTYPE_DBNUM3 :
- case BRACKET_SYMBOLTYPE_DBNUM4 :
- case BRACKET_SYMBOLTYPE_DBNUM5 :
- case BRACKET_SYMBOLTYPE_DBNUM6 :
- case BRACKET_SYMBOLTYPE_DBNUM7 :
- case BRACKET_SYMBOLTYPE_DBNUM8 :
- case BRACKET_SYMBOLTYPE_DBNUM9 :
- case BRACKET_SYMBOLTYPE_LOCALE :
- case BRACKET_SYMBOLTYPE_NATNUM0 :
- case BRACKET_SYMBOLTYPE_NATNUM1 :
- case BRACKET_SYMBOLTYPE_NATNUM2 :
- case BRACKET_SYMBOLTYPE_NATNUM3 :
- case BRACKET_SYMBOLTYPE_NATNUM4 :
- case BRACKET_SYMBOLTYPE_NATNUM5 :
- case BRACKET_SYMBOLTYPE_NATNUM6 :
- case BRACKET_SYMBOLTYPE_NATNUM7 :
- case BRACKET_SYMBOLTYPE_NATNUM8 :
- case BRACKET_SYMBOLTYPE_NATNUM9 :
- case BRACKET_SYMBOLTYPE_NATNUM10 :
- case BRACKET_SYMBOLTYPE_NATNUM11 :
- case BRACKET_SYMBOLTYPE_NATNUM12 :
- case BRACKET_SYMBOLTYPE_NATNUM13 :
- case BRACKET_SYMBOLTYPE_NATNUM14 :
- case BRACKET_SYMBOLTYPE_NATNUM15 :
- case BRACKET_SYMBOLTYPE_NATNUM16 :
- case BRACKET_SYMBOLTYPE_NATNUM17 :
- case BRACKET_SYMBOLTYPE_NATNUM18 :
- case BRACKET_SYMBOLTYPE_NATNUM19 :
- return TRUE;
- }
- return FALSE;
-}
-
-
-SvNumberformat::SvNumberformat(String& rString,
- ImpSvNumberformatScan* pSc,
- ImpSvNumberInputScan* pISc,
- xub_StrLen& nCheckPos,
- LanguageType& eLan,
- BOOL bStan)
- :
- rScan(*pSc),
- nNewStandardDefined(0),
- bStarFlag( FALSE )
-{
- // If the group (AKA thousand) separator is a Non-Breaking Space (French)
- // replace all occurences by a simple space.
- // The tokens will be changed to the LocaleData separator again later on.
- const sal_Unicode cNBSp = 0xA0;
- const String& rThSep = GetFormatter().GetNumThousandSep();
- if ( rThSep.GetChar(0) == cNBSp && rThSep.Len() == 1 )
- {
- xub_StrLen nIndex = 0;
- do
- nIndex = rString.SearchAndReplace( cNBSp, ' ', nIndex );
- while ( nIndex != STRING_NOTFOUND );
- }
-
- if (rScan.GetConvertMode())
- {
- eLnge = rScan.GetNewLnge();
- eLan = eLnge; // Wechsel auch zurueckgeben
- }
- else
- eLnge = eLan;
- bStandard = bStan;
- bIsUsed = FALSE;
- fLimit1 = 0.0;
- fLimit2 = 0.0;
- eOp1 = NUMBERFORMAT_OP_NO;
- eOp2 = NUMBERFORMAT_OP_NO;
- eType = NUMBERFORMAT_DEFINED;
-
- BOOL bCancel = FALSE;
- BOOL bCondition = FALSE;
- short eSymbolType;
- xub_StrLen nPos = 0;
- xub_StrLen nPosOld;
- nCheckPos = 0;
- String aComment;
-
- // Split into 4 sub formats
- USHORT nIndex;
- for ( nIndex = 0; nIndex < 4 && !bCancel; nIndex++ )
- {
- // Original language/country may have to be reestablished
- if (rScan.GetConvertMode())
- (rScan.GetNumberformatter())->ChangeIntl(rScan.GetTmpLnge());
-
- String sStr;
- nPosOld = nPos; // Start position of substring
- // first get bracketed prefixes; e.g. conditions, color
- do
- {
- eSymbolType = ImpNextSymbol(rString, nPos, sStr);
- if (eSymbolType > 0) // condition
- {
- if ( nIndex == 0 && !bCondition )
- {
- bCondition = TRUE;
- eOp1 = (SvNumberformatLimitOps) eSymbolType;
- }
- else if ( nIndex == 1 && bCondition )
- eOp2 = (SvNumberformatLimitOps) eSymbolType;
- else // error
- {
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- if (!bCancel)
- {
- double fNumber;
- xub_StrLen nAnzChars = ImpGetNumber(rString, nPos, sStr);
- if (nAnzChars > 0)
- {
- short F_Type;
- if (!pISc->IsNumberFormat(sStr,F_Type,fNumber) ||
- ( F_Type != NUMBERFORMAT_NUMBER &&
- F_Type != NUMBERFORMAT_SCIENTIFIC) )
- {
- fNumber = 0.0;
- nPos = nPos - nAnzChars;
- rString.Erase(nPos, nAnzChars);
- rString.Insert('0',nPos);
- nPos++;
- }
- }
- else
- {
- fNumber = 0.0;
- rString.Insert('0',nPos++);
- }
- if (nIndex == 0)
- fLimit1 = fNumber;
- else
- fLimit2 = fNumber;
- if ( rString.GetChar(nPos) == ']' )
- nPos++;
- else
- {
- bCancel = TRUE; // break for
- nCheckPos = nPos;
- }
- }
- nPosOld = nPos; // position before string
- }
- else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) )
- {
- switch ( eSymbolType )
- {
- case BRACKET_SYMBOLTYPE_COLOR :
- {
- if ( NumFor[nIndex].GetColor() != NULL )
- { // error, more than one color
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- else
- {
- Color* pColor = pSc->GetColor( sStr);
- NumFor[nIndex].SetColor( pColor, sStr);
- if (pColor == NULL)
- { // error
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- }
- }
- break;
- case BRACKET_SYMBOLTYPE_NATNUM0 :
- case BRACKET_SYMBOLTYPE_NATNUM1 :
- case BRACKET_SYMBOLTYPE_NATNUM2 :
- case BRACKET_SYMBOLTYPE_NATNUM3 :
- case BRACKET_SYMBOLTYPE_NATNUM4 :
- case BRACKET_SYMBOLTYPE_NATNUM5 :
- case BRACKET_SYMBOLTYPE_NATNUM6 :
- case BRACKET_SYMBOLTYPE_NATNUM7 :
- case BRACKET_SYMBOLTYPE_NATNUM8 :
- case BRACKET_SYMBOLTYPE_NATNUM9 :
- case BRACKET_SYMBOLTYPE_NATNUM10 :
- case BRACKET_SYMBOLTYPE_NATNUM11 :
- case BRACKET_SYMBOLTYPE_NATNUM12 :
- case BRACKET_SYMBOLTYPE_NATNUM13 :
- case BRACKET_SYMBOLTYPE_NATNUM14 :
- case BRACKET_SYMBOLTYPE_NATNUM15 :
- case BRACKET_SYMBOLTYPE_NATNUM16 :
- case BRACKET_SYMBOLTYPE_NATNUM17 :
- case BRACKET_SYMBOLTYPE_NATNUM18 :
- case BRACKET_SYMBOLTYPE_NATNUM19 :
- {
- if ( NumFor[nIndex].GetNatNum().IsSet() )
- {
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- else
- {
- sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NatNum" ) );
- //! eSymbolType is negative
- BYTE nNum = sal::static_int_cast< BYTE >(0 - (eSymbolType - BRACKET_SYMBOLTYPE_NATNUM0));
- sStr += String::CreateFromInt32( nNum );
- NumFor[nIndex].SetNatNumNum( nNum, FALSE );
- }
- }
- break;
- case BRACKET_SYMBOLTYPE_DBNUM1 :
- case BRACKET_SYMBOLTYPE_DBNUM2 :
- case BRACKET_SYMBOLTYPE_DBNUM3 :
- case BRACKET_SYMBOLTYPE_DBNUM4 :
- case BRACKET_SYMBOLTYPE_DBNUM5 :
- case BRACKET_SYMBOLTYPE_DBNUM6 :
- case BRACKET_SYMBOLTYPE_DBNUM7 :
- case BRACKET_SYMBOLTYPE_DBNUM8 :
- case BRACKET_SYMBOLTYPE_DBNUM9 :
- {
- if ( NumFor[nIndex].GetNatNum().IsSet() )
- {
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- else
- {
- sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DBNum" ) );
- //! eSymbolType is negative
- BYTE nNum = sal::static_int_cast< BYTE >(1 - (eSymbolType - BRACKET_SYMBOLTYPE_DBNUM1));
- sStr += static_cast< sal_Unicode >('0' + nNum);
- NumFor[nIndex].SetNatNumNum( nNum, TRUE );
- }
- }
- break;
- case BRACKET_SYMBOLTYPE_LOCALE :
- {
- if ( NumFor[nIndex].GetNatNum().GetLang() != LANGUAGE_DONTKNOW )
- {
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- else
- {
- xub_StrLen nTmp = 2;
- LanguageType eLang = ImpGetLanguageType( sStr, nTmp );
- if ( eLang == LANGUAGE_DONTKNOW )
- {
- bCancel = TRUE; // break for
- nCheckPos = nPosOld;
- }
- else
- {
- sStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "$-" ) );
- sStr += String::CreateFromInt32( sal_Int32( eLang ), 16 ).ToUpperAscii();
- NumFor[nIndex].SetNatNumLang( eLang );
- }
- }
- }
- break;
- }
- if ( !bCancel )
- {
- rString.Erase(nPosOld,nPos-nPosOld);
- rString.Insert(sStr,nPosOld);
- nPos = nPosOld + sStr.Len();
- rString.Insert(']', nPos);
- rString.Insert('[', nPosOld);
- nPos += 2;
- nPosOld = nPos; // position before string
- }
- }
- } while ( !bCancel && lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) );
-
- // The remaining format code string
- if ( !bCancel )
- {
- if (eSymbolType == BRACKET_SYMBOLTYPE_FORMAT)
- {
- if (nIndex == 1 && eOp1 == NUMBERFORMAT_OP_NO)
- eOp1 = NUMBERFORMAT_OP_GT; // undefined condition, default: > 0
- else if (nIndex == 2 && eOp2 == NUMBERFORMAT_OP_NO)
- eOp2 = NUMBERFORMAT_OP_LT; // undefined condition, default: < 0
- if (sStr.Len() == 0)
- { // empty sub format
- }
- else
- {
- xub_StrLen nStrPos = pSc->ScanFormat( sStr, aComment );
- USHORT nAnz = pSc->GetAnzResStrings();
- if (nAnz == 0) // error
- nStrPos = 1;
- if (nStrPos == 0) // ok
- {
- // e.g. Thai T speciality
- if (pSc->GetNatNumModifier() && !NumFor[nIndex].GetNatNum().IsSet())
- {
- String aNat( RTL_CONSTASCII_USTRINGPARAM( "[NatNum"));
- aNat += String::CreateFromInt32( pSc->GetNatNumModifier());
- aNat += ']';
- sStr.Insert( aNat, 0);
- NumFor[nIndex].SetNatNumNum( pSc->GetNatNumModifier(), FALSE );
- }
- // #i53826# #i42727# For the Thai T speciality we need
- // to freeze the locale and immunize it against
- // conversions during exports, just in case we want to
- // save to Xcl. This disables the feature of being able
- // to convert a NatNum to another locale. You can't
- // have both.
- // FIXME: implement a specialized export conversion
- // that works on tokens (have to tokenize all first)
- // and doesn't use the format string and
- // PutandConvertEntry() to LANGUAGE_ENGLISH_US in
- // sc/source/filter/excel/xestyle.cxx
- // XclExpNumFmtBuffer::WriteFormatRecord().
- LanguageType eLanguage;
- if (NumFor[nIndex].GetNatNum().GetNatNum() == 1 &&
- ((eLanguage =
- MsLangId::getRealLanguage( eLan))
- == LANGUAGE_THAI) &&
- NumFor[nIndex].GetNatNum().GetLang() ==
- LANGUAGE_DONTKNOW)
- {
- String aLID( RTL_CONSTASCII_USTRINGPARAM( "[$-"));
- aLID += String::CreateFromInt32( sal_Int32(
- eLanguage), 16 ).ToUpperAscii();
- aLID += ']';
- sStr.Insert( aLID, 0);
- NumFor[nIndex].SetNatNumLang( eLanguage);
- }
- rString.Erase(nPosOld,nPos-nPosOld);
- rString.Insert(sStr,nPosOld);
- nPos = nPosOld + sStr.Len();
- if (nPos < rString.Len())
- {
- rString.Insert(';',nPos);
- nPos++;
- }
- NumFor[nIndex].Enlarge(nAnz);
- pSc->CopyInfo(&(NumFor[nIndex].Info()), nAnz);
- // type check
- if (nIndex == 0)
- eType = (short) NumFor[nIndex].Info().eScannedType;
- else if (nIndex == 3)
- { // #77026# Everything recognized IS text
- NumFor[nIndex].Info().eScannedType = NUMBERFORMAT_TEXT;
- }
- else if ( (short) NumFor[nIndex].Info().eScannedType !=
- eType)
- eType = NUMBERFORMAT_DEFINED;
- }
- else
- {
- nCheckPos = nPosOld + nStrPos; // error in string
- bCancel = TRUE; // break for
- }
- }
- }
- else if (eSymbolType == BRACKET_SYMBOLTYPE_ERROR) // error
- {
- nCheckPos = nPosOld;
- bCancel = TRUE;
- }
- else if ( lcl_SvNumberformat_IsBracketedPrefix( eSymbolType ) )
- {
- nCheckPos = nPosOld+1; // error, prefix in string
- bCancel = TRUE; // break for
- }
- }
- if ( bCancel && !nCheckPos )
- nCheckPos = 1; // nCheckPos is used as an error condition
- if ( !bCancel )
- {
- if ( NumFor[nIndex].GetNatNum().IsSet() &&
- NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW )
- NumFor[nIndex].SetNatNumLang( eLan );
- }
- if (rString.Len() == nPos)
- {
- if ( nIndex == 2 && eSymbolType == BRACKET_SYMBOLTYPE_FORMAT &&
- rString.GetChar(nPos-1) == ';' )
- { // #83510# A 4th subformat explicitly specified to be empty
- // hides any text. Need the type here for HasTextFormat()
- NumFor[3].Info().eScannedType = NUMBERFORMAT_TEXT;
- }
- bCancel = TRUE;
- }
- if ( NumFor[nIndex].GetNatNum().IsSet() )
- NumFor[nIndex].SetNatNumDate(
- (NumFor[nIndex].Info().eScannedType & NUMBERFORMAT_DATE) != 0 );
- }
-
- if ( bCondition && !nCheckPos )
- {
- if ( nIndex == 1 && NumFor[0].GetnAnz() == 0 &&
- rString.GetChar(rString.Len()-1) != ';' )
- { // No format code => GENERAL but not if specified empty
- String aAdd( pSc->GetStandardName() );
- String aTmp;
- if ( !pSc->ScanFormat( aAdd, aTmp ) )
- {
- USHORT nAnz = pSc->GetAnzResStrings();
- if ( nAnz )
- {
- NumFor[0].Enlarge(nAnz);
- pSc->CopyInfo( &(NumFor[0].Info()), nAnz );
- rString += aAdd;
- }
- }
- }
- else if ( nIndex == 1 && NumFor[nIndex].GetnAnz() == 0 &&
- rString.GetChar(rString.Len()-1) != ';' &&
- (NumFor[0].GetnAnz() > 1 || (NumFor[0].GetnAnz() == 1 &&
- NumFor[0].Info().nTypeArray[0] != NF_KEY_GENERAL)) )
- { // No trailing second subformat => GENERAL but not if specified empty
- // and not if first subformat is GENERAL
- String aAdd( pSc->GetStandardName() );
- String aTmp;
- if ( !pSc->ScanFormat( aAdd, aTmp ) )
- {
- USHORT nAnz = pSc->GetAnzResStrings();
- if ( nAnz )
- {
- NumFor[nIndex].Enlarge(nAnz);
- pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz );
- rString += ';';
- rString += aAdd;
- }
- }
- }
- else if ( nIndex == 2 && NumFor[nIndex].GetnAnz() == 0 &&
- rString.GetChar(rString.Len()-1) != ';' &&
- eOp2 != NUMBERFORMAT_OP_NO )
- { // No trailing third subformat => GENERAL but not if specified empty
- String aAdd( pSc->GetStandardName() );
- String aTmp;
- if ( !pSc->ScanFormat( aAdd, aTmp ) )
- {
- USHORT nAnz = pSc->GetAnzResStrings();
- if ( nAnz )
- {
- NumFor[nIndex].Enlarge(nAnz);
- pSc->CopyInfo( &(NumFor[nIndex].Info()), nAnz );
- rString += ';';
- rString += aAdd;
- }
- }
- }
- }
- sFormatstring = rString;
- if ( aComment.Len() )
- {
- SetComment( aComment ); // setzt sComment und sFormatstring
- rString = sFormatstring; // geaenderten sFormatstring uebernehmen
- }
- if (NumFor[2].GetnAnz() == 0 && // kein 3. Teilstring
- eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_NO &&
- fLimit1 == 0.0 && fLimit2 == 0.0)
- eOp1 = NUMBERFORMAT_OP_GE; // 0 zum ersten Format dazu
-
-}
-
-SvNumberformat::~SvNumberformat()
-{
-}
-
-//---------------------------------------------------------------------------
-// Next_Symbol
-//---------------------------------------------------------------------------
-// Zerlegt die Eingabe in Symbole fuer die weitere
-// Verarbeitung (Turing-Maschine).
-//---------------------------------------------------------------------------
-// Ausgangs Zustand = SsStart
-//---------------+-------------------+-----------------------+---------------
-// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand
-//---------------+-------------------+-----------------------+---------------
-// SsStart | ; | Pos-- | SsGetString
-// | [ | Symbol += Zeichen | SsGetBracketed
-// | ] | Fehler | SsStop
-// | BLANK | |
-// | Sonst | Symbol += Zeichen | SsGetString
-//---------------+-------------------+-----------------------+---------------
-// SsGetString | ; | | SsStop
-// | Sonst | Symbol+=Zeichen |
-//---------------+-------------------+-----------------------+---------------
-// SsGetBracketed| <, > = | del [ |
-// | | Symbol += Zeichen | SsGetCon
-// | BLANK | |
-// | h, H, m, M, s, S | Symbol += Zeichen | SsGetTime
-// | sonst | del [ |
-// | | Symbol += Zeichen | SsGetPrefix
-//---------------+-------------------+-----------------------+---------------
-// SsGetTime | ] | Symbol += Zeichen | SsGetString
-// | h, H, m, M, s, S | Symbol += Zeichen, * | SsGetString
-// | sonst | del [; Symbol+=Zeichen| SsGetPrefix
-//---------------+-------------------+-----------------------+---------------
-// SsGetPrefix | ] | | SsStop
-// | sonst | Symbol += Zeichen |
-//---------------+-------------------+-----------------------+---------------
-// SsGetCon | >, = | Symbol+=Zeichen |
-// | ] | | SsStop
-// | sonst | Fehler | SsStop
-//---------------+-------------------+-----------------------+---------------
-// * : Sonderbedingung
-
-enum ScanState
-{
- SsStop,
- SsStart,
- SsGetCon, // condition
- SsGetString, // format string
- SsGetPrefix, // color or NatNumN
- SsGetTime, // [HH] for time
- SsGetBracketed // any [...] not decided yet
-};
-
-
-// read a string until ']' and delete spaces in input
-// static
-xub_StrLen SvNumberformat::ImpGetNumber(String& rString,
- xub_StrLen& nPos,
- String& sSymbol)
-{
- xub_StrLen nStartPos = nPos;
- sal_Unicode cToken;
- xub_StrLen nLen = rString.Len();
- sSymbol.Erase();
- while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') )
- {
- if (cToken == ' ')
- { // delete spaces
- rString.Erase(nPos,1);
- nLen--;
- }
- else
- {
- nPos++;
- sSymbol += cToken;
- }
- }
- return nPos - nStartPos;
-}
-
-
-// static
-LanguageType SvNumberformat::ImpGetLanguageType( const String& rString,
- xub_StrLen& nPos )
-{
- sal_Int32 nNum = 0;
- sal_Unicode cToken = 0;
- xub_StrLen nLen = rString.Len();
- while ( nPos < nLen && ((cToken = rString.GetChar(nPos)) != ']') )
- {
- if ( '0' <= cToken && cToken <= '9' )
- {
- nNum *= 16;
- nNum += cToken - '0';
- }
- else if ( 'a' <= cToken && cToken <= 'f' )
- {
- nNum *= 16;
- nNum += cToken - 'a' + 10;
- }
- else if ( 'A' <= cToken && cToken <= 'F' )
- {
- nNum *= 16;
- nNum += cToken - 'A' + 10;
- }
- else
- return LANGUAGE_DONTKNOW;
- ++nPos;
- }
- return (nNum && (cToken == ']' || nPos == nLen)) ? (LanguageType)nNum :
- LANGUAGE_DONTKNOW;
-}
-
-
-short SvNumberformat::ImpNextSymbol(String& rString,
- xub_StrLen& nPos,
- String& sSymbol)
-{
- short eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
- sal_Unicode cToken;
- sal_Unicode cLetter = ' '; // Zwischenergebnis
- xub_StrLen nLen = rString.Len();
- ScanState eState = SsStart;
- sSymbol.Erase();
- const String* pKeywords = rScan.GetKeywords();
- while (nPos < nLen && eState != SsStop)
- {
- cToken = rString.GetChar(nPos);
- nPos++;
- switch (eState)
- {
- case SsStart:
- {
- if (cToken == '[')
- {
- eState = SsGetBracketed;
- sSymbol += cToken;
- }
- else if (cToken == ';')
- {
- eState = SsGetString;
- nPos--;
- eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
- }
- else if (cToken == ']')
- {
- eState = SsStop;
- eSymbolType = BRACKET_SYMBOLTYPE_ERROR;
- }
- else if (cToken == ' ') // Skip Blanks
- {
- rString.Erase(nPos-1,1);
- nPos--;
- nLen--;
- }
- else
- {
- sSymbol += cToken;
- eState = SsGetString;
- eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
- }
- }
- break;
- case SsGetBracketed:
- {
- switch (cToken)
- {
- case '<':
- case '>':
- case '=':
- {
- sSymbol.EraseAllChars('[');
- sSymbol += cToken;
- cLetter = cToken;
- eState = SsGetCon;
- switch (cToken)
- {
- case '<': eSymbolType = NUMBERFORMAT_OP_LT; break;
- case '>': eSymbolType = NUMBERFORMAT_OP_GT; break;
- case '=': eSymbolType = NUMBERFORMAT_OP_EQ; break;
- default: break;
- }
- }
- break;
- case ' ':
- {
- rString.Erase(nPos-1,1);
- nPos--;
- nLen--;
- }
- break;
- case '$' :
- {
- if ( rString.GetChar(nPos) == '-' )
- { // [$-xxx] locale
- sSymbol.EraseAllChars('[');
- eSymbolType = BRACKET_SYMBOLTYPE_LOCALE;
- eState = SsGetPrefix;
- }
- else
- { // currency as of SV_NUMBERFORMATTER_VERSION_NEW_CURR
- eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
- eState = SsGetString;
- }
- sSymbol += cToken;
- }
- break;
- case '~' :
- { // calendarID as of SV_NUMBERFORMATTER_VERSION_CALENDAR
- eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
- sSymbol += cToken;
- eState = SsGetString;
- }
- break;
- default:
- {
- static const String aNatNum( RTL_CONSTASCII_USTRINGPARAM( "NATNUM" ) );
- static const String aDBNum( RTL_CONSTASCII_USTRINGPARAM( "DBNUM" ) );
- String aUpperNatNum( rChrCls().toUpper( rString, nPos-1, aNatNum.Len() ) );
- String aUpperDBNum( rChrCls().toUpper( rString, nPos-1, aDBNum.Len() ) );
- sal_Unicode cUpper = aUpperNatNum.GetChar(0);
- sal_Int32 nNatNumNum = rString.Copy( nPos-1+aNatNum.Len() ).ToInt32();
- sal_Unicode cDBNum = rString.GetChar( nPos-1+aDBNum.Len() );
- if ( aUpperNatNum == aNatNum && 0 <= nNatNumNum && nNatNumNum <= 19 )
- {
- sSymbol.EraseAllChars('[');
- sSymbol += rString.Copy( --nPos, aNatNum.Len()+1 );
- nPos += aNatNum.Len()+1;
- //! SymbolType is negative
- eSymbolType = (short) (BRACKET_SYMBOLTYPE_NATNUM0 - nNatNumNum);
- eState = SsGetPrefix;
- }
- else if ( aUpperDBNum == aDBNum && '1' <= cDBNum && cDBNum <= '9' )
- {
- sSymbol.EraseAllChars('[');
- sSymbol += rString.Copy( --nPos, aDBNum.Len()+1 );
- nPos += aDBNum.Len()+1;
- //! SymbolType is negative
- eSymbolType = sal::static_int_cast< short >(
- BRACKET_SYMBOLTYPE_DBNUM1 - (cDBNum - '1'));
- eState = SsGetPrefix;
- }
- else if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H
- cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M
- cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S
- {
- sSymbol += cToken;
- eState = SsGetTime;
- cLetter = cToken;
- }
- else
- {
- sSymbol.EraseAllChars('[');
- sSymbol += cToken;
- eSymbolType = BRACKET_SYMBOLTYPE_COLOR;
- eState = SsGetPrefix;
- }
- }
- break;
- }
- }
- break;
- case SsGetString:
- {
- if (cToken == ';')
- eState = SsStop;
- else
- sSymbol += cToken;
- }
- break;
- case SsGetTime:
- {
- if (cToken == ']')
- {
- sSymbol += cToken;
- eState = SsGetString;
- eSymbolType = BRACKET_SYMBOLTYPE_FORMAT;
- }
- else
- {
- sal_Unicode cUpper = rChrCls().toUpper( rString, nPos-1, 1 ).GetChar(0);
- if (cUpper == pKeywords[NF_KEY_H].GetChar(0) || // H
- cUpper == pKeywords[NF_KEY_MI].GetChar(0) || // M
- cUpper == pKeywords[NF_KEY_S].GetChar(0) ) // S
- {
- if (cLetter == cToken)
- {
- sSymbol += cToken;
- cLetter = ' ';
- }
- else
- {
- sSymbol.EraseAllChars('[');
- sSymbol += cToken;
- eState = SsGetPrefix;
- }
- }
- else
- {
- sSymbol.EraseAllChars('[');
- sSymbol += cToken;
- eSymbolType = BRACKET_SYMBOLTYPE_COLOR;
- eState = SsGetPrefix;
- }
- }
- }
- break;
- case SsGetCon:
- {
- switch (cToken)
- {
- case '<':
- {
- eState = SsStop;
- eSymbolType = BRACKET_SYMBOLTYPE_ERROR;
- }
- break;
- case '>':
- {
- if (cLetter == '<')
- {
- sSymbol += cToken;
- cLetter = ' ';
- eState = SsStop;
- eSymbolType = NUMBERFORMAT_OP_NE;
- }
- else
- {
- eState = SsStop;
- eSymbolType = BRACKET_SYMBOLTYPE_ERROR;
- }
- }
- break;
- case '=':
- {
- if (cLetter == '<')
- {
- sSymbol += cToken;
- cLetter = ' ';
- eSymbolType = NUMBERFORMAT_OP_LE;
- }
- else if (cLetter == '>')
- {
- sSymbol += cToken;
- cLetter = ' ';
- eSymbolType = NUMBERFORMAT_OP_GE;
- }
- else
- {
- eState = SsStop;
- eSymbolType = BRACKET_SYMBOLTYPE_ERROR;
- }
- }
- break;
- case ' ':
- {
- rString.Erase(nPos-1,1);
- nPos--;
- nLen--;
- }
- break;
- default:
- {
- eState = SsStop;
- nPos--;
- }
- break;
- }
- }
- break;
- case SsGetPrefix:
- {
- if (cToken == ']')
- eState = SsStop;
- else
- sSymbol += cToken;
- }
- break;
- default:
- break;
- } // of switch
- } // of while
-
- return eSymbolType;
-}
-
-NfHackConversion SvNumberformat::Load( SvStream& rStream,
- ImpSvNumMultipleReadHeader& rHdr, SvNumberFormatter* pHackConverter,
- ImpSvNumberInputScan& rISc )
-{
- rHdr.StartEntry();
- USHORT nOp1, nOp2;
- SvNumberformat::LoadString( rStream, sFormatstring );
- rStream >> eType >> fLimit1 >> fLimit2
- >> nOp1 >> nOp2 >> bStandard >> bIsUsed;
- NfHackConversion eHackConversion = NF_CONVERT_NONE;
- BOOL bOldConvert = FALSE;
- LanguageType eOldTmpLang = 0;
- LanguageType eOldNewLang = 0;
- if ( pHackConverter )
- { // werden nur hierbei gebraucht
- bOldConvert = rScan.GetConvertMode();
- eOldTmpLang = rScan.GetTmpLnge();
- eOldNewLang = rScan.GetNewLnge();
- }
- String aLoadedColorName;
- for (USHORT i = 0; i < 4; i++)
- {
- NumFor[i].Load( rStream, rScan, aLoadedColorName );
- if ( pHackConverter && eHackConversion == NF_CONVERT_NONE )
- {
- //! HACK! ER 29.07.97 13:52
- // leider wurde nicht gespeichert, was SYSTEM on Save wirklich war :-/
- // aber immerhin wird manchmal fuer einen Entry FARBE oder COLOR gespeichert..
- // System-German FARBE nach System-xxx COLOR umsetzen und vice versa,
- //! geht davon aus, dass onSave nur GERMAN und ENGLISH KeyWords in
- //! ImpSvNumberformatScan existierten
- if ( aLoadedColorName.Len() && !NumFor[i].GetColor()
- && aLoadedColorName != rScan.GetColorString() )
- {
- if ( rScan.GetColorString().EqualsAscii( "FARBE" ) )
- { // English -> German
- eHackConversion = NF_CONVERT_ENGLISH_GERMAN;
- rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_ENGLISH_US );
- rScan.SetConvertMode( LANGUAGE_ENGLISH_US, LANGUAGE_GERMAN );
- }
- else
- { // German -> English
- eHackConversion = NF_CONVERT_GERMAN_ENGLISH;
- rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_GERMAN );
- rScan.SetConvertMode( LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US );
- }
- String aColorName = NumFor[i].GetColorName();
- const Color* pColor = rScan.GetColor( aColorName );
- if ( !pColor && aLoadedColorName == aColorName )
- eHackConversion = NF_CONVERT_NONE;
- rScan.GetNumberformatter()->ChangeIntl( LANGUAGE_SYSTEM );
- rScan.SetConvertMode( eOldTmpLang, eOldNewLang );
- rScan.SetConvertMode( bOldConvert );
- }
- }
- }
- eOp1 = (SvNumberformatLimitOps) nOp1;
- eOp2 = (SvNumberformatLimitOps) nOp2;
- String aComment; // wird nach dem NewCurrency-Geraffel richtig gesetzt
- if ( rHdr.BytesLeft() )
- { // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD
- SvNumberformat::LoadString( rStream, aComment );
- rStream >> nNewStandardDefined;
- }
-
- xub_StrLen nNewCurrencyEnd = STRING_NOTFOUND;
- BOOL bNewCurrencyComment = ( aComment.GetChar(0) == cNewCurrencyMagic &&
- (nNewCurrencyEnd = aComment.Search( cNewCurrencyMagic, 1 )) != STRING_NOTFOUND );
- BOOL bNewCurrencyLoaded = FALSE;
- BOOL bNewCurrency = FALSE;
-
- BOOL bGoOn = TRUE;
- while ( rHdr.BytesLeft() && bGoOn )
- { // as of SV_NUMBERFORMATTER_VERSION_NEW_CURR
- USHORT nId;
- rStream >> nId;
- switch ( nId )
- {
- case nNewCurrencyVersionId :
- {
- bNewCurrencyLoaded = TRUE;
- rStream >> bNewCurrency;
- if ( bNewCurrency )
- {
- for ( USHORT j=0; j<4; j++ )
- {
- NumFor[j].LoadNewCurrencyMap( rStream );
- }
- }
- }
- break;
- case nNewStandardFlagVersionId :
- rStream >> bStandard; // the real standard flag
- break;
- default:
- DBG_ERRORFILE( "SvNumberformat::Load: unknown header bytes left nId" );
- bGoOn = FALSE; // stop reading unknown stream left over of newer versions
- // Would be nice to have multiple read/write headers instead
- // but old versions wouldn't know it, TLOT.
- }
- }
- rHdr.EndEntry();
-
- if ( bNewCurrencyLoaded )
- {
- if ( bNewCurrency && bNewCurrencyComment )
- { // original Formatstring und Kommentar wiederherstellen
- sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 );
- aComment.Erase( 0, nNewCurrencyEnd+1 );
- }
- }
- else if ( bNewCurrencyComment )
- { // neu, aber mit Version vor SV_NUMBERFORMATTER_VERSION_NEW_CURR gespeichert
- // original Formatstring und Kommentar wiederherstellen
- sFormatstring = aComment.Copy( 1, nNewCurrencyEnd-1 );
- aComment.Erase( 0, nNewCurrencyEnd+1 );
- // Zustaende merken
- short nDefined = ( eType & NUMBERFORMAT_DEFINED );
- USHORT nNewStandard = nNewStandardDefined;
- // neu parsen etc.
- String aStr( sFormatstring );
- xub_StrLen nCheckPos = 0;
- SvNumberformat* pFormat = new SvNumberformat( aStr, &rScan, &rISc,
- nCheckPos, eLnge, bStandard );
- DBG_ASSERT( !nCheckPos, "SvNumberformat::Load: NewCurrencyRescan nCheckPos" );
- ImpCopyNumberformat( *pFormat );
- delete pFormat;
- // Zustaende wiederherstellen
- eType |= nDefined;
- if ( nNewStandard )
- SetNewStandardDefined( nNewStandard );
- }
- SetComment( aComment );
-
- if ( eHackConversion != NF_CONVERT_NONE )
- { //! und weiter mit dem HACK!
- switch ( eHackConversion )
- {
- case NF_CONVERT_ENGLISH_GERMAN :
- ConvertLanguage( *pHackConverter,
- LANGUAGE_ENGLISH_US, LANGUAGE_GERMAN, TRUE );
- break;
- case NF_CONVERT_GERMAN_ENGLISH :
- ConvertLanguage( *pHackConverter,
- LANGUAGE_GERMAN, LANGUAGE_ENGLISH_US, TRUE );
- break;
- default:
- DBG_ERRORFILE( "SvNumberformat::Load: eHackConversion unknown" );
- }
- }
- return eHackConversion;
-}
-
-void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter,
- LanguageType eConvertFrom, LanguageType eConvertTo, BOOL bSystem )
-{
- xub_StrLen nCheckPos;
- sal_uInt32 nKey;
- short nType = eType;
- String aFormatString( sFormatstring );
- if ( bSystem )
- rConverter.PutandConvertEntrySystem( aFormatString, nCheckPos, nType,
- nKey, eConvertFrom, eConvertTo );
- else
- rConverter.PutandConvertEntry( aFormatString, nCheckPos, nType,
- nKey, eConvertFrom, eConvertTo );
- const SvNumberformat* pFormat = rConverter.GetEntry( nKey );
- DBG_ASSERT( pFormat, "SvNumberformat::ConvertLanguage: Conversion ohne Format" );
- if ( pFormat )
- {
- ImpCopyNumberformat( *pFormat );
- // aus Formatter/Scanner uebernommene Werte zuruecksetzen
- if ( bSystem )
- eLnge = LANGUAGE_SYSTEM;
- // pColor zeigt noch auf Tabelle in temporaerem Formatter/Scanner
- for ( USHORT i = 0; i < 4; i++ )
- {
- String aColorName = NumFor[i].GetColorName();
- Color* pColor = rScan.GetColor( aColorName );
- NumFor[i].SetColor( pColor, aColorName );
- }
- }
-}
-
-
-// static
-void SvNumberformat::LoadString( SvStream& rStream, String& rStr )
-{
- CharSet eStream = rStream.GetStreamCharSet();
- ByteString aStr;
- rStream.ReadByteString( aStr );
- sal_Char cStream = NfCurrencyEntry::GetEuroSymbol( eStream );
- if ( aStr.Search( cStream ) == STRING_NOTFOUND )
- { // simple conversion to unicode
- rStr = UniString( aStr, eStream );
- }
- else
- {
- sal_Unicode cTarget = NfCurrencyEntry::GetEuroSymbol();
- register const sal_Char* p = aStr.GetBuffer();
- register const sal_Char* const pEnd = p + aStr.Len();
- register sal_Unicode* pUni = rStr.AllocBuffer( aStr.Len() );
- while ( p < pEnd )
- {
- if ( *p == cStream )
- *pUni = cTarget;
- else
- *pUni = ByteString::ConvertToUnicode( *p, eStream );
- p++;
- pUni++;
- }
- *pUni = 0;
- }
-}
-
-
-void SvNumberformat::Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr ) const
-{
- String aFormatstring( sFormatstring );
- String aComment( sComment );
-#if NF_COMMENT_IN_FORMATSTRING
- // der Kommentar im Formatstring wird nicht gespeichert, um in alten Versionen
- // nicht ins schleudern zu kommen und spaeter getrennte Verarbeitung
- // (z.B. im Dialog) zu ermoeglichen
- SetComment( "", aFormatstring, aComment );
-#endif
-
- BOOL bNewCurrency = HasNewCurrency();
- if ( bNewCurrency )
- { // SV_NUMBERFORMATTER_VERSION_NEW_CURR im Kommentar speichern
- aComment.Insert( cNewCurrencyMagic, 0 );
- aComment.Insert( cNewCurrencyMagic, 0 );
- aComment.Insert( aFormatstring, 1 );
- Build50Formatstring( aFormatstring ); // alten Formatstring generieren
- }
-
- // old SO5 versions do behave strange (no output) if standard flag is set
- // on formats not prepared for it (not having the following exact types)
- BOOL bOldStandard = bStandard;
- if ( bOldStandard )
- {
- switch ( eType )
- {
- case NUMBERFORMAT_NUMBER :
- case NUMBERFORMAT_DATE :
- case NUMBERFORMAT_TIME :
- case NUMBERFORMAT_DATETIME :
- case NUMBERFORMAT_PERCENT :
- case NUMBERFORMAT_SCIENTIFIC :
- // ok to save
- break;
- default:
- bOldStandard = FALSE;
- }
- }
-
- rHdr.StartEntry();
- rStream.WriteByteString( aFormatstring, rStream.GetStreamCharSet() );
- rStream << eType << fLimit1 << fLimit2 << (USHORT) eOp1 << (USHORT) eOp2
- << bOldStandard << bIsUsed;
- for (USHORT i = 0; i < 4; i++)
- NumFor[i].Save(rStream);
- // ab SV_NUMBERFORMATTER_VERSION_NEWSTANDARD
- rStream.WriteByteString( aComment, rStream.GetStreamCharSet() );
- rStream << nNewStandardDefined;
- // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR
- rStream << nNewCurrencyVersionId;
- rStream << bNewCurrency;
- if ( bNewCurrency )
- {
- for ( USHORT j=0; j<4; j++ )
- {
- NumFor[j].SaveNewCurrencyMap( rStream );
- }
- }
-
- // the real standard flag to load with versions >638 if different
- if ( bStandard != bOldStandard )
- {
- rStream << nNewStandardFlagVersionId;
- rStream << bStandard;
- }
-
- rHdr.EndEntry();
-}
-
-
-BOOL SvNumberformat::HasNewCurrency() const
-{
- for ( USHORT j=0; j<4; j++ )
- {
- if ( NumFor[j].HasNewCurrency() )
- return TRUE;
- }
- return FALSE;
-}
-
-
-BOOL SvNumberformat::GetNewCurrencySymbol( String& rSymbol,
- String& rExtension ) const
-{
- for ( USHORT j=0; j<4; j++ )
- {
- if ( NumFor[j].GetNewCurrencySymbol( rSymbol, rExtension ) )
- return TRUE;
- }
- rSymbol.Erase();
- rExtension.Erase();
- return FALSE;
-}
-
-
-// static
-String SvNumberformat::StripNewCurrencyDelimiters( const String& rStr,
- BOOL bQuoteSymbol )
-{
- String aTmp;
- xub_StrLen nStartPos, nPos, nLen;
- nLen = rStr.Len();
- nStartPos = 0;
- while ( (nPos = rStr.SearchAscii( "[$", nStartPos )) != STRING_NOTFOUND )
- {
- xub_StrLen nEnd;
- if ( (nEnd = GetQuoteEnd( rStr, nPos )) < nLen )
- {
- aTmp += rStr.Copy( nStartPos, ++nEnd - nStartPos );
- nStartPos = nEnd;
- }
- else
- {
- aTmp += rStr.Copy( nStartPos, nPos - nStartPos );
- nStartPos = nPos + 2;
- xub_StrLen nDash;
- nEnd = nStartPos - 1;
- do
- {
- nDash = rStr.Search( '-', ++nEnd );
- } while ( (nEnd = GetQuoteEnd( rStr, nDash )) < nLen );
- xub_StrLen nClose;
- nEnd = nStartPos - 1;
- do
- {
- nClose = rStr.Search( ']', ++nEnd );
- } while ( (nEnd = GetQuoteEnd( rStr, nClose )) < nLen );
- nPos = ( nDash < nClose ? nDash : nClose );
- if ( !bQuoteSymbol || rStr.GetChar( nStartPos ) == '"' )
- aTmp += rStr.Copy( nStartPos, nPos - nStartPos );
- else
- {
- aTmp += '"';
- aTmp += rStr.Copy( nStartPos, nPos - nStartPos );
- aTmp += '"';
- }
- nStartPos = nClose + 1;
- }
- }
- if ( nLen > nStartPos )
- aTmp += rStr.Copy( nStartPos, nLen - nStartPos );
- return aTmp;
-}
-
-
-void SvNumberformat::Build50Formatstring( String& rStr ) const
-{
- rStr = StripNewCurrencyDelimiters( sFormatstring, TRUE );
-}
-
-
-void SvNumberformat::ImpGetOutputStandard(double& fNumber, String& OutString)
-{
- USHORT nStandardPrec = rScan.GetStandardPrec();
- if ( fabs(fNumber) > 1.0E15 ) // #58531# war E16
- OutString = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_E, nStandardPrec /*2*/,
- GetFormatter().GetNumDecimalSep().GetChar(0));
- else
- {
-#if 0
-{
- // debugger test case for ANSI standard correctness
- ::rtl::OUString aTest;
- // expect 0.00123 OK
- aTest = ::rtl::math::doubleToUString( 0.001234567,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect 123 OK
- aTest = ::rtl::math::doubleToUString( 123.4567,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect 123.5 OK
- aTest = ::rtl::math::doubleToUString( 123.4567,
- rtl_math_StringFormat_G, 4, '.', sal_True );
- // expect 1e+03 (as 999.6 rounded to 3 significant digits results in
- // 1000 with an exponent equal to significant digits)
- // Currently (24-Jan-2003) we do fail in this case and output 1000
- // instead, negligible.
- aTest = ::rtl::math::doubleToUString( 999.6,
- rtl_math_StringFormat_G, 3, '.', sal_True );
- // expect what? result is 1.2e+004
- aTest = ::rtl::math::doubleToUString( 12345.6789,
- rtl_math_StringFormat_G, -3, '.', sal_True );
-}
-#endif
-
- OutString = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_F, nStandardPrec /*2*/,
- GetFormatter().GetNumDecimalSep().GetChar(0), sal_True );
- if (OutString.GetChar(0) == '-' &&
- OutString.GetTokenCount('0') == OutString.Len())
- OutString.EraseLeadingChars('-'); // nicht -0
- }
- ImpTransliterate( OutString, NumFor[0].GetNatNum() );
- return;
-}
-
-void SvNumberformat::ImpGetOutputInputLine(double fNumber, String& OutString)
-{
- BOOL bModified = FALSE;
- if ( (eType & NUMBERFORMAT_PERCENT) && (fabs(fNumber) < _D_MAX_D_BY_100))
- {
- if (fNumber == 0.0)
- {
- OutString.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "0%" ) );
- return;
- }
- fNumber *= 100;
- bModified = TRUE;
- }
-
- if (fNumber == 0.0)
- {
- OutString = '0';
- return;
- }
-
- OutString = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- GetFormatter().GetNumDecimalSep().GetChar(0), sal_True );
-
- if ( eType & NUMBERFORMAT_PERCENT && bModified)
- OutString += '%';
- return;
-}
-
-short SvNumberformat::ImpCheckCondition(double& fNumber,
- double& fLimit,
- SvNumberformatLimitOps eOp)
-{
- switch(eOp)
- {
- case NUMBERFORMAT_OP_NO: return -1;
- case NUMBERFORMAT_OP_EQ: return (short) (fNumber == fLimit);
- case NUMBERFORMAT_OP_NE: return (short) (fNumber != fLimit);
- case NUMBERFORMAT_OP_LT: return (short) (fNumber < fLimit);
- case NUMBERFORMAT_OP_LE: return (short) (fNumber <= fLimit);
- case NUMBERFORMAT_OP_GT: return (short) (fNumber > fLimit);
- case NUMBERFORMAT_OP_GE: return (short) (fNumber >= fLimit);
- default: return -1;
- }
-}
-
-BOOL SvNumberformat::GetOutputString(String& sString,
- String& OutString,
- Color** ppColor)
-{
- OutString.Erase();
- USHORT nIx;
- if (eType & NUMBERFORMAT_TEXT)
- nIx = 0;
- else if (NumFor[3].GetnAnz() > 0)
- nIx = 3;
- else
- {
- *ppColor = NULL; // no change of color
- return FALSE;
- }
- *ppColor = NumFor[nIx].GetColor();
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- if (rInfo.eScannedType == NUMBERFORMAT_TEXT)
- {
- BOOL bRes = FALSE;
- const USHORT nAnz = NumFor[nIx].GetnAnz();
- for (USHORT i = 0; i < nAnz; i++)
- {
- switch (rInfo.nTypeArray[i])
- {
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- OutString += (sal_Unicode) 0x1B;
- OutString += rInfo.sStrArray[i].GetChar(1);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- InsertBlanks( OutString, OutString.Len(),
- rInfo.sStrArray[i].GetChar(1) );
- break;
- case NF_KEY_GENERAL : // #77026# "General" is the same as "@"
- case NF_SYMBOLTYPE_DEL :
- OutString += sString;
- break;
- default:
- OutString += rInfo.sStrArray[i];
- }
- }
- return bRes;
- }
- return FALSE;
-}
-/*
-void SvNumberformat::GetNextFareyNumber(ULONG nPrec, ULONG x0, ULONG x1,
- ULONG y0, ULONG y1,
- ULONG& x2,ULONG& y2)
-{
- x2 = ((y0+nPrec)/y1)*x1 - x0;
- y2 = ((y0+nPrec)/y1)*y1 - y0;
-}
-*/
-ULONG SvNumberformat::ImpGGT(ULONG x, ULONG y)
-{
- if (y == 0)
- return x;
- else
- {
- ULONG z = x%y;
- while (z)
- {
- x = y;
- y = z;
- z = x%y;
- }
- return y;
- }
-}
-
-ULONG SvNumberformat::ImpGGTRound(ULONG x, ULONG y)
-{
- if (y == 0)
- return x;
- else
- {
- ULONG z = x%y;
- while ((double)z/(double)y > D_EPS)
- {
- x = y;
- y = z;
- z = x%y;
- }
- return y;
- }
-}
-
-BOOL SvNumberformat::GetOutputString(double fNumber,
- String& OutString,
- Color** ppColor)
-{
- BOOL bRes = FALSE;
- OutString.Erase(); // alles loeschen
- *ppColor = NULL; // keine Farbaenderung
- if (eType & NUMBERFORMAT_LOGICAL)
- {
- if (fNumber)
- OutString = rScan.GetTrueString();
- else
- OutString = rScan.GetFalseString();
- return FALSE;
- }
- if (eType & NUMBERFORMAT_TEXT && bStandard)
- {
- ImpGetOutputStandard(fNumber, OutString);
- return FALSE;
- }
- BOOL bHadStandard = FALSE;
- if (bStandard) // einzelne Standardformate
- {
- if (rScan.GetStandardPrec() == 300) // alle Zahlformate InputLine
- {
- ImpGetOutputInputLine(fNumber, OutString);
- return FALSE;
- }
- switch (eType)
- {
- case NUMBERFORMAT_NUMBER: // Standardzahlformat
- ImpGetOutputStandard(fNumber, OutString);
- bHadStandard = TRUE;
- break;
- case NUMBERFORMAT_DATE:
- bRes |= ImpGetDateOutput(fNumber, 0, OutString);
- bHadStandard = TRUE;
- break;
- case NUMBERFORMAT_TIME:
- bRes |= ImpGetTimeOutput(fNumber, 0, OutString);
- bHadStandard = TRUE;
- break;
- case NUMBERFORMAT_DATETIME:
- bRes |= ImpGetDateTimeOutput(fNumber, 0, OutString);
- bHadStandard = TRUE;
- break;
- }
- }
- if ( !bHadStandard )
- {
- USHORT nIx; // Index des Teilformats
- short nCheck = ImpCheckCondition(fNumber, fLimit1, eOp1);
- if (nCheck == -1 || nCheck == 1) // nur 1 String oder True
- nIx = 0;
- else
- {
- nCheck = ImpCheckCondition(fNumber, fLimit2, eOp2);
- if (nCheck == -1 || nCheck == 1)
- nIx = 1;
- else
- nIx = 2;
- }
- if (nIx == 1 && fNumber < 0.0 && // negatives Format
- IsNegativeRealNegative() ) // ohne Vorzeichen
- fNumber = -fNumber; // Vorzeichen eliminieren
- *ppColor = NumFor[nIx].GetColor();
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- const USHORT nAnz = NumFor[nIx].GetnAnz();
- if (nAnz == 0 && rInfo.eScannedType == NUMBERFORMAT_UNDEFINED)
- return FALSE; // leer => nichts
- else if (nAnz == 0) // sonst Standard-Format
- {
- ImpGetOutputStandard(fNumber, OutString);
- return FALSE;
- }
- switch (rInfo.eScannedType)
- {
- case NUMBERFORMAT_TEXT:
- case NUMBERFORMAT_DEFINED:
- {
- for (USHORT i = 0; i < nAnz; i++)
- {
- switch (rInfo.nTypeArray[i])
- {
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- OutString += (sal_Unicode) 0x1B;
- OutString += rInfo.sStrArray[i].GetChar(1);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- InsertBlanks( OutString, OutString.Len(),
- rInfo.sStrArray[i].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- OutString += rInfo.sStrArray[i];
- break;
- case NF_SYMBOLTYPE_THSEP:
- if (rInfo.nThousand == 0)
- OutString += rInfo.sStrArray[i];
- break;
- default:
- break;
- }
- }
- }
- break;
- case NUMBERFORMAT_DATE:
- bRes |= ImpGetDateOutput(fNumber, nIx, OutString);
- break;
- case NUMBERFORMAT_TIME:
- bRes |= ImpGetTimeOutput(fNumber, nIx, OutString);
- break;
- case NUMBERFORMAT_DATETIME:
- bRes |= ImpGetDateTimeOutput(fNumber, nIx, OutString);
- break;
- case NUMBERFORMAT_NUMBER:
- case NUMBERFORMAT_PERCENT:
- case NUMBERFORMAT_CURRENCY:
- bRes |= ImpGetNumberOutput(fNumber, nIx, OutString);
- break;
- case NUMBERFORMAT_FRACTION:
- {
- String sStr, sFrac, sDiv; // Strings, Wert fuer
- ULONG nFrac, nDiv; // Vorkommaanteil
- // Zaehler und Nenner
- BOOL bSign = FALSE;
- if (fNumber < 0)
- {
- if (nIx == 0) // nicht in hinteren
- bSign = TRUE; // Formaten
- fNumber = -fNumber;
- }
- double fNum = floor(fNumber); // Vorkommateil
- fNumber -= fNum; // Nachkommateil
- if (fNum > _D_MAX_U_LONG_ || rInfo.nCntExp > 9)
- // zu gross
- {
- OutString = rScan.GetErrorString();
- return FALSE;
- }
- if (rInfo.nCntExp == 0)
- {
- DBG_ERROR("SvNumberformat:: Bruch, nCntExp == 0");
- return FALSE;
- }
- ULONG nBasis = ((ULONG)floor( // 9, 99, 999 ,...
- pow(10.0,rInfo.nCntExp))) - 1;
- ULONG x0, y0, x1, y1;
-
- if (rInfo.nCntExp <= _MAX_FRACTION_PREC)
- {
- BOOL bUpperHalf;
- if (fNumber > 0.5)
- {
- bUpperHalf = TRUE;
- fNumber -= (fNumber - 0.5) * 2.0;
- }
- else
- bUpperHalf = FALSE;
- // Einstieg in Farey-Serie
- // finden:
- x0 = (ULONG) floor(fNumber*nBasis); // z.B. 2/9 <= x < 3/9
- if (x0 == 0) // => x0 = 2
- {
- y0 = 1;
- x1 = 1;
- y1 = nBasis;
- }
- else if (x0 == (nBasis-1)/2) // (b-1)/2, 1/2
- { // geht (nBasis ungerade)
- y0 = nBasis;
- x1 = 1;
- y1 = 2;
- }
- else if (x0 == 1)
- {
- y0 = nBasis; // 1/n; 1/(n-1)
- x1 = 1;
- y1 = nBasis - 1;
- }
- else
- {
- y0 = nBasis; // z.B. 2/9 2/8
- x1 = x0;
- y1 = nBasis - 1;
- double fUg = (double) x0 / (double) y0;
- double fOg = (double) x1 / (double) y1;
- ULONG nGgt = ImpGGT(y0, x0); // x0/y0 kuerzen
- x0 /= nGgt;
- y0 /= nGgt; // Einschachteln:
- ULONG x2 = 0;
- ULONG y2 = 0;
- BOOL bStop = FALSE;
- while (!bStop)
- {
-#ifdef GCC
- // #i21648# GCC over-optimizes something resulting
- // in wrong fTest values throughout the loops.
- volatile
-#endif
- double fTest = (double)x1/(double)y1;
- while (!bStop)
- {
- while (fTest > fOg)
- {
- x1--;
- fTest = (double)x1/(double)y1;
- }
- while (fTest < fUg && y1 > 1)
- {
- y1--;
- fTest = (double)x1/(double)y1;
- }
- if (fTest <= fOg)
- {
- fOg = fTest;
- bStop = TRUE;
- }
- else if (y1 == 1)
- bStop = TRUE;
- } // of while
- nGgt = ImpGGT(y1, x1); // x1/y1 kuerzen
- x2 = x1 / nGgt;
- y2 = y1 / nGgt;
- if (x2*y0 - x0*y2 == 1 || y1 <= 1) // Test, ob x2/y2
- bStop = TRUE; // naechste Farey-Zahl
- else
- {
- y1--;
- bStop = FALSE;
- }
- } // of while
- x1 = x2;
- y1 = y2;
- } // of else
- double fup, flow;
- flow = (double)x0/(double)y0;
- fup = (double)x1/(double)y1;
- while (fNumber > fup)
- {
- ULONG x2 = ((y0+nBasis)/y1)*x1 - x0; // naechste Farey-Zahl
- ULONG y2 = ((y0+nBasis)/y1)*y1 - y0;
-// GetNextFareyNumber(nBasis, x0, x1, y0, y1, x2, y2);
- x0 = x1;
- y0 = y1;
- x1 = x2;
- y1 = y2;
- flow = fup;
- fup = (double)x1/(double)y1;
- }
- if (fNumber - flow < fup - fNumber)
- {
- nFrac = x0;
- nDiv = y0;
- }
- else
- {
- nFrac = x1;
- nDiv = y1;
- }
- if (bUpperHalf) // Original restaur.
- {
- if (nFrac == 0 && nDiv == 1) // 1/1
- fNum += 1.0;
- else
- nFrac = nDiv - nFrac;
- }
- }
- else // grosse Nenner
- { // 0,1234->123/1000
- ULONG nGgt;
-/*
- nDiv = nBasis+1;
- nFrac = ((ULONG)floor(0.5 + fNumber *
- pow(10.0,rInfo.nCntExp)));
-*/
- nDiv = 10000000;
- nFrac = ((ULONG)floor(0.5 + fNumber * 10000000.0));
- nGgt = ImpGGT(nDiv, nFrac);
- if (nGgt > 1)
- {
- nDiv /= nGgt;
- nFrac /= nGgt;
- }
- if (nDiv > nBasis)
- {
- nGgt = ImpGGTRound(nDiv, nFrac);
- if (nGgt > 1)
- {
- nDiv /= nGgt;
- nFrac /= nGgt;
- }
- }
- if (nDiv > nBasis)
- {
- nDiv = nBasis;
- nFrac = ((ULONG)floor(0.5 + fNumber *
- pow(10.0,rInfo.nCntExp)));
- nGgt = ImpGGTRound(nDiv, nFrac);
- if (nGgt > 1)
- {
- nDiv /= nGgt;
- nFrac /= nGgt;
- }
- }
- }
-
- if (rInfo.nCntPre == 0) // unechter Bruch
- {
- double fNum1 = fNum * (double)nDiv + (double)nFrac;
- if (fNum1 > _D_MAX_U_LONG_)
- {
- OutString = rScan.GetErrorString();
- return FALSE;
- }
- nFrac = (ULONG) floor(fNum1);
- sStr.Erase();
- }
- else if (fNum == 0.0 && nFrac != 0)
- sStr.Erase();
- else
- {
- char aBuf[100];
- sprintf( aBuf, "%.f", fNum ); // simple rounded integer (#100211# - checked)
- sStr.AssignAscii( aBuf );
- ImpTransliterate( sStr, NumFor[nIx].GetNatNum() );
- }
- if (rInfo.nCntPre > 0 && nFrac == 0)
- {
- sFrac.Erase();
- sDiv.Erase();
- }
- else
- {
- sFrac = ImpIntToString( nIx, nFrac );
- sDiv = ImpIntToString( nIx, nDiv );
- }
-
- USHORT j = nAnz-1; // letztes Symbol->rueckw.
- xub_StrLen k; // Nenner:
- bRes |= ImpNumberFill(sDiv, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRAC);
- BOOL bCont = TRUE;
- if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRAC)
- {
- if (rInfo.nCntPre > 0 && nFrac == 0)
- sDiv.Insert(' ',0);
- else
- sDiv.Insert( rInfo.sStrArray[j].GetChar(0), 0 );
- if ( j )
- j--;
- else
- bCont = FALSE;
- }
- // weiter Zaehler:
- if ( !bCont )
- sFrac.Erase();
- else
- {
- bRes |= ImpNumberFill(sFrac, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRACBLANK);
- if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRACBLANK)
- {
- sFrac.Insert(rInfo.sStrArray[j],0);
- if ( j )
- j--;
- else
- bCont = FALSE;
- }
- }
- // weiter Hauptzahl
- if ( !bCont )
- sStr.Erase();
- else
- {
- k = sStr.Len(); // hinter letzter Ziffer
- bRes |= ImpNumberFillWithThousands(sStr, fNumber, k, j, nIx,
- rInfo.nCntPre);
- }
- if (bSign && !(nFrac == 0 && fNum == 0.0))
- OutString.Insert('-',0); // nicht -0
- OutString += sStr;
- OutString += sFrac;
- OutString += sDiv;
- }
- break;
- case NUMBERFORMAT_SCIENTIFIC:
- {
- BOOL bSign = FALSE;
- if (fNumber < 0)
- {
- if (nIx == 0) // nicht in hinteren
- bSign = TRUE; // Formaten
- fNumber = -fNumber;
- }
- String sStr( ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_E,
- rInfo.nCntPre + rInfo.nCntPost - 1, '.' ));
-
- String ExpStr;
- short nExpSign = 1;
- xub_StrLen nExPos = sStr.Search('E');
- if ( nExPos != STRING_NOTFOUND )
- {
- // split into mantisse and exponent and get rid of "E+" or "E-"
- xub_StrLen nExpStart = nExPos + 1;
- switch ( sStr.GetChar( nExpStart ) )
- {
- case '-' :
- nExpSign = -1;
- // fallthru
- case '+' :
- ++nExpStart;
- break;
- }
- ExpStr = sStr.Copy( nExpStart ); // part following the "E+"
- sStr.Erase( nExPos );
- sStr.EraseAllChars('.'); // cut any decimal delimiter
- if ( rInfo.nCntPre != 1 ) // rescale Exp
- {
- sal_Int32 nExp = ExpStr.ToInt32() * nExpSign;
- nExp -= sal_Int32(rInfo.nCntPre)-1;
- if ( nExp < 0 )
- {
- nExpSign = -1;
- nExp = -nExp;
- }
- else
- nExpSign = 1;
- ExpStr = String::CreateFromInt32( nExp );
- }
- }
- USHORT j = nAnz-1; // last symbol
- xub_StrLen k; // position in ExpStr
- bRes |= ImpNumberFill(ExpStr, fNumber, k, j, nIx, NF_SYMBOLTYPE_EXP);
-
- xub_StrLen nZeros = 0; // erase leading zeros
- while (nZeros < k && ExpStr.GetChar(nZeros) == '0')
- ++nZeros;
- if (nZeros)
- ExpStr.Erase( 0, nZeros);
-
- BOOL bCont = TRUE;
- if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_EXP)
- {
- const String& rStr = rInfo.sStrArray[j];
- if (nExpSign == -1)
- ExpStr.Insert('-',0);
- else if (rStr.Len() > 1 && rStr.GetChar(1) == '+')
- ExpStr.Insert('+',0);
- ExpStr.Insert(rStr.GetChar(0),0);
- if ( j )
- j--;
- else
- bCont = FALSE;
- }
- // weiter Hauptzahl:
- if ( !bCont )
- sStr.Erase();
- else
- {
- k = sStr.Len(); // hinter letzter Ziffer
- bRes |= ImpNumberFillWithThousands(sStr,fNumber, k,j,nIx,
- rInfo.nCntPre +
- rInfo.nCntPost);
- }
- if (bSign)
- sStr.Insert('-',0);
- OutString = sStr;
- OutString += ExpStr;
- }
- break;
- }
- }
- return bRes;
-}
-
-BOOL SvNumberformat::ImpGetTimeOutput(double fNumber,
- USHORT nIx,
- String& OutString)
-{
- using namespace ::com::sun::star::i18n;
- BOOL bCalendarSet = FALSE;
- double fNumberOrig = fNumber;
- BOOL bRes = FALSE;
- BOOL bSign = FALSE;
- if (fNumber < 0.0)
- {
- fNumber = -fNumber;
- if (nIx == 0)
- bSign = TRUE;
- }
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- if (rInfo.bThousand) // []-Format
- {
- if (fNumber > 1.0E10) // zu gross
- {
- OutString = rScan.GetErrorString();
- return FALSE;
- }
- }
- else
- fNumber -= floor(fNumber); // sonst Datum abtrennen
- BOOL bInputLine;
- xub_StrLen nCntPost;
- if ( rScan.GetStandardPrec() == 300 &&
- 0 < rInfo.nCntPost && rInfo.nCntPost < 7 )
- { // round at 7 decimals (+5 of 86400 == 12 significant digits)
- bInputLine = TRUE;
- nCntPost = 7;
- }
- else
- {
- bInputLine = FALSE;
- nCntPost = xub_StrLen(rInfo.nCntPost);
- }
- if (bSign && !rInfo.bThousand) // kein []-Format
- fNumber = 1.0 - fNumber; // "Kehrwert"
- double fTime = fNumber * 86400.0;
- fTime = ::rtl::math::round( fTime, int(nCntPost) );
- if (bSign && fTime == 0.0)
- bSign = FALSE; // nicht -00:00:00
-
- if( floor( fTime ) > _D_MAX_U_LONG_ )
- {
- OutString = rScan.GetErrorString();
- return FALSE;
- }
- ULONG nSeconds = (ULONG)floor( fTime );
-
- String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds,
- rtl_math_StringFormat_F, int(nCntPost), '.'));
- sSecStr.EraseLeadingChars('0');
- sSecStr.EraseLeadingChars('.');
- if ( bInputLine )
- {
- sSecStr.EraseTrailingChars('0');
- if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) )
- sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' );
- ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
- nCntPost = sSecStr.Len();
- }
- else
- ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
-
- xub_StrLen nSecPos = 0; // Zum Ziffernweisen
- // abarbeiten
- ULONG nHour, nMin, nSec;
- if (!rInfo.bThousand) // kein [] Format
- {
- nHour = (nSeconds/3600) % 24;
- nMin = (nSeconds%3600) / 60;
- nSec = nSeconds%60;
- }
- else if (rInfo.nThousand == 3) // [ss]
- {
- nHour = 0;
- nMin = 0;
- nSec = nSeconds;
- }
- else if (rInfo.nThousand == 2) // [mm]:ss
- {
- nHour = 0;
- nMin = nSeconds / 60;
- nSec = nSeconds % 60;
- }
- else if (rInfo.nThousand == 1) // [hh]:mm:ss
- {
- nHour = nSeconds / 3600;
- nMin = (nSeconds%3600) / 60;
- nSec = nSeconds%60;
- }
- else {
- // TODO What should these be set to?
- nHour = 0;
- nMin = 0;
- nSec = 0;
- }
-
- sal_Unicode cAmPm = ' '; // a oder p
- if (rInfo.nCntExp) // AM/PM
- {
- if (nHour == 0)
- {
- nHour = 12;
- cAmPm = 'a';
- }
- else if (nHour < 12)
- cAmPm = 'a';
- else
- {
- cAmPm = 'p';
- if (nHour > 12)
- nHour -= 12;
- }
- }
- const USHORT nAnz = NumFor[nIx].GetnAnz();
- for (USHORT i = 0; i < nAnz; i++)
- {
- switch (rInfo.nTypeArray[i])
- {
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- OutString += (sal_Unicode) 0x1B;
- OutString += rInfo.sStrArray[i].GetChar(1);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- InsertBlanks( OutString, OutString.Len(),
- rInfo.sStrArray[i].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- case NF_SYMBOLTYPE_DATESEP:
- case NF_SYMBOLTYPE_TIMESEP:
- case NF_SYMBOLTYPE_TIME100SECSEP:
- OutString += rInfo.sStrArray[i];
- break;
- case NF_SYMBOLTYPE_DIGIT:
- {
- xub_StrLen nLen = ( bInputLine && i > 0 &&
- (rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING ||
- rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_TIME100SECSEP) ?
- nCntPost : rInfo.sStrArray[i].Len() );
- for (xub_StrLen j = 0; j < nLen && nSecPos < nCntPost; j++)
- {
- OutString += sSecStr.GetChar(nSecPos);
- nSecPos++;
- }
- }
- break;
- case NF_KEY_AMPM: // AM/PM
- {
- if ( !bCalendarSet )
- {
- double fDiff = DateTime(*(rScan.GetNullDate())) - GetCal().getEpochStart();
- fDiff += fNumberOrig;
- GetCal().setLocalDateTime( fDiff );
- bCalendarSet = TRUE;
- }
- if (cAmPm == 'a')
- OutString += GetCal().getDisplayName(
- CalendarDisplayIndex::AM_PM, AmPmValue::AM, 0 );
- else
- OutString += GetCal().getDisplayName(
- CalendarDisplayIndex::AM_PM, AmPmValue::PM, 0 );
- }
- break;
- case NF_KEY_AP: // A/P
- {
- if (cAmPm == 'a')
- OutString += 'a';
- else
- OutString += 'p';
- }
- break;
- case NF_KEY_MI: // M
- OutString += ImpIntToString( nIx, nMin );
- break;
- case NF_KEY_MMI: // MM
- OutString += ImpIntToString( nIx, nMin, 2 );
- break;
- case NF_KEY_H: // H
- OutString += ImpIntToString( nIx, nHour );
- break;
- case NF_KEY_HH: // HH
- OutString += ImpIntToString( nIx, nHour, 2 );
- break;
- case NF_KEY_S: // S
- OutString += ImpIntToString( nIx, nSec );
- break;
- case NF_KEY_SS: // SS
- OutString += ImpIntToString( nIx, nSec, 2 );
- break;
- default:
- break;
- }
- }
- if (bSign && rInfo.bThousand)
- OutString.Insert('-',0);
- return bRes;
-}
-
-
-BOOL SvNumberformat::ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const
-{
- if ( GetCal().getUniqueID() != Gregorian::get() )
- return FALSE;
- const ImpSvNumberformatInfo& rInfo = rNumFor.Info();
- const USHORT nAnz = rNumFor.GetnAnz();
- USHORT i;
- for ( i = 0; i < nAnz; i++ )
- {
- switch ( rInfo.nTypeArray[i] )
- {
- case NF_SYMBOLTYPE_CALENDAR :
- return FALSE;
- case NF_KEY_EC :
- case NF_KEY_EEC :
- case NF_KEY_R :
- case NF_KEY_RR :
- case NF_KEY_AAA :
- case NF_KEY_AAAA :
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-void SvNumberformat::SwitchToOtherCalendar( String& rOrgCalendar,
- double& fOrgDateTime ) const
-{
- CalendarWrapper& rCal = GetCal();
- const rtl::OUString &rGregorian = Gregorian::get();
- if ( rCal.getUniqueID() == rGregorian )
- {
- using namespace ::com::sun::star::i18n;
- ::com::sun::star::uno::Sequence< ::rtl::OUString > xCals
- = rCal.getAllCalendars( rLoc().getLocale() );
- sal_Int32 nCnt = xCals.getLength();
- if ( nCnt > 1 )
- {
- for ( sal_Int32 j=0; j < nCnt; j++ )
- {
- if ( xCals[j] != rGregorian )
- {
- if ( !rOrgCalendar.Len() )
- {
- rOrgCalendar = rCal.getUniqueID();
- fOrgDateTime = rCal.getDateTime();
- }
- rCal.loadCalendar( xCals[j], rLoc().getLocale() );
- rCal.setDateTime( fOrgDateTime );
- break; // for
- }
- }
- }
- }
-}
-
-
-void SvNumberformat::SwitchToGregorianCalendar( const String& rOrgCalendar,
- double fOrgDateTime ) const
-{
- CalendarWrapper& rCal = GetCal();
- const rtl::OUString &rGregorian = Gregorian::get();
- if ( rOrgCalendar.Len() && rCal.getUniqueID() != rGregorian )
- {
- rCal.loadCalendar( rGregorian, rLoc().getLocale() );
- rCal.setDateTime( fOrgDateTime );
- }
-}
-
-
-BOOL SvNumberformat::ImpFallBackToGregorianCalendar( String& rOrgCalendar, double& fOrgDateTime )
-{
- using namespace ::com::sun::star::i18n;
- CalendarWrapper& rCal = GetCal();
- const rtl::OUString &rGregorian = Gregorian::get();
- if ( rCal.getUniqueID() != rGregorian )
- {
- sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA );
- if ( nVal == 0 && rCal.getLoadedCalendar().Eras[0].ID.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "Dummy" ) ) )
- {
- if ( !rOrgCalendar.Len() )
- {
- rOrgCalendar = rCal.getUniqueID();
- fOrgDateTime = rCal.getDateTime();
- }
- else if ( rOrgCalendar == String(rGregorian) )
- rOrgCalendar.Erase();
- rCal.loadCalendar( rGregorian, rLoc().getLocale() );
- rCal.setDateTime( fOrgDateTime );
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-BOOL SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar,
- double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const
-{
- const ImpSvNumberformatInfo& rInfo = rNumFor.Info();
- const USHORT nAnz = rNumFor.GetnAnz();
- for ( USHORT i = 0; i < nAnz; i++ )
- {
- if ( rInfo.nTypeArray[i] == NF_SYMBOLTYPE_CALENDAR )
- {
- CalendarWrapper& rCal = GetCal();
- if ( !rOrgCalendar.Len() )
- {
- rOrgCalendar = rCal.getUniqueID();
- fOrgDateTime = rCal.getDateTime();
- }
- rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() );
- rCal.setDateTime( fOrgDateTime );
- return TRUE;
- }
- }
- return FALSE;
-}
-
-
-// static
-void SvNumberformat::ImpAppendEraG( String& OutString,
- const CalendarWrapper& rCal, sal_Int16 nNatNum )
-{
- using namespace ::com::sun::star::i18n;
- if ( rCal.getUniqueID().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "gengou" ) ) )
- {
- sal_Unicode cEra;
- sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::ERA );
- switch ( nVal )
- {
- case 1 : cEra = 'M'; break;
- case 2 : cEra = 'T'; break;
- case 3 : cEra = 'S'; break;
- case 4 : cEra = 'H'; break;
- default:
- cEra = '?';
- }
- OutString += cEra;
- }
- else
- OutString += rCal.getDisplayString( CalendarDisplayCode::SHORT_ERA, nNatNum );
-}
-
-
-BOOL SvNumberformat::ImpGetDateOutput(double fNumber,
- USHORT nIx,
- String& OutString)
-{
- using namespace ::com::sun::star::i18n;
- BOOL bRes = FALSE;
- CalendarWrapper& rCal = GetCal();
- double fDiff = DateTime(*(rScan.GetNullDate())) - rCal.getEpochStart();
- fNumber += fDiff;
- rCal.setLocalDateTime( fNumber );
- String aOrgCalendar; // empty => not changed yet
- double fOrgDateTime;
- BOOL bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) )
- bOtherCalendar = FALSE;
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- const USHORT nAnz = NumFor[nIx].GetnAnz();
- sal_Int16 nNatNum = NumFor[nIx].GetNatNum().GetNatNum();
- for (USHORT i = 0; i < nAnz; i++)
- {
- switch (rInfo.nTypeArray[i])
- {
- case NF_SYMBOLTYPE_CALENDAR :
- if ( !aOrgCalendar.Len() )
- {
- aOrgCalendar = rCal.getUniqueID();
- fOrgDateTime = rCal.getDateTime();
- }
- rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() );
- rCal.setDateTime( fOrgDateTime );
- ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- break;
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- OutString += (sal_Unicode) 0x1B;
- OutString += rInfo.sStrArray[i].GetChar(1);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- InsertBlanks( OutString, OutString.Len(),
- rInfo.sStrArray[i].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- case NF_SYMBOLTYPE_DATESEP:
- case NF_SYMBOLTYPE_TIMESEP:
- case NF_SYMBOLTYPE_TIME100SECSEP:
- OutString += rInfo.sStrArray[i];
- break;
- case NF_KEY_M: // M
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_MONTH, nNatNum );
- break;
- case NF_KEY_MM: // MM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH, nNatNum );
- break;
- case NF_KEY_MMM: // MMM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_MONTH_NAME, nNatNum );
- break;
- case NF_KEY_MMMM: // MMMM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH_NAME, nNatNum );
- break;
- case NF_KEY_MMMMM: // MMMMM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0);
- break;
- case NF_KEY_Q: // Q
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_QUARTER, nNatNum );
- break;
- case NF_KEY_QQ: // QQ
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_QUARTER, nNatNum );
- break;
- case NF_KEY_D: // D
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_DAY, nNatNum );
- break;
- case NF_KEY_DD: // DD
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY, nNatNum );
- break;
- case NF_KEY_DDD: // DDD
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_DAY_NAME, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_DDDD: // DDDD
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY_NAME, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_YY: // YY
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_YEAR, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_YYYY: // YYYY
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_YEAR, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_EC: // E
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_YEAR, nNatNum );
- break;
- case NF_KEY_EEC: // EE
- case NF_KEY_R: // R
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_YEAR, nNatNum );
- break;
- case NF_KEY_NN: // NN
- case NF_KEY_AAA: // AAA
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_DAY_NAME, nNatNum );
- break;
- case NF_KEY_NNN: // NNN
- case NF_KEY_AAAA: // AAAA
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY_NAME, nNatNum );
- break;
- case NF_KEY_NNNN: // NNNN
- {
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY_NAME, nNatNum );
- OutString += rLoc().getLongDateDayOfWeekSep();
- }
- break;
- case NF_KEY_WW : // WW
- {
- sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::WEEK_OF_YEAR );
- OutString += ImpIntToString( nIx, nVal );
- }
- break;
- case NF_KEY_G: // G
- ImpAppendEraG( OutString, rCal, nNatNum );
- break;
- case NF_KEY_GG: // GG
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_ERA, nNatNum );
- break;
- case NF_KEY_GGG: // GGG
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_ERA, nNatNum );
- break;
- case NF_KEY_RR: // RR => GGGEE
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_YEAR_AND_ERA, nNatNum );
- break;
- }
- }
- if ( aOrgCalendar.Len() )
- rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar
- return bRes;
-}
-
-BOOL SvNumberformat::ImpGetDateTimeOutput(double fNumber,
- USHORT nIx,
- String& OutString)
-{
- using namespace ::com::sun::star::i18n;
- BOOL bRes = FALSE;
-
- CalendarWrapper& rCal = GetCal();
- double fDiff = DateTime(*(rScan.GetNullDate())) - rCal.getEpochStart();
- fNumber += fDiff;
-
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- BOOL bInputLine;
- xub_StrLen nCntPost;
- if ( rScan.GetStandardPrec() == 300 &&
- 0 < rInfo.nCntPost && rInfo.nCntPost < 7 )
- { // round at 7 decimals (+5 of 86400 == 12 significant digits)
- bInputLine = TRUE;
- nCntPost = 7;
- }
- else
- {
- bInputLine = FALSE;
- nCntPost = xub_StrLen(rInfo.nCntPost);
- }
- double fTime = (fNumber - floor( fNumber )) * 86400.0;
- fTime = ::rtl::math::round( fTime, int(nCntPost) );
- if (fTime >= 86400.0)
- {
- // result of fNumber==x.999999999... rounded up, use correct date/time
- fTime -= 86400.0;
- fNumber = floor( fNumber + 0.5) + fTime;
- }
- rCal.setLocalDateTime( fNumber );
-
- String aOrgCalendar; // empty => not changed yet
- double fOrgDateTime;
- BOOL bOtherCalendar = ImpIsOtherCalendar( NumFor[nIx] );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- if ( ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime ) )
- bOtherCalendar = FALSE;
- sal_Int16 nNatNum = NumFor[nIx].GetNatNum().GetNatNum();
-
- ULONG nSeconds = (ULONG)floor( fTime );
- String sSecStr( ::rtl::math::doubleToUString( fTime-nSeconds,
- rtl_math_StringFormat_F, int(nCntPost), '.'));
- sSecStr.EraseLeadingChars('0');
- sSecStr.EraseLeadingChars('.');
- if ( bInputLine )
- {
- sSecStr.EraseTrailingChars('0');
- if ( sSecStr.Len() < xub_StrLen(rInfo.nCntPost) )
- sSecStr.Expand( xub_StrLen(rInfo.nCntPost), '0' );
- ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
- nCntPost = sSecStr.Len();
- }
- else
- ImpTransliterate( sSecStr, NumFor[nIx].GetNatNum() );
-
- xub_StrLen nSecPos = 0; // Zum Ziffernweisen
- // abarbeiten
- ULONG nHour, nMin, nSec;
- if (!rInfo.bThousand) // [] Format
- {
- nHour = (nSeconds/3600) % 24;
- nMin = (nSeconds%3600) / 60;
- nSec = nSeconds%60;
- }
- else if (rInfo.nThousand == 3) // [ss]
- {
- nHour = 0;
- nMin = 0;
- nSec = nSeconds;
- }
- else if (rInfo.nThousand == 2) // [mm]:ss
- {
- nHour = 0;
- nMin = nSeconds / 60;
- nSec = nSeconds % 60;
- }
- else if (rInfo.nThousand == 1) // [hh]:mm:ss
- {
- nHour = nSeconds / 3600;
- nMin = (nSeconds%3600) / 60;
- nSec = nSeconds%60;
- }
- else {
- nHour = 0; // TODO What should these values be?
- nMin = 0;
- nSec = 0;
- }
- sal_Unicode cAmPm = ' '; // a oder p
- if (rInfo.nCntExp) // AM/PM
- {
- if (nHour == 0)
- {
- nHour = 12;
- cAmPm = 'a';
- }
- else if (nHour < 12)
- cAmPm = 'a';
- else
- {
- cAmPm = 'p';
- if (nHour > 12)
- nHour -= 12;
- }
- }
- const USHORT nAnz = NumFor[nIx].GetnAnz();
- for (USHORT i = 0; i < nAnz; i++)
- {
- switch (rInfo.nTypeArray[i])
- {
- case NF_SYMBOLTYPE_CALENDAR :
- if ( !aOrgCalendar.Len() )
- {
- aOrgCalendar = rCal.getUniqueID();
- fOrgDateTime = rCal.getDateTime();
- }
- rCal.loadCalendar( rInfo.sStrArray[i], rLoc().getLocale() );
- rCal.setDateTime( fOrgDateTime );
- ImpFallBackToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- break;
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- OutString += (sal_Unicode) 0x1B;
- OutString += rInfo.sStrArray[i].GetChar(1);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- InsertBlanks( OutString, OutString.Len(),
- rInfo.sStrArray[i].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- case NF_SYMBOLTYPE_DATESEP:
- case NF_SYMBOLTYPE_TIMESEP:
- case NF_SYMBOLTYPE_TIME100SECSEP:
- OutString += rInfo.sStrArray[i];
- break;
- case NF_SYMBOLTYPE_DIGIT:
- {
- xub_StrLen nLen = ( bInputLine && i > 0 &&
- (rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_STRING ||
- rInfo.nTypeArray[i-1] == NF_SYMBOLTYPE_TIME100SECSEP) ?
- nCntPost : rInfo.sStrArray[i].Len() );
- for (xub_StrLen j = 0; j < nLen && nSecPos < nCntPost; j++)
- {
- OutString += sSecStr.GetChar(nSecPos);
- nSecPos++;
- }
- }
- break;
- case NF_KEY_AMPM: // AM/PM
- {
- if (cAmPm == 'a')
- OutString += rCal.getDisplayName( CalendarDisplayIndex::AM_PM,
- AmPmValue::AM, 0 );
- else
- OutString += rCal.getDisplayName( CalendarDisplayIndex::AM_PM,
- AmPmValue::PM, 0 );
- }
- break;
- case NF_KEY_AP: // A/P
- {
- if (cAmPm == 'a')
- OutString += 'a';
- else
- OutString += 'p';
- }
- break;
- case NF_KEY_MI: // M
- OutString += ImpIntToString( nIx, nMin );
- break;
- case NF_KEY_MMI: // MM
- OutString += ImpIntToString( nIx, nMin, 2 );
- break;
- case NF_KEY_H: // H
- OutString += ImpIntToString( nIx, nHour );
- break;
- case NF_KEY_HH: // HH
- OutString += ImpIntToString( nIx, nHour, 2 );
- break;
- case NF_KEY_S: // S
- OutString += ImpIntToString( nIx, nSec );
- break;
- case NF_KEY_SS: // SS
- OutString += ImpIntToString( nIx, nSec, 2 );
- break;
- case NF_KEY_M: // M
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_MONTH, nNatNum );
- break;
- case NF_KEY_MM: // MM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH, nNatNum );
- break;
- case NF_KEY_MMM: // MMM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_MONTH_NAME, nNatNum );
- break;
- case NF_KEY_MMMM: // MMMM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH_NAME, nNatNum );
- break;
- case NF_KEY_MMMMM: // MMMMM
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_MONTH_NAME, nNatNum ).GetChar(0);
- break;
- case NF_KEY_Q: // Q
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_QUARTER, nNatNum );
- break;
- case NF_KEY_QQ: // QQ
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_QUARTER, nNatNum );
- break;
- case NF_KEY_D: // D
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_DAY, nNatNum );
- break;
- case NF_KEY_DD: // DD
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY, nNatNum );
- break;
- case NF_KEY_DDD: // DDD
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_DAY_NAME, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_DDDD: // DDDD
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY_NAME, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_YY: // YY
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_YEAR, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_YYYY: // YYYY
- {
- if ( bOtherCalendar )
- SwitchToGregorianCalendar( aOrgCalendar, fOrgDateTime );
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_YEAR, nNatNum );
- if ( bOtherCalendar )
- SwitchToOtherCalendar( aOrgCalendar, fOrgDateTime );
- }
- break;
- case NF_KEY_EC: // E
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_YEAR, nNatNum );
- break;
- case NF_KEY_EEC: // EE
- case NF_KEY_R: // R
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_YEAR, nNatNum );
- break;
- case NF_KEY_NN: // NN
- case NF_KEY_AAA: // AAA
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_DAY_NAME, nNatNum );
- break;
- case NF_KEY_NNN: // NNN
- case NF_KEY_AAAA: // AAAA
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY_NAME, nNatNum );
- break;
- case NF_KEY_NNNN: // NNNN
- {
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_DAY_NAME, nNatNum );
- OutString += rLoc().getLongDateDayOfWeekSep();
- }
- break;
- case NF_KEY_WW : // WW
- {
- sal_Int16 nVal = rCal.getValue( CalendarFieldIndex::WEEK_OF_YEAR );
- OutString += ImpIntToString( nIx, nVal );
- }
- break;
- case NF_KEY_G: // G
- ImpAppendEraG( OutString, rCal, nNatNum );
- break;
- case NF_KEY_GG: // GG
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::SHORT_ERA, nNatNum );
- break;
- case NF_KEY_GGG: // GGG
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_ERA, nNatNum );
- break;
- case NF_KEY_RR: // RR => GGGEE
- OutString += rCal.getDisplayString(
- CalendarDisplayCode::LONG_YEAR_AND_ERA, nNatNum );
- break;
- }
- }
- if ( aOrgCalendar.Len() )
- rCal.loadCalendar( aOrgCalendar, rLoc().getLocale() ); // restore calendar
- return bRes;
-}
-
-BOOL SvNumberformat::ImpGetNumberOutput(double fNumber,
- USHORT nIx,
- String& OutString)
-{
- BOOL bRes = FALSE;
- BOOL bSign;
- if (fNumber < 0.0)
- {
- if (nIx == 0) // nicht in hinteren
- bSign = TRUE; // Formaten
- else
- bSign = FALSE;
- fNumber = -fNumber;
- }
- else
- {
- bSign = FALSE;
- if ( ::rtl::math::isSignBitSet( fNumber ) )
- fNumber = -fNumber; // yes, -0.0 is possible, eliminate '-'
- }
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- if (rInfo.eScannedType == NUMBERFORMAT_PERCENT)
- {
- if (fNumber < _D_MAX_D_BY_100)
- fNumber *= 100.0;
- else
- {
- OutString = rScan.GetErrorString();
- return FALSE;
- }
- }
- USHORT i, j;
- xub_StrLen k;
- String sStr;
- long nPrecExp;
- BOOL bInteger = FALSE;
- if ( rInfo.nThousand != FLAG_STANDARD_IN_FORMAT )
- { // special formatting only if no GENERAL keyword in format code
- const USHORT nThousand = rInfo.nThousand;
- for (i = 0; i < nThousand; i++)
- {
- if (fNumber > _D_MIN_M_BY_1000)
- fNumber /= 1000.0;
- else
- fNumber = 0.0;
- }
- if (fNumber > 0.0)
- nPrecExp = GetPrecExp( fNumber );
- else
- nPrecExp = 0;
- if (rInfo.nCntPost) // NachkommaStellen
- {
- if (rInfo.nCntPost + nPrecExp > 15 && nPrecExp < 15)
- {
- sStr = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_F, 15-nPrecExp, '.');
- for (long l = 15-nPrecExp; l < (long) rInfo.nCntPost; l++)
- sStr += '0';
- }
- else
- sStr = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_F, rInfo.nCntPost, '.' );
- sStr.EraseLeadingChars('0'); // fuehrende Nullen weg
- }
- else if (fNumber == 0.0) // Null
- {
- // nothing to be done here, keep empty string sStr,
- // ImpNumberFillWithThousands does the rest
- }
- else // Integer
- {
- sStr = ::rtl::math::doubleToUString( fNumber,
- rtl_math_StringFormat_F, 0, '.');
- sStr.EraseLeadingChars('0'); // fuehrende Nullen weg
- }
- xub_StrLen nPoint = sStr.Search( '.' );
- if ( nPoint != STRING_NOTFOUND )
- {
- register const sal_Unicode* p = sStr.GetBuffer() + nPoint;
- while ( *++p == '0' )
- ;
- if ( !*p )
- bInteger = TRUE;
- sStr.Erase( nPoint, 1 ); // . herausnehmen
- }
- if (bSign &&
- (sStr.Len() == 0 || sStr.GetTokenCount('0') == sStr.Len()+1)) // nur 00000
- bSign = FALSE; // nicht -0.00
- } // End of != FLAG_STANDARD_IN_FORMAT
-
- // von hinten nach vorn
- // editieren:
- k = sStr.Len(); // hinter letzter Ziffer
- j = NumFor[nIx].GetnAnz()-1; // letztes Symbol
- // Nachkommastellen:
- if (rInfo.nCntPost > 0)
- {
- BOOL bTrailing = TRUE; // ob Endnullen?
- BOOL bFilled = FALSE; // ob aufgefuellt wurde ?
- short nType;
- while (j > 0 && // rueckwaerts
- (nType = rInfo.nTypeArray[j]) != NF_SYMBOLTYPE_DECSEP)
- {
- switch ( nType )
- {
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- sStr.Insert( (sal_Unicode) 0x1B, k /*++*/ );
- sStr.Insert(rInfo.sStrArray[j].GetChar(1),k);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- case NF_SYMBOLTYPE_PERCENT:
- sStr.Insert(rInfo.sStrArray[j],k);
- break;
- case NF_SYMBOLTYPE_THSEP:
- if (rInfo.nThousand == 0)
- sStr.Insert(rInfo.sStrArray[j],k);
- break;
- case NF_SYMBOLTYPE_DIGIT:
- {
- const String& rStr = rInfo.sStrArray[j];
- const sal_Unicode* p1 = rStr.GetBuffer();
- register const sal_Unicode* p = p1 + rStr.Len();
- while ( p1 < p-- )
- {
- const sal_Unicode c = *p;
- k--;
- if ( sStr.GetChar(k) != '0' )
- bTrailing = FALSE;
- if (bTrailing)
- {
- if ( c == '0' )
- bFilled = TRUE;
- else if ( c == '-' )
- {
- if ( bInteger )
- sStr.SetChar( k, '-' );
- bFilled = TRUE;
- }
- else if ( c == '?' )
- {
- sStr.SetChar( k, ' ' );
- bFilled = TRUE;
- }
- else if ( !bFilled ) // #
- sStr.Erase(k,1);
- }
- } // of for
- } // of case digi
- break;
- case NF_KEY_CCC: // CCC-Waehrung
- sStr.Insert(rScan.GetCurAbbrev(), k);
- break;
- case NF_KEY_GENERAL: // Standard im String
- {
- String sNum;
- ImpGetOutputStandard(fNumber, sNum);
- sNum.EraseLeadingChars('-');
- sStr.Insert(sNum, k);
- }
- break;
- default:
- break;
- } // of switch
- j--;
- } // of while
- } // of Nachkomma
-
- bRes |= ImpNumberFillWithThousands(sStr, fNumber, k, j, nIx, // ggfs Auffuellen mit .
- rInfo.nCntPre);
- if ( rInfo.nCntPost > 0 )
- {
- const String& rDecSep = GetFormatter().GetNumDecimalSep();
- xub_StrLen nLen = rDecSep.Len();
- if ( sStr.Len() > nLen && sStr.Equals( rDecSep, sStr.Len() - nLen, nLen ) )
- sStr.Erase( sStr.Len() - nLen ); // no decimals => strip DecSep
- }
- if (bSign)
- sStr.Insert('-',0);
- ImpTransliterate( sStr, NumFor[nIx].GetNatNum() );
- OutString = sStr;
- return bRes;
-}
-
-BOOL SvNumberformat::ImpNumberFillWithThousands(
- String& sStr, // number string
- double& rNumber, // number
- xub_StrLen k, // position within string
- USHORT j, // symbol index within format code
- USHORT nIx, // subformat index
- USHORT nDigCnt) // count of integer digits in format
-{
- BOOL bRes = FALSE;
- xub_StrLen nLeadingStringChars = 0; // inserted StringChars before number
- xub_StrLen nDigitCount = 0; // count of integer digits from the right
- BOOL bStop = FALSE;
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- // no normal thousands separators if number divided by thousands
- BOOL bDoThousands = (rInfo.nThousand == 0);
- utl::DigitGroupingIterator aGrouping(
- GetFormatter().GetLocaleData()->getDigitGrouping());
- while (!bStop) // backwards
- {
- if (j == 0)
- bStop = TRUE;
- switch (rInfo.nTypeArray[j])
- {
- case NF_SYMBOLTYPE_DECSEP:
- aGrouping.reset();
- // fall thru
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- case NF_SYMBOLTYPE_PERCENT:
- sStr.Insert(rInfo.sStrArray[j],k);
- if ( k == 0 )
- nLeadingStringChars =
- nLeadingStringChars + rInfo.sStrArray[j].Len();
- break;
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- sStr.Insert( (sal_Unicode) 0x1B, k/*++*/ );
- sStr.Insert(rInfo.sStrArray[j].GetChar(1),k);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- /*k = */ InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_THSEP:
- {
- // #i7284# #102685# Insert separator also if number is divided
- // by thousands and the separator is specified somewhere in
- // between and not only at the end.
- // #i12596# But do not insert if it's a parenthesized negative
- // format like (#,)
- // In fact, do not insert if divided and regex [0#,],[^0#] and
- // no other digit symbol follows (which was already detected
- // during scan of format code, otherwise there would be no
- // division), else do insert. Same in ImpNumberFill() below.
- if ( !bDoThousands && j < NumFor[nIx].GetnAnz()-1 )
- bDoThousands = ((j == 0) ||
- (rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_DIGIT &&
- rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_THSEP) ||
- (rInfo.nTypeArray[j+1] == NF_SYMBOLTYPE_DIGIT));
- if ( bDoThousands )
- {
- if (k > 0)
- sStr.Insert(rInfo.sStrArray[j],k);
- else if (nDigitCount < nDigCnt)
- {
- // Leading '#' displays nothing (e.g. no leading
- // separator for numbers <1000 with #,##0 format).
- // Leading '?' displays blank.
- // Everything else, including nothing, displays the
- // separator.
- sal_Unicode cLeader = 0;
- if (j > 0 && rInfo.nTypeArray[j-1] == NF_SYMBOLTYPE_DIGIT)
- {
- const String& rStr = rInfo.sStrArray[j-1];
- xub_StrLen nLen = rStr.Len();
- if (nLen)
- cLeader = rStr.GetChar(nLen-1);
- }
- switch (cLeader)
- {
- case '#':
- ; // nothing
- break;
- case '?':
- // erAck: 2008-04-03T16:24+0200
- // Actually this currently isn't executed
- // because the format scanner in the context of
- // "?," doesn't generate a group separator but
- // a literal ',' character instead that is
- // inserted unconditionally. Should be changed
- // on some occasion.
- sStr.Insert(' ',k);
- break;
- default:
- sStr.Insert(rInfo.sStrArray[j],k);
- }
- }
- aGrouping.advance();
- }
- }
- break;
- case NF_SYMBOLTYPE_DIGIT:
- {
- const String& rStr = rInfo.sStrArray[j];
- const sal_Unicode* p1 = rStr.GetBuffer();
- register const sal_Unicode* p = p1 + rStr.Len();
- while ( p1 < p-- )
- {
- nDigitCount++;
- if (k > 0)
- k--;
- else
- {
- switch (*p)
- {
- case '0':
- sStr.Insert('0',0);
- break;
- case '?':
- sStr.Insert(' ',0);
- break;
- }
- }
- if (nDigitCount == nDigCnt && k > 0)
- { // more digits than specified
- ImpDigitFill(sStr, 0, k, nIx, nDigitCount, aGrouping);
- }
- }
- }
- break;
- case NF_KEY_CCC: // CCC currency
- sStr.Insert(rScan.GetCurAbbrev(), k);
- break;
- case NF_KEY_GENERAL: // "General" in string
- {
- String sNum;
- ImpGetOutputStandard(rNumber, sNum);
- sNum.EraseLeadingChars('-');
- sStr.Insert(sNum, k);
- }
- break;
-
- default:
- break;
- } // switch
- j--; // next format code string
- } // while
- k = k + nLeadingStringChars; // MSC converts += to int and then warns, so ...
- if (k > nLeadingStringChars)
- ImpDigitFill(sStr, nLeadingStringChars, k, nIx, nDigitCount, aGrouping);
- return bRes;
-}
-
-void SvNumberformat::ImpDigitFill(
- String& sStr, // number string
- xub_StrLen nStart, // start of digits
- xub_StrLen& k, // position within string
- USHORT nIx, // subformat index
- xub_StrLen & nDigitCount, // count of integer digits from the right so far
- utl::DigitGroupingIterator & rGrouping ) // current grouping
-{
- if (NumFor[nIx].Info().bThousand) // only if grouping
- { // fill in separators
- const String& rThousandSep = GetFormatter().GetNumThousandSep();
- while (k > nStart)
- {
- if (nDigitCount == rGrouping.getPos())
- {
- sStr.Insert( rThousandSep, k );
- rGrouping.advance();
- }
- nDigitCount++;
- k--;
- }
- }
- else // simply skip
- k = nStart;
-}
-
-BOOL SvNumberformat::ImpNumberFill( String& sStr, // number string
- double& rNumber, // number for "General" format
- xub_StrLen& k, // position within string
- USHORT& j, // symbol index within format code
- USHORT nIx, // subformat index
- short eSymbolType ) // type of stop condition
-{
- BOOL bRes = FALSE;
- k = sStr.Len(); // behind last digit
- const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
- // no normal thousands separators if number divided by thousands
- BOOL bDoThousands = (rInfo.nThousand == 0);
- short nType;
- while (j > 0 && (nType = rInfo.nTypeArray[j]) != eSymbolType )
- { // rueckwaerts:
- switch ( nType )
- {
- case NF_SYMBOLTYPE_STAR:
- if( bStarFlag )
- {
- sStr.Insert( sal_Unicode(0x1B), k++ );
- sStr.Insert(rInfo.sStrArray[j].GetChar(1),k);
- bRes = TRUE;
- }
- break;
- case NF_SYMBOLTYPE_BLANK:
- k = InsertBlanks( sStr,k,rInfo.sStrArray[j].GetChar(1) );
- break;
- case NF_SYMBOLTYPE_THSEP:
- {
- // Same as in ImpNumberFillWithThousands() above, do not insert
- // if divided and regex [0#,],[^0#] and no other digit symbol
- // follows (which was already detected during scan of format
- // code, otherwise there would be no division), else do insert.
- if ( !bDoThousands && j < NumFor[nIx].GetnAnz()-1 )
- bDoThousands = ((j == 0) ||
- (rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_DIGIT &&
- rInfo.nTypeArray[j-1] != NF_SYMBOLTYPE_THSEP) ||
- (rInfo.nTypeArray[j+1] == NF_SYMBOLTYPE_DIGIT));
- if ( bDoThousands && k > 0 )
- {
- sStr.Insert(rInfo.sStrArray[j],k);
- }
- }
- break;
- case NF_SYMBOLTYPE_DIGIT:
- {
- const String& rStr = rInfo.sStrArray[j];
- const sal_Unicode* p1 = rStr.GetBuffer();
- register const sal_Unicode* p = p1 + rStr.Len();
- while ( p1 < p-- )
- {
- if (k > 0)
- k--;
- else
- {
- switch (*p)
- {
- case '0':
- sStr.Insert('0',0);
- break;
- case '?':
- sStr.Insert(' ',0);
- break;
- }
- }
- }
- }
- break;
- case NF_KEY_CCC: // CCC-Waehrung
- sStr.Insert(rScan.GetCurAbbrev(), k);
- break;
- case NF_KEY_GENERAL: // Standard im String
- {
- String sNum;
- ImpGetOutputStandard(rNumber, sNum);
- sNum.EraseLeadingChars('-'); // Vorzeichen weg!!
- sStr.Insert(sNum, k);
- }
- break;
-
- default:
- sStr.Insert(rInfo.sStrArray[j],k);
- break;
- } // of switch
- j--; // naechster String
- } // of while
- return bRes;
-}
-
-void SvNumberformat::GetFormatSpecialInfo(BOOL& bThousand,
- BOOL& IsRed,
- USHORT& nPrecision,
- USHORT& nAnzLeading) const
-{
- // as before: take info from nNumFor=0 for whole format (for dialog etc.)
-
- short nDummyType;
- GetNumForInfo( 0, nDummyType, bThousand, nPrecision, nAnzLeading );
-
- // "negative in red" is only useful for the whole format
-
- const Color* pColor = NumFor[1].GetColor();
- if (fLimit1 == 0.0 && fLimit2 == 0.0 && pColor
- && (*pColor == rScan.GetRedColor()))
- IsRed = TRUE;
- else
- IsRed = FALSE;
-}
-
-void SvNumberformat::GetNumForInfo( USHORT nNumFor, short& rScannedType,
- BOOL& bThousand, USHORT& nPrecision, USHORT& nAnzLeading ) const
-{
- // take info from a specified sub-format (for XML export)
-
- if ( nNumFor > 3 )
- return; // invalid
-
- const ImpSvNumberformatInfo& rInfo = NumFor[nNumFor].Info();
- rScannedType = rInfo.eScannedType;
- bThousand = rInfo.bThousand;
- nPrecision = rInfo.nCntPost;
- if (bStandard && rInfo.eScannedType == NUMBERFORMAT_NUMBER)
- // StandardFormat
- nAnzLeading = 1;
- else
- {
- nAnzLeading = 0;
- BOOL bStop = FALSE;
- USHORT i = 0;
- const USHORT nAnz = NumFor[nNumFor].GetnAnz();
- while (!bStop && i < nAnz)
- {
- short nType = rInfo.nTypeArray[i];
- if ( nType == NF_SYMBOLTYPE_DIGIT)
- {
- register const sal_Unicode* p = rInfo.sStrArray[i].GetBuffer();
- while ( *p == '#' )
- p++;
- while ( *p++ == '0' )
- nAnzLeading++;
- }
- else if (nType == NF_SYMBOLTYPE_DECSEP || nType == NF_SYMBOLTYPE_EXP)
- bStop = TRUE;
- i++;
- }
- }
-}
-
-const String* SvNumberformat::GetNumForString( USHORT nNumFor, USHORT nPos,
- BOOL bString /* = FALSE */ ) const
-{
- if ( nNumFor > 3 )
- return NULL;
- USHORT nAnz = NumFor[nNumFor].GetnAnz();
- if ( !nAnz )
- return NULL;
- if ( nPos == 0xFFFF )
- {
- nPos = nAnz - 1;
- if ( bString )
- { // rueckwaerts
- short* pType = NumFor[nNumFor].Info().nTypeArray + nPos;
- while ( nPos > 0 && (*pType != NF_SYMBOLTYPE_STRING) &&
- (*pType != NF_SYMBOLTYPE_CURRENCY) )
- {
- pType--;
- nPos--;
- }
- if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) )
- return NULL;
- }
- }
- else if ( nPos > nAnz - 1 )
- return NULL;
- else if ( bString )
- { // vorwaerts
- short* pType = NumFor[nNumFor].Info().nTypeArray + nPos;
- while ( nPos < nAnz && (*pType != NF_SYMBOLTYPE_STRING) &&
- (*pType != NF_SYMBOLTYPE_CURRENCY) )
- {
- pType++;
- nPos++;
- }
- if ( nPos >= nAnz || ((*pType != NF_SYMBOLTYPE_STRING) &&
- (*pType != NF_SYMBOLTYPE_CURRENCY)) )
- return NULL;
- }
- return &NumFor[nNumFor].Info().sStrArray[nPos];
-}
-
-
-short SvNumberformat::GetNumForType( USHORT nNumFor, USHORT nPos,
- BOOL bString /* = FALSE */ ) const
-{
- if ( nNumFor > 3 )
- return 0;
- USHORT nAnz = NumFor[nNumFor].GetnAnz();
- if ( !nAnz )
- return 0;
- if ( nPos == 0xFFFF )
- {
- nPos = nAnz - 1;
- if ( bString )
- { // rueckwaerts
- short* pType = NumFor[nNumFor].Info().nTypeArray + nPos;
- while ( nPos > 0 && (*pType != NF_SYMBOLTYPE_STRING) &&
- (*pType != NF_SYMBOLTYPE_CURRENCY) )
- {
- pType--;
- nPos--;
- }
- if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) )
- return 0;
- }
- }
- else if ( nPos > nAnz - 1 )
- return 0;
- else if ( bString )
- { // vorwaerts
- short* pType = NumFor[nNumFor].Info().nTypeArray + nPos;
- while ( nPos < nAnz && (*pType != NF_SYMBOLTYPE_STRING) &&
- (*pType != NF_SYMBOLTYPE_CURRENCY) )
- {
- pType++;
- nPos++;
- }
- if ( (*pType != NF_SYMBOLTYPE_STRING) && (*pType != NF_SYMBOLTYPE_CURRENCY) )
- return 0;
- }
- return NumFor[nNumFor].Info().nTypeArray[nPos];
-}
-
-
-BOOL SvNumberformat::IsNegativeWithoutSign() const
-{
- if ( IsNegativeRealNegative() )
- {
- const String* pStr = GetNumForString( 1, 0, TRUE );
- if ( pStr )
- return !HasStringNegativeSign( *pStr );
- }
- return FALSE;
-}
-
-
-DateFormat SvNumberformat::GetDateOrder() const
-{
- if ( (eType & NUMBERFORMAT_DATE) == NUMBERFORMAT_DATE )
- {
- short const * const pType = NumFor[0].Info().nTypeArray;
- USHORT nAnz = NumFor[0].GetnAnz();
- for ( USHORT j=0; j<nAnz; j++ )
- {
- switch ( pType[j] )
- {
- case NF_KEY_D :
- case NF_KEY_DD :
- return DMY;
- case NF_KEY_M :
- case NF_KEY_MM :
- case NF_KEY_MMM :
- case NF_KEY_MMMM :
- case NF_KEY_MMMMM :
- return MDY;
- case NF_KEY_YY :
- case NF_KEY_YYYY :
- case NF_KEY_EC :
- case NF_KEY_EEC :
- case NF_KEY_R :
- case NF_KEY_RR :
- return YMD;
- }
- }
- }
- else
- {
- DBG_ERROR( "SvNumberformat::GetDateOrder: no date" );
- }
- return rLoc().getDateFormat();
-}
-
-
-sal_uInt32 SvNumberformat::GetExactDateOrder() const
-{
- sal_uInt32 nRet = 0;
- if ( (eType & NUMBERFORMAT_DATE) != NUMBERFORMAT_DATE )
- {
- DBG_ERROR( "SvNumberformat::GetExactDateOrder: no date" );
- return nRet;
- }
- short const * const pType = NumFor[0].Info().nTypeArray;
- USHORT nAnz = NumFor[0].GetnAnz();
- int nShift = 0;
- for ( USHORT j=0; j<nAnz && nShift < 3; j++ )
- {
- switch ( pType[j] )
- {
- case NF_KEY_D :
- case NF_KEY_DD :
- nRet = (nRet << 8) | 'D';
- ++nShift;
- break;
- case NF_KEY_M :
- case NF_KEY_MM :
- case NF_KEY_MMM :
- case NF_KEY_MMMM :
- case NF_KEY_MMMMM :
- nRet = (nRet << 8) | 'M';
- ++nShift;
- break;
- case NF_KEY_YY :
- case NF_KEY_YYYY :
- case NF_KEY_EC :
- case NF_KEY_EEC :
- case NF_KEY_R :
- case NF_KEY_RR :
- nRet = (nRet << 8) | 'Y';
- ++nShift;
- break;
- }
- }
- return nRet;
-}
-
-
-void SvNumberformat::GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1,
- SvNumberformatLimitOps& rOper2, double& rVal2 ) const
-{
- rOper1 = eOp1;
- rOper2 = eOp2;
- rVal1 = fLimit1;
- rVal2 = fLimit2;
-}
-
-
-Color* SvNumberformat::GetColor( USHORT nNumFor ) const
-{
- if ( nNumFor > 3 )
- return NULL;
-
- return NumFor[nNumFor].GetColor();
-}
-
-
-void lcl_SvNumberformat_AddLimitStringImpl( String& rStr,
- SvNumberformatLimitOps eOp, double fLimit, const String& rDecSep )
-{
- if ( eOp != NUMBERFORMAT_OP_NO )
- {
- switch ( eOp )
- {
- case NUMBERFORMAT_OP_EQ :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[=" ) );
- break;
- case NUMBERFORMAT_OP_NE :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<>" ) );
- break;
- case NUMBERFORMAT_OP_LT :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<" ) );
- break;
- case NUMBERFORMAT_OP_LE :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[<=" ) );
- break;
- case NUMBERFORMAT_OP_GT :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>" ) );
- break;
- case NUMBERFORMAT_OP_GE :
- rStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "[>=" ) );
- break;
- default:
- OSL_ASSERT( "unsupported number format" );
- break;
- }
- rStr += String( ::rtl::math::doubleToUString( fLimit,
- rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
- rDecSep.GetChar(0), sal_True));
- rStr += ']';
- }
-}
-
-
-String SvNumberformat::GetMappedFormatstring(
- const NfKeywordTable& rKeywords, const LocaleDataWrapper& rLocWrp,
- BOOL bDontQuote ) const
-{
- String aStr;
- BOOL bDefault[4];
- // 1 subformat matches all if no condition specified,
- bDefault[0] = ( NumFor[1].GetnAnz() == 0 && eOp1 == NUMBERFORMAT_OP_NO );
- // with 2 subformats [>=0];[<0] is implied if no condition specified
- bDefault[1] = ( !bDefault[0] && NumFor[2].GetnAnz() == 0 &&
- eOp1 == NUMBERFORMAT_OP_GE && fLimit1 == 0.0 &&
- eOp2 == NUMBERFORMAT_OP_NO && fLimit2 == 0.0 );
- // with 3 or more subformats [>0];[<0];[=0] is implied if no condition specified,
- // note that subformats may be empty (;;;) and NumFor[2].GetnAnz()>0 is not checked.
- bDefault[2] = ( !bDefault[0] && !bDefault[1] &&
- eOp1 == NUMBERFORMAT_OP_GT && fLimit1 == 0.0 &&
- eOp2 == NUMBERFORMAT_OP_LT && fLimit2 == 0.0 );
- BOOL bDefaults = bDefault[0] || bDefault[1] || bDefault[2];
- // from now on bDefault[] values are used to append empty subformats at the end
- bDefault[3] = FALSE;
- if ( !bDefaults )
- { // conditions specified
- if ( eOp1 != NUMBERFORMAT_OP_NO && eOp2 == NUMBERFORMAT_OP_NO )
- bDefault[0] = bDefault[1] = TRUE; // [];x
- else if ( eOp1 != NUMBERFORMAT_OP_NO && eOp2 != NUMBERFORMAT_OP_NO &&
- NumFor[2].GetnAnz() == 0 )
- bDefault[0] = bDefault[1] = bDefault[2] = bDefault[3] = TRUE; // [];[];;
- // nothing to do if conditions specified for every subformat
- }
- else if ( bDefault[0] )
- bDefault[0] = FALSE; // a single unconditional subformat is never delimited
- else
- {
- if ( bDefault[2] && NumFor[2].GetnAnz() == 0 && NumFor[1].GetnAnz() > 0 )
- bDefault[3] = TRUE; // special cases x;x;; and ;x;;
- for ( int i=0; i<3 && !bDefault[i]; ++i )
- bDefault[i] = TRUE;
- }
- int nSem = 0; // needed ';' delimiters
- int nSub = 0; // subformats delimited so far
- for ( int n=0; n<4; n++ )
- {
- if ( n > 0 )
- nSem++;
-
- String aPrefix;
-
- if ( !bDefaults )
- {
- switch ( n )
- {
- case 0 :
- lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp1,
- fLimit1, rLocWrp.getNumDecimalSep() );
- break;
- case 1 :
- lcl_SvNumberformat_AddLimitStringImpl( aPrefix, eOp2,
- fLimit2, rLocWrp.getNumDecimalSep() );
- break;
- }
- }
-
- const String& rColorName = NumFor[n].GetColorName();
- if ( rColorName.Len() )
- {
- const String* pKey = rScan.GetKeywords() + NF_KEY_FIRSTCOLOR;
- for ( int j=NF_KEY_FIRSTCOLOR; j<=NF_KEY_LASTCOLOR; j++, pKey++ )
- {
- if ( *pKey == rColorName )
- {
- aPrefix += '[';
- aPrefix += rKeywords[j];
- aPrefix += ']';
- break; // for
- }
- }
- }
-
- const SvNumberNatNum& rNum = NumFor[n].GetNatNum();
- // The Thai T NatNum modifier during Xcl export.
- if (rNum.IsSet() && rNum.GetNatNum() == 1 &&
- rKeywords[NF_KEY_THAI_T].EqualsAscii( "T") &&
- MsLangId::getRealLanguage( rNum.GetLang()) ==
- LANGUAGE_THAI)
- {
- aPrefix += 't'; // must be lowercase, otherwise taken as literal
- }
-
- USHORT nAnz = NumFor[n].GetnAnz();
- if ( nSem && (nAnz || aPrefix.Len()) )
- {
- for ( ; nSem; --nSem )
- aStr += ';';
- for ( ; nSub <= n; ++nSub )
- bDefault[nSub] = FALSE;
- }
-
- if ( aPrefix.Len() )
- aStr += aPrefix;
-
- if ( nAnz )
- {
- const short* pType = NumFor[n].Info().nTypeArray;
- const String* pStr = NumFor[n].Info().sStrArray;
- for ( USHORT j=0; j<nAnz; j++ )
- {
- if ( 0 <= pType[j] && pType[j] < NF_KEYWORD_ENTRIES_COUNT )
- {
- aStr += rKeywords[pType[j]];
- if( NF_KEY_NNNN == pType[j] )
- aStr += rLocWrp.getLongDateDayOfWeekSep();
- }
- else
- {
- switch ( pType[j] )
- {
- case NF_SYMBOLTYPE_DECSEP :
- aStr += rLocWrp.getNumDecimalSep();
- break;
- case NF_SYMBOLTYPE_THSEP :
- aStr += rLocWrp.getNumThousandSep();
- break;
- case NF_SYMBOLTYPE_DATESEP :
- aStr += rLocWrp.getDateSep();
- break;
- case NF_SYMBOLTYPE_TIMESEP :
- aStr += rLocWrp.getTimeSep();
- break;
- case NF_SYMBOLTYPE_TIME100SECSEP :
- aStr += rLocWrp.getTime100SecSep();
- break;
- case NF_SYMBOLTYPE_STRING :
- if( bDontQuote )
- aStr += pStr[j];
- else if ( pStr[j].Len() == 1 )
- {
- aStr += '\\';
- aStr += pStr[j];
- }
- else
- {
- aStr += '"';
- aStr += pStr[j];
- aStr += '"';
- }
- break;
- default:
- aStr += pStr[j];
- }
-
- }
- }
- }
- }
- for ( ; nSub<4 && bDefault[nSub]; ++nSub )
- { // append empty subformats
- aStr += ';';
- }
- return aStr;
-}
-
-
-String SvNumberformat::ImpGetNatNumString( const SvNumberNatNum& rNum,
- sal_Int32 nVal, USHORT nMinDigits ) const
-{
- String aStr;
- if ( nMinDigits )
- {
- if ( nMinDigits == 2 )
- { // speed up the most common case
- if ( 0 <= nVal && nVal < 10 )
- {
- sal_Unicode* p = aStr.AllocBuffer( 2 );
- *p++ = '0';
- *p = sal_Unicode( '0' + nVal );
- }
- else
- aStr = String::CreateFromInt32( nVal );
- }
- else
- {
- String aValStr( String::CreateFromInt32( nVal ) );
- if ( aValStr.Len() >= nMinDigits )
- aStr = aValStr;
- else
- {
- aStr.Fill( nMinDigits - aValStr.Len(), '0' );
- aStr += aValStr;
- }
- }
- }
- else
- aStr = String::CreateFromInt32( nVal );
- ImpTransliterate( aStr, rNum );
- return aStr;
-}
-
-
-void SvNumberformat::ImpTransliterateImpl( String& rStr,
- const SvNumberNatNum& rNum ) const
-{
- com::sun::star::lang::Locale aLocale(
- MsLangId::convertLanguageToLocale( rNum.GetLang() ) );
- rStr = GetFormatter().GetNatNum()->getNativeNumberString( rStr,
- aLocale, rNum.GetNatNum() );
-}
-
-
-void SvNumberformat::GetNatNumXml(
- com::sun::star::i18n::NativeNumberXmlAttributes& rAttr,
- USHORT nNumFor ) const
-{
- if ( nNumFor <= 3 )
- {
- const SvNumberNatNum& rNum = NumFor[nNumFor].GetNatNum();
- if ( rNum.IsSet() )
- {
- com::sun::star::lang::Locale aLocale(
- MsLangId::convertLanguageToLocale( rNum.GetLang() ) );
- rAttr = GetFormatter().GetNatNum()->convertToXmlAttributes(
- aLocale, rNum.GetNatNum() );
- }
- else
- rAttr = com::sun::star::i18n::NativeNumberXmlAttributes();
- }
- else
- rAttr = com::sun::star::i18n::NativeNumberXmlAttributes();
-}
-
-// static
-BOOL SvNumberformat::HasStringNegativeSign( const String& rStr )
-{
- // fuer Sign muss '-' am Anfang oder am Ende des TeilStrings sein (Blanks ignored)
- xub_StrLen nLen = rStr.Len();
- if ( !nLen )
- return FALSE;
- const sal_Unicode* const pBeg = rStr.GetBuffer();
- const sal_Unicode* const pEnd = pBeg + nLen;
- register const sal_Unicode* p = pBeg;
- do
- { // Anfang
- if ( *p == '-' )
- return TRUE;
- } while ( *p == ' ' && ++p < pEnd );
- p = pEnd - 1;
- do
- { // Ende
- if ( *p == '-' )
- return TRUE;
- } while ( *p == ' ' && pBeg < --p );
- return FALSE;
-}
-
-
-// static
-void SvNumberformat::SetComment( const String& rStr, String& rFormat,
- String& rComment )
-{
- if ( rComment.Len() )
- { // alten Kommentar aus Formatstring loeschen
- //! nicht per EraseComment, der Kommentar muss matchen
- String aTmp( '{' );
- aTmp += ' ';
- aTmp += rComment;
- aTmp += ' ';
- aTmp += '}';
- xub_StrLen nCom = 0;
- do
- {
- nCom = rFormat.Search( aTmp, nCom );
- } while ( (nCom != STRING_NOTFOUND) && (nCom + aTmp.Len() != rFormat.Len()) );
- if ( nCom != STRING_NOTFOUND )
- rFormat.Erase( nCom );
- }
- if ( rStr.Len() )
- { // neuen Kommentar setzen
- rFormat += '{';
- rFormat += ' ';
- rFormat += rStr;
- rFormat += ' ';
- rFormat += '}';
- rComment = rStr;
- }
-}
-
-
-// static
-void SvNumberformat::EraseCommentBraces( String& rStr )
-{
- xub_StrLen nLen = rStr.Len();
- if ( nLen && rStr.GetChar(0) == '{' )
- {
- rStr.Erase( 0, 1 );
- --nLen;
- }
- if ( nLen && rStr.GetChar(0) == ' ' )
- {
- rStr.Erase( 0, 1 );
- --nLen;
- }
- if ( nLen && rStr.GetChar( nLen-1 ) == '}' )
- rStr.Erase( --nLen, 1 );
- if ( nLen && rStr.GetChar( nLen-1 ) == ' ' )
- rStr.Erase( --nLen, 1 );
-}
-
-
-// static
-void SvNumberformat::EraseComment( String& rStr )
-{
- register const sal_Unicode* p = rStr.GetBuffer();
- BOOL bInString = FALSE;
- BOOL bEscaped = FALSE;
- BOOL bFound = FALSE;
- xub_StrLen nPos = 0;
- while ( !bFound && *p )
- {
- switch ( *p )
- {
- case '\\' :
- bEscaped = !bEscaped;
- break;
- case '\"' :
- if ( !bEscaped )
- bInString = !bInString;
- break;
- case '{' :
- if ( !bEscaped && !bInString )
- {
- bFound = TRUE;
- nPos = sal::static_int_cast< xub_StrLen >(
- p - rStr.GetBuffer());
- }
- break;
- }
- if ( bEscaped && *p != '\\' )
- bEscaped = FALSE;
- ++p;
- }
- if ( bFound )
- rStr.Erase( nPos );
-}
-
-
-// static
-BOOL SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos,
- sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut )
-{
- xub_StrLen nLen = rStr.Len();
- if ( nPos >= nLen )
- return FALSE;
- register const sal_Unicode* p0 = rStr.GetBuffer();
- register const sal_Unicode* p = p0;
- register const sal_Unicode* p1 = p0 + nPos;
- BOOL bQuoted = FALSE;
- while ( p <= p1 )
- {
- if ( *p == cQuote )
- {
- if ( p == p0 )
- bQuoted = TRUE;
- else if ( bQuoted )
- {
- if ( *(p-1) != cEscIn )
- bQuoted = FALSE;
- }
- else
- {
- if ( *(p-1) != cEscOut )
- bQuoted = TRUE;
- }
- }
- p++;
- }
- return bQuoted;
-}
-
-
-// static
-xub_StrLen SvNumberformat::GetQuoteEnd( const String& rStr, xub_StrLen nPos,
- sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut )
-{
- xub_StrLen nLen = rStr.Len();
- if ( nPos >= nLen )
- return STRING_NOTFOUND;
- if ( !IsInQuote( rStr, nPos, cQuote, cEscIn, cEscOut ) )
- {
- if ( rStr.GetChar( nPos ) == cQuote )
- return nPos; // schliessendes cQuote
- return STRING_NOTFOUND;
- }
- register const sal_Unicode* p0 = rStr.GetBuffer();
- register const sal_Unicode* p = p0 + nPos;
- register const sal_Unicode* p1 = p0 + nLen;
- while ( p < p1 )
- {
- if ( *p == cQuote && p > p0 && *(p-1) != cEscIn )
- return sal::static_int_cast< xub_StrLen >(p - p0);
- p++;
- }
- return nLen; // String Ende
-}
-
-
-USHORT SvNumberformat::ImpGetNumForStringElementCount( USHORT nNumFor ) const
-{
- USHORT nCnt = 0;
- USHORT nAnz = NumFor[nNumFor].GetnAnz();
- short const * const pType = NumFor[nNumFor].Info().nTypeArray;
- for ( USHORT j=0; j<nAnz; ++j )
- {
- switch ( pType[j] )
- {
- case NF_SYMBOLTYPE_STRING:
- case NF_SYMBOLTYPE_CURRENCY:
- case NF_SYMBOLTYPE_DATESEP:
- case NF_SYMBOLTYPE_TIMESEP:
- case NF_SYMBOLTYPE_TIME100SECSEP:
- case NF_SYMBOLTYPE_PERCENT:
- ++nCnt;
- break;
- }
- }
- return nCnt;
-}
-
diff --git a/svtools/source/numbers/zforscan.cxx b/svtools/source/numbers/zforscan.cxx
deleted file mode 100644
index 77b33226559c..000000000000
--- a/svtools/source/numbers/zforscan.cxx
+++ /dev/null
@@ -1,2812 +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: zforscan.cxx,v $
- * $Revision: 1.49.140.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <stdlib.h>
-#include <tools/debug.hxx>
-#include <i18npool/mslangid.hxx>
-#include <unotools/charclass.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <unotools/numberformatcodewrapper.hxx>
-#include <rtl/instance.hxx>
-
-#include <svtools/zforlist.hxx>
-#include <svtools/zformat.hxx>
-#include <unotools/digitgroupingiterator.hxx>
-
-#define _ZFORSCAN_CXX
-#include "zforscan.hxx"
-#undef _ZFORSCAN_CXX
-#include "nfsymbol.hxx"
-using namespace svt;
-
-const sal_Unicode cNonBreakingSpace = 0xA0;
-
-namespace
-{
- struct ImplEnglishColors
- {
- const String* operator()()
- {
- static const String aEnglishColors[NF_MAX_DEFAULT_COLORS] =
- {
- String( RTL_CONSTASCII_USTRINGPARAM( "BLACK" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "BLUE" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "GREEN" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "CYAN" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "RED" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "MAGENTA" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "BROWN" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "GREY" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "YELLOW" ) ),
- String( RTL_CONSTASCII_USTRINGPARAM( "WHITE" ) )
- };
- return &aEnglishColors[0];
- }
- };
-
- struct theEnglishColors
- : public rtl::StaticAggregate< const String, ImplEnglishColors> {};
-
-}
-
-ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP )
-{
- pFormatter = pFormatterP;
- bConvertMode = FALSE;
- //! All keywords MUST be UPPERCASE!
- sKeyword[NF_KEY_E].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) ); // Exponent
- sKeyword[NF_KEY_AMPM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AM/PM" ) ); // AM/PM
- sKeyword[NF_KEY_AP].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "A/P" ) ); // AM/PM short
- sKeyword[NF_KEY_MI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // Minute
- sKeyword[NF_KEY_MMI].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // Minute 02
- sKeyword[NF_KEY_S].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "S" ) ); // Second
- sKeyword[NF_KEY_SS].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SS" ) ); // Second 02
- sKeyword[NF_KEY_Q].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Q" ) ); // Quarter short 'Q'
- sKeyword[NF_KEY_QQ].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "QQ" ) ); // Quarter long
- sKeyword[NF_KEY_NN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NN" ) ); // Day of week short
- sKeyword[NF_KEY_NNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNN" ) ); // Day of week long
- sKeyword[NF_KEY_NNNN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "NNNN" ) ); // Day of week long incl. separator
- sKeyword[NF_KEY_WW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WW" ) ); // Week of year
- sKeyword[NF_KEY_CCC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CCC" ) ); // Currency abbreviation
- bKeywordsNeedInit = TRUE; // locale dependent keywords
- bCompatCurNeedInit = TRUE; // locale dependent compatibility currency strings
-
- StandardColor[0] = Color(COL_BLACK);
- StandardColor[1] = Color(COL_LIGHTBLUE);
- StandardColor[2] = Color(COL_LIGHTGREEN);
- StandardColor[3] = Color(COL_LIGHTCYAN);
- StandardColor[4] = Color(COL_LIGHTRED);
- StandardColor[5] = Color(COL_LIGHTMAGENTA);
- StandardColor[6] = Color(COL_BROWN);
- StandardColor[7] = Color(COL_GRAY);
- StandardColor[8] = Color(COL_YELLOW);
- StandardColor[9] = Color(COL_WHITE);
-
- pNullDate = new Date(30,12,1899);
- nStandardPrec = 2;
-
- sErrStr.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "###" ) );
- Reset();
-}
-
-ImpSvNumberformatScan::~ImpSvNumberformatScan()
-{
- delete pNullDate;
- Reset();
-}
-
-
-void ImpSvNumberformatScan::ChangeIntl()
-{
- bKeywordsNeedInit = TRUE;
- bCompatCurNeedInit = TRUE;
- // may be initialized by InitSpecialKeyword()
- sKeyword[NF_KEY_TRUE].Erase();
- sKeyword[NF_KEY_FALSE].Erase();
-}
-
-
-void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
-{
- switch ( eIdx )
- {
- case NF_KEY_TRUE :
- ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE] =
- pFormatter->GetCharClass()->upper(
- pFormatter->GetLocaleData()->getTrueWord() );
- if ( !sKeyword[NF_KEY_TRUE].Len() )
- {
- DBG_ERRORFILE( "InitSpecialKeyword: TRUE_WORD?" );
- ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_TRUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TRUE" ) );
- }
- break;
- case NF_KEY_FALSE :
- ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE] =
- pFormatter->GetCharClass()->upper(
- pFormatter->GetLocaleData()->getFalseWord() );
- if ( !sKeyword[NF_KEY_FALSE].Len() )
- {
- DBG_ERRORFILE( "InitSpecialKeyword: FALSE_WORD?" );
- ((ImpSvNumberformatScan*)this)->sKeyword[NF_KEY_FALSE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FALSE" ) );
- }
- break;
- default:
- DBG_ERRORFILE( "InitSpecialKeyword: unknown request" );
- }
-}
-
-
-void ImpSvNumberformatScan::InitCompatCur() const
-{
- ImpSvNumberformatScan* pThis = (ImpSvNumberformatScan*)this;
- // currency symbol for old style ("automatic") compatibility format codes
- pFormatter->GetCompatibilityCurrency( pThis->sCurSymbol, pThis->sCurAbbrev );
- // currency symbol upper case
- pThis->sCurString = pFormatter->GetCharClass()->upper( sCurSymbol );
- bCompatCurNeedInit = FALSE;
-}
-
-
-void ImpSvNumberformatScan::InitKeywords() const
-{
- if ( !bKeywordsNeedInit )
- return ;
- ((ImpSvNumberformatScan*)this)->SetDependentKeywords();
- bKeywordsNeedInit = FALSE;
-}
-
-
-/** Extract the name of General, Standard, Whatever, ignoring leading modifiers
- such as [NatNum1]. */
-static String lcl_extractStandardGeneralName( const ::rtl::OUString & rCode )
-{
- String aStr;
- const sal_Unicode* p = rCode.getStr();
- const sal_Unicode* const pStop = p + rCode.getLength();
- const sal_Unicode* pBeg = p; // name begins here
- bool bMod = false;
- bool bDone = false;
- while (p < pStop && !bDone)
- {
- switch (*p)
- {
- case '[':
- bMod = true;
- break;
- case ']':
- if (bMod)
- {
- bMod = false;
- pBeg = p+1;
- }
- // else: would be a locale data error, easily to be spotted in
- // UI dialog
- break;
- case ';':
- if (!bMod)
- {
- bDone = true;
- --p; // put back, increment by one follows
- }
- break;
- }
- ++p;
- if (bMod)
- pBeg = p;
- }
- if (pBeg < p)
- aStr = rCode.copy( pBeg - rCode.getStr(), p - pBeg);
- return aStr;
-}
-
-
-void ImpSvNumberformatScan::SetDependentKeywords()
-{
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
-
- const CharClass* pCharClass = pFormatter->GetCharClass();
- const LocaleDataWrapper* pLocaleData = pFormatter->GetLocaleData();
- // #80023# be sure to generate keywords for the loaded Locale, not for the
- // requested Locale, otherwise number format codes might not match
- lang::Locale aLoadedLocale = pLocaleData->getLoadedLocale();
- LanguageType eLang = MsLangId::convertLocaleToLanguage( aLoadedLocale );
- NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetServiceManager(), aLoadedLocale );
-
- i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD );
- sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code);
- sKeyword[NF_KEY_GENERAL] = pCharClass->upper( sNameStandardFormat );
-
- // preset new calendar keywords
- sKeyword[NF_KEY_AAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAA" ) );
- sKeyword[NF_KEY_AAAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) );
- sKeyword[NF_KEY_EC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "E" ) );
- sKeyword[NF_KEY_EEC].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "EE" ) );
- sKeyword[NF_KEY_G].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) );
- sKeyword[NF_KEY_GG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) );
- sKeyword[NF_KEY_GGG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) );
- sKeyword[NF_KEY_R].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "R" ) );
- sKeyword[NF_KEY_RR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "RR" ) );
-
- // Thai T NatNum special. Other locale's small letter 't' results in upper
- // case comparison not matching but length does in conversion mode. Ugly.
- if (eLang == LANGUAGE_THAI)
- sKeyword[NF_KEY_THAI_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T"));
- else
- sKeyword[NF_KEY_THAI_T].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "t"));
-
- switch ( eLang )
- {
- case LANGUAGE_GERMAN:
- case LANGUAGE_GERMAN_SWISS:
- case LANGUAGE_GERMAN_AUSTRIAN:
- case LANGUAGE_GERMAN_LUXEMBOURG:
- case LANGUAGE_GERMAN_LIECHTENSTEIN:
- {
- //! all capital letters
- sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) ); // month 1
- sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) ); // month 01
- sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) ); // month Jan
- sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) ); // month Januar
- sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMMM" ) );// month J
- sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) ); // hour 2
- sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) ); // hour 02
- sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) );
- sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) );
- sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTT" ) );
- sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TTTT" ) );
- sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) );
- sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) );
- sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "LOGISCH" ) );
- sKeyword[NF_KEY_COLOR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "FARBE" ) );
- sKeyword[NF_KEY_BLACK].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "SCHWARZ" ) );
- sKeyword[NF_KEY_BLUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLAU" ) );
- sKeyword[NF_KEY_GREEN] = UniString( "GR" "\xDC" "N", RTL_TEXTENCODING_ISO_8859_1 );
- sKeyword[NF_KEY_CYAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CYAN" ) );
- sKeyword[NF_KEY_RED].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "ROT" ) );
- sKeyword[NF_KEY_MAGENTA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MAGENTA" ) );
- sKeyword[NF_KEY_BROWN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BRAUN" ) );
- sKeyword[NF_KEY_GREY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GRAU" ) );
- sKeyword[NF_KEY_YELLOW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GELB" ) );
- sKeyword[NF_KEY_WHITE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WEISS" ) );
- }
- break;
- default:
- {
- // day
- switch ( eLang )
- {
- case LANGUAGE_ITALIAN :
- case LANGUAGE_ITALIAN_SWISS :
- sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "G" ) );
- sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GG" ) );
- sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGG" ) );
- sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GGGG" ) );
- // must exchange the era code, same as Xcl
- sKeyword[NF_KEY_G].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "X" ) );
- sKeyword[NF_KEY_GG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "XX" ) );
- sKeyword[NF_KEY_GGG].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "XXX" ) );
- break;
- case LANGUAGE_FRENCH :
- case LANGUAGE_FRENCH_BELGIAN :
- case LANGUAGE_FRENCH_CANADIAN :
- case LANGUAGE_FRENCH_SWISS :
- case LANGUAGE_FRENCH_LUXEMBOURG :
- case LANGUAGE_FRENCH_MONACO :
- sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "J" ) );
- sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) );
- sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJ" ) );
- sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) );
- break;
- case LANGUAGE_FINNISH :
- sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "P" ) );
- sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PP" ) );
- sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPP" ) );
- sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "PPPP" ) );
- break;
- default:
- sKeyword[NF_KEY_D].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "D" ) );
- sKeyword[NF_KEY_DD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DD" ) );
- sKeyword[NF_KEY_DDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDD" ) );
- sKeyword[NF_KEY_DDDD].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "DDDD" ) );
- }
- // month
- switch ( eLang )
- {
- case LANGUAGE_FINNISH :
- sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "K" ) );
- sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KK" ) );
- sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKK" ) );
- sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKKK" ) );
- sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "KKKKK" ) );
- break;
- default:
- sKeyword[NF_KEY_M].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "M" ) );
- sKeyword[NF_KEY_MM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MM" ) );
- sKeyword[NF_KEY_MMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMM" ) );
- sKeyword[NF_KEY_MMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMM" ) );
- sKeyword[NF_KEY_MMMMM].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MMMMM" ) );
- }
- // year
- switch ( eLang )
- {
- case LANGUAGE_ITALIAN :
- case LANGUAGE_ITALIAN_SWISS :
- case LANGUAGE_FRENCH :
- case LANGUAGE_FRENCH_BELGIAN :
- case LANGUAGE_FRENCH_CANADIAN :
- case LANGUAGE_FRENCH_SWISS :
- case LANGUAGE_FRENCH_LUXEMBOURG :
- case LANGUAGE_FRENCH_MONACO :
- case LANGUAGE_PORTUGUESE :
- case LANGUAGE_PORTUGUESE_BRAZILIAN :
- case LANGUAGE_SPANISH_MODERN :
- case LANGUAGE_SPANISH_DATED :
- case LANGUAGE_SPANISH_MEXICAN :
- case LANGUAGE_SPANISH_GUATEMALA :
- case LANGUAGE_SPANISH_COSTARICA :
- case LANGUAGE_SPANISH_PANAMA :
- case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC :
- case LANGUAGE_SPANISH_VENEZUELA :
- case LANGUAGE_SPANISH_COLOMBIA :
- case LANGUAGE_SPANISH_PERU :
- case LANGUAGE_SPANISH_ARGENTINA :
- case LANGUAGE_SPANISH_ECUADOR :
- case LANGUAGE_SPANISH_CHILE :
- case LANGUAGE_SPANISH_URUGUAY :
- case LANGUAGE_SPANISH_PARAGUAY :
- case LANGUAGE_SPANISH_BOLIVIA :
- case LANGUAGE_SPANISH_EL_SALVADOR :
- case LANGUAGE_SPANISH_HONDURAS :
- case LANGUAGE_SPANISH_NICARAGUA :
- case LANGUAGE_SPANISH_PUERTO_RICO :
- sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AA" ) );
- sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "AAAA" ) );
- // must exchange the day of week name code, same as Xcl
- sKeyword[NF_KEY_AAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OOO" ) );
- sKeyword[NF_KEY_AAAA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "OOOO" ) );
- break;
- case LANGUAGE_DUTCH :
- case LANGUAGE_DUTCH_BELGIAN :
- sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJ" ) );
- sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "JJJJ" ) );
- break;
- case LANGUAGE_FINNISH :
- sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VV" ) );
- sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "VVVV" ) );
- break;
- default:
- sKeyword[NF_KEY_YY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YY" ) );
- sKeyword[NF_KEY_YYYY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YYYY" ) );
- }
- // hour
- switch ( eLang )
- {
- case LANGUAGE_DUTCH :
- case LANGUAGE_DUTCH_BELGIAN :
- sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "U" ) );
- sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "UU" ) );
- break;
- case LANGUAGE_FINNISH :
- case LANGUAGE_SWEDISH :
- case LANGUAGE_SWEDISH_FINLAND :
- case LANGUAGE_DANISH :
- case LANGUAGE_NORWEGIAN :
- case LANGUAGE_NORWEGIAN_BOKMAL :
- case LANGUAGE_NORWEGIAN_NYNORSK :
- sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "T" ) );
- sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "TT" ) );
- break;
- default:
- sKeyword[NF_KEY_H].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "H" ) );
- sKeyword[NF_KEY_HH].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "HH" ) );
- }
- // boolean
- sKeyword[NF_KEY_BOOLEAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BOOLEAN" ) );
- // colours
- sKeyword[NF_KEY_COLOR].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "COLOR" ) );
- sKeyword[NF_KEY_BLACK].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLACK" ) );
- sKeyword[NF_KEY_BLUE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BLUE" ) );
- sKeyword[NF_KEY_GREEN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GREEN" ) );
- sKeyword[NF_KEY_CYAN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "CYAN" ) );
- sKeyword[NF_KEY_RED].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "RED" ) );
- sKeyword[NF_KEY_MAGENTA].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "MAGENTA" ) );
- sKeyword[NF_KEY_BROWN].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "BROWN" ) );
- sKeyword[NF_KEY_GREY].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "GREY" ) );
- sKeyword[NF_KEY_YELLOW].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "YELLOW" ) );
- sKeyword[NF_KEY_WHITE].AssignAscii( RTL_CONSTASCII_STRINGPARAM( "WHITE" ) );
- }
- break;
- }
-
- // boolean keyords
- InitSpecialKeyword( NF_KEY_TRUE );
- InitSpecialKeyword( NF_KEY_FALSE );
-
- // compatibility currency strings
- InitCompatCur();
-}
-
-
-void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear)
-{
- if ( pNullDate )
- *pNullDate = Date(nDay, nMonth, nYear);
- else
- pNullDate = new Date(nDay, nMonth, nYear);
-}
-
-void ImpSvNumberformatScan::ChangeStandardPrec(short nPrec)
-{
- nStandardPrec = nPrec;
-}
-
-Color* ImpSvNumberformatScan::GetColor(String& sStr)
-{
- String sString = pFormatter->GetCharClass()->upper(sStr);
- const String* pKeyword = GetKeywords();
- size_t i = 0;
- while (i < NF_MAX_DEFAULT_COLORS &&
- sString != pKeyword[NF_KEY_FIRSTCOLOR+i] )
- i++;
- if ( i >= NF_MAX_DEFAULT_COLORS )
- {
- const String* pEnglishColors = theEnglishColors::get();
- size_t j = 0;
- while ( j < NF_MAX_DEFAULT_COLORS &&
- sString != pEnglishColors[j] )
- ++j;
- if ( j < NF_MAX_DEFAULT_COLORS )
- i = j;
- }
-
- Color* pResult = NULL;
- if (i >= NF_MAX_DEFAULT_COLORS)
- {
- const String& rColorWord = pKeyword[NF_KEY_COLOR];
- xub_StrLen nPos = sString.Match(rColorWord);
- if (nPos > 0)
- {
- sStr.Erase(0, nPos);
- sStr.EraseLeadingChars();
- sStr.EraseTrailingChars();
- if (bConvertMode)
- {
- pFormatter->ChangeIntl(eNewLnge);
- sStr.Insert( GetKeywords()[NF_KEY_COLOR], 0 ); // Color -> FARBE
- pFormatter->ChangeIntl(eTmpLnge);
- }
- else
- sStr.Insert(rColorWord,0);
- sString.Erase(0, nPos);
- sString.EraseLeadingChars();
- sString.EraseTrailingChars();
-
- if ( CharClass::isAsciiNumeric( sString ) )
- {
- long nIndex = sString.ToInt32();
- if (nIndex > 0 && nIndex <= 64)
- pResult = pFormatter->GetUserDefColor((USHORT)nIndex-1);
- }
- }
- }
- else
- {
- sStr.Erase();
- if (bConvertMode)
- {
- pFormatter->ChangeIntl(eNewLnge);
- sStr = GetKeywords()[NF_KEY_FIRSTCOLOR+i]; // red -> rot
- pFormatter->ChangeIntl(eTmpLnge);
- }
- else
- sStr = pKeyword[NF_KEY_FIRSTCOLOR+i];
-
- pResult = &(StandardColor[i]);
- }
- return pResult;
-}
-
-
-short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos )
-{
- String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos );
- const String* pKeyword = GetKeywords();
- // #77026# for the Xcl perverts: the GENERAL keyword is recognized anywhere
- if ( sString.Search( pKeyword[NF_KEY_GENERAL] ) == 0 )
- return NF_KEY_GENERAL;
- //! MUST be a reverse search to find longer strings first
- short i = NF_KEYWORD_ENTRIES_COUNT-1;
- BOOL bFound = FALSE;
- for ( ; i > NF_KEY_LASTKEYWORD_SO5; --i )
- {
- bFound = sString.Search(pKeyword[i]) == 0;
- if ( bFound )
- {
- break;
- }
- }
- // new keywords take precedence over old keywords
- if ( !bFound )
- { // skip the gap of colors et al between new and old keywords and search on
- i = NF_KEY_LASTKEYWORD;
- while ( i > 0 && sString.Search(pKeyword[i]) != 0 )
- i--;
- if ( i > NF_KEY_LASTOLDKEYWORD && sString != pKeyword[i] )
- { // found something, but maybe it's something else?
- // e.g. new NNN is found in NNNN, for NNNN we must search on
- short j = i - 1;
- while ( j > 0 && sString.Search(pKeyword[j]) != 0 )
- j--;
- if ( j && pKeyword[j].Len() > pKeyword[i].Len() )
- return j;
- }
- }
- // The Thai T NatNum modifier during Xcl import.
- if (i == 0 && bConvertMode && sString.GetChar(0) == 'T' && eTmpLnge ==
- LANGUAGE_ENGLISH_US && MsLangId::getRealLanguage( eNewLnge) ==
- LANGUAGE_THAI)
- i = NF_KEY_THAI_T;
- return i; // 0 => not found
-}
-
-//---------------------------------------------------------------------------
-// Next_Symbol
-//---------------------------------------------------------------------------
-// Zerlegt die Eingabe in Symbole fuer die weitere
-// Verarbeitung (Turing-Maschine).
-//---------------------------------------------------------------------------
-// Ausgangs Zustand = SsStart
-//---------------+-------------------+-----------------------+---------------
-// Alter Zustand | gelesenes Zeichen | Aktion | Neuer Zustand
-//---------------+-------------------+-----------------------+---------------
-// SsStart | Buchstabe | Symbol=Zeichen | SsGetWord
-// | " | Typ = String | SsGetString
-// | \ | Typ = String | SsGetChar
-// | * | Typ = Star | SsGetStar
-// | _ | Typ = Blank | SsGetBlank
-// | @ # 0 ? / . , % [ | Symbol = Zeichen; |
-// | ] ' Blank | Typ = Steuerzeichen | SsStop
-// | $ - + ( ) : | Typ = String; |
-// | | | Typ = Comment | SsStop
-// | Sonst | Symbol = Zeichen | SsStop
-//---------------|-------------------+-----------------------+---------------
-// SsGetChar | Sonst | Symbol=Zeichen | SsStop
-//---------------+-------------------+-----------------------+---------------
-// GetString | " | | SsStop
-// | Sonst | Symbol+=Zeichen | GetString
-//---------------+-------------------+-----------------------+---------------
-// SsGetWord | Buchstabe | Symbol += Zeichen |
-// | + - (E+ E-)| Symbol += Zeichen | SsStop
-// | / (AM/PM)| Symbol += Zeichen |
-// | Sonst | Pos--, if Key Typ=Word| SsStop
-//---------------+-------------------+-----------------------+---------------
-// SsGetStar | Sonst | Symbol+=Zeichen | SsStop
-// | | markiere Sonderfall * |
-//---------------+-------------------+-----------------------+---------------
-// SsGetBlank | Sonst | Symbol+=Zeichen | SsStop
-// | | markiere Sonderfall _ |
-//---------------+-------------------+-----------------------+---------------
-// Wurde im State SsGetWord ein Schluesselwort erkannt (auch als
-// Anfangsteilwort des Symbols)
-// so werden die restlichen Buchstaben zurueckgeschrieben !!
-
-enum ScanState
-{
- SsStop = 0,
- SsStart = 1,
- SsGetChar = 2,
- SsGetString = 3,
- SsGetWord = 4,
- SsGetStar = 5,
- SsGetBlank = 6
-};
-
-short ImpSvNumberformatScan::Next_Symbol( const String& rStr,
- xub_StrLen& nPos, String& sSymbol )
-{
- if ( bKeywordsNeedInit )
- InitKeywords();
- const CharClass* pChrCls = pFormatter->GetCharClass();
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
- const xub_StrLen nStart = nPos;
- short eType = 0;
- ScanState eState = SsStart;
- sSymbol.Erase();
- while ( nPos < rStr.Len() && eState != SsStop )
- {
- sal_Unicode cToken = rStr.GetChar( nPos++ );
- switch (eState)
- {
- case SsStart:
- {
- // Fetch any currency longer than one character and don't get
- // confused later on by "E/" or other combinations of letters
- // and meaningful symbols. Necessary for old automatic currency.
- // #96158# But don't do it if we're starting a "[...]" section,
- // for example a "[$...]" new currency symbol to not parse away
- // "$U" (symbol) of "[$UYU]" (abbreviation).
- if ( nCurrPos != STRING_NOTFOUND && sCurString.Len() > 1 &&
- nPos-1 + sCurString.Len() <= rStr.Len() &&
- !(nPos > 1 && rStr.GetChar( nPos-2 ) == '[') )
- {
- String aTest( rStr.Copy( nPos-1, sCurString.Len() ) );
- pChrCls->toUpper( aTest );
- if ( aTest == sCurString )
- {
- sSymbol = rStr.Copy( --nPos, sCurString.Len() );
- nPos = nPos + sSymbol.Len();
- eState = SsStop;
- eType = NF_SYMBOLTYPE_STRING;
- return eType;
- }
- }
- switch (cToken)
- {
- case '#':
- case '0':
- case '?':
- case '%':
- case '@':
- case '[':
- case ']':
- case ',':
- case '.':
- case '/':
- case '\'':
- case ' ':
- case ':':
- case '-':
- {
- eType = NF_SYMBOLTYPE_DEL;
- sSymbol += cToken;
- eState = SsStop;
- }
- break;
- case '*':
- {
- eType = NF_SYMBOLTYPE_STAR;
- sSymbol += cToken;
- eState = SsGetStar;
- }
- break;
- case '_':
- {
- eType = NF_SYMBOLTYPE_BLANK;
- sSymbol += cToken;
- eState = SsGetBlank;
- }
- break;
-#if NF_COMMENT_IN_FORMATSTRING
- case '{':
- eType = NF_SYMBOLTYPE_COMMENT;
- eState = SsStop;
- sSymbol.Append( rStr.GetBuffer() + (nPos-1), rStr.Len() - (nPos-1) );
- nPos = rStr.Len();
- break;
-#endif
- case '"':
- eType = NF_SYMBOLTYPE_STRING;
- eState = SsGetString;
- sSymbol += cToken;
- break;
- case '\\':
- eType = NF_SYMBOLTYPE_STRING;
- eState = SsGetChar;
- sSymbol += cToken;
- break;
- case '$':
- case '+':
- case '(':
- case ')':
- eType = NF_SYMBOLTYPE_STRING;
- eState = SsStop;
- sSymbol += cToken;
- break;
- default :
- {
- if (StringEqualsChar( pFormatter->GetNumDecimalSep(), cToken) ||
- StringEqualsChar( pFormatter->GetNumThousandSep(), cToken) ||
- StringEqualsChar( pFormatter->GetDateSep(), cToken) ||
- StringEqualsChar( pLoc->getTimeSep(), cToken) ||
- StringEqualsChar( pLoc->getTime100SecSep(), cToken))
- {
- // Another separator than pre-known ASCII
- eType = NF_SYMBOLTYPE_DEL;
- sSymbol += cToken;
- eState = SsStop;
- }
- else if ( pChrCls->isLetter( rStr, nPos-1 ) )
- {
- short nTmpType = GetKeyWord( rStr, nPos-1 );
- if ( nTmpType )
- {
- BOOL bCurrency = FALSE;
- // "Automatic" currency may start with keyword,
- // like "R" (Rand) and 'R' (era)
- if ( nCurrPos != STRING_NOTFOUND &&
- nPos-1 + sCurString.Len() <= rStr.Len() &&
- sCurString.Search( sKeyword[nTmpType] ) == 0 )
- {
- String aTest( rStr.Copy( nPos-1, sCurString.Len() ) );
- pChrCls->toUpper( aTest );
- if ( aTest == sCurString )
- bCurrency = TRUE;
- }
- if ( bCurrency )
- {
- eState = SsGetWord;
- sSymbol += cToken;
- }
- else
- {
- eType = nTmpType;
- xub_StrLen nLen = sKeyword[eType].Len();
- sSymbol = rStr.Copy( nPos-1, nLen );
- if ( eType == NF_KEY_E || IsAmbiguousE( eType ) )
- {
- sal_Unicode cNext = rStr.GetChar(nPos);
- switch ( cNext )
- {
- case '+' :
- case '-' : // E+ E- combine to one symbol
- sSymbol += cNext;
- eType = NF_KEY_E;
- nPos++;
- break;
- case '0' :
- case '#' : // scientific E without sign
- eType = NF_KEY_E;
- break;
- }
- }
- nPos--;
- nPos = nPos + nLen;
- eState = SsStop;
- }
- }
- else
- {
- eState = SsGetWord;
- sSymbol += cToken;
- }
- }
- else
- {
- eType = NF_SYMBOLTYPE_STRING;
- eState = SsStop;
- sSymbol += cToken;
- }
- }
- break;
- }
- }
- break;
- case SsGetChar:
- {
- sSymbol += cToken;
- eState = SsStop;
- }
- break;
- case SsGetString:
- {
- if (cToken == '"')
- eState = SsStop;
- sSymbol += cToken;
- }
- break;
- case SsGetWord:
- {
- if ( pChrCls->isLetter( rStr, nPos-1 ) )
- {
- short nTmpType = GetKeyWord( rStr, nPos-1 );
- if ( nTmpType )
- { // beginning of keyword, stop scan and put back
- eType = NF_SYMBOLTYPE_STRING;
- eState = SsStop;
- nPos--;
- }
- else
- sSymbol += cToken;
- }
- else
- {
- BOOL bDontStop = FALSE;
- switch (cToken)
- {
- case '/': // AM/PM, A/P
- {
- sal_Unicode cNext = rStr.GetChar(nPos);
- if ( cNext == 'P' || cNext == 'p' )
- {
- xub_StrLen nLen = sSymbol.Len();
- if ( 1 <= nLen
- && (sSymbol.GetChar(0) == 'A' || sSymbol.GetChar(0) == 'a')
- && (nLen == 1 || (nLen == 2
- && (sSymbol.GetChar(1) == 'M' || sSymbol.GetChar(1) == 'm')
- && (rStr.GetChar(nPos+1) == 'M' || rStr.GetChar(nPos+1) == 'm'))) )
- {
- sSymbol += cToken;
- bDontStop = TRUE;
- }
- }
- }
- break;
- }
- // anything not recognized will stop the scan
- if ( eState != SsStop && !bDontStop )
- {
- eState = SsStop;
- nPos--;
- eType = NF_SYMBOLTYPE_STRING;
- }
- }
- }
- break;
- case SsGetStar:
- {
- eState = SsStop;
- sSymbol += cToken;
- nRepPos = (nPos - nStart) - 1; // everytime > 0!!
- }
- break;
- case SsGetBlank:
- {
- eState = SsStop;
- sSymbol += cToken;
- }
- break;
- default:
- break;
- } // of switch
- } // of while
- if (eState == SsGetWord)
- eType = NF_SYMBOLTYPE_STRING;
- return eType;
-}
-
-xub_StrLen ImpSvNumberformatScan::Symbol_Division(const String& rString)
-{
- nCurrPos = STRING_NOTFOUND;
- // Ist Waehrung im Spiel?
- String sString = pFormatter->GetCharClass()->upper(rString);
- xub_StrLen nCPos = 0;
- while (nCPos != STRING_NOTFOUND)
- {
- nCPos = sString.Search(GetCurString(),nCPos);
- if (nCPos != STRING_NOTFOUND)
- {
- // in Quotes?
- xub_StrLen nQ = SvNumberformat::GetQuoteEnd( sString, nCPos );
- if ( nQ == STRING_NOTFOUND )
- {
- sal_Unicode c;
- if ( nCPos == 0 ||
- ((c = sString.GetChar(xub_StrLen(nCPos-1))) != '"'
- && c != '\\') ) // dm kann durch "dm
- { // \d geschuetzt werden
- nCurrPos = nCPos;
- nCPos = STRING_NOTFOUND; // Abbruch
- }
- else
- nCPos++; // weitersuchen
- }
- else
- nCPos = nQ + 1; // weitersuchen
- }
- }
- nAnzStrings = 0;
- BOOL bStar = FALSE; // wird bei '*'Detektion gesetzt
- Reset();
-
- xub_StrLen nPos = 0;
- const xub_StrLen nLen = rString.Len();
- while (nPos < nLen && nAnzStrings < NF_MAX_FORMAT_SYMBOLS)
- {
- nTypeArray[nAnzStrings] = Next_Symbol(rString, nPos, sStrArray[nAnzStrings]);
- if (nTypeArray[nAnzStrings] == NF_SYMBOLTYPE_STAR)
- { // Ueberwachung des '*'
- if (bStar)
- return nPos; // Fehler: doppelter '*'
- else
- bStar = TRUE;
- }
- nAnzStrings++;
- }
-
- return 0; // 0 => ok
-}
-
-void ImpSvNumberformatScan::SkipStrings(USHORT& i, xub_StrLen& nPos)
-{
- while (i < nAnzStrings && ( nTypeArray[i] == NF_SYMBOLTYPE_STRING
- || nTypeArray[i] == NF_SYMBOLTYPE_BLANK
- || nTypeArray[i] == NF_SYMBOLTYPE_STAR) )
- {
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
-}
-
-
-USHORT ImpSvNumberformatScan::PreviousKeyword(USHORT i)
-{
- short res = 0;
- if (i > 0 && i < nAnzStrings)
- {
- i--;
- while (i > 0 && nTypeArray[i] <= 0)
- i--;
- if (nTypeArray[i] > 0)
- res = nTypeArray[i];
- }
- return res;
-}
-
-USHORT ImpSvNumberformatScan::NextKeyword(USHORT i)
-{
- short res = 0;
- if (i < nAnzStrings-1)
- {
- i++;
- while (i < nAnzStrings-1 && nTypeArray[i] <= 0)
- i++;
- if (nTypeArray[i] > 0)
- res = nTypeArray[i];
- }
- return res;
-}
-
-short ImpSvNumberformatScan::PreviousType( USHORT i )
-{
- if ( i > 0 && i < nAnzStrings )
- {
- do
- {
- i--;
- } while ( i > 0 && nTypeArray[i] == NF_SYMBOLTYPE_EMPTY );
- return nTypeArray[i];
- }
- return 0;
-}
-
-sal_Unicode ImpSvNumberformatScan::PreviousChar(USHORT i)
-{
- sal_Unicode res = ' ';
- if (i > 0 && i < nAnzStrings)
- {
- i--;
- while (i > 0 && ( nTypeArray[i] == NF_SYMBOLTYPE_EMPTY
- || nTypeArray[i] == NF_SYMBOLTYPE_STRING
- || nTypeArray[i] == NF_SYMBOLTYPE_STAR
- || nTypeArray[i] == NF_SYMBOLTYPE_BLANK ) )
- i--;
- if (sStrArray[i].Len() > 0)
- res = sStrArray[i].GetChar(xub_StrLen(sStrArray[i].Len()-1));
- }
- return res;
-}
-
-sal_Unicode ImpSvNumberformatScan::NextChar(USHORT i)
-{
- sal_Unicode res = ' ';
- if (i < nAnzStrings-1)
- {
- i++;
- while (i < nAnzStrings-1 &&
- ( nTypeArray[i] == NF_SYMBOLTYPE_EMPTY
- || nTypeArray[i] == NF_SYMBOLTYPE_STRING
- || nTypeArray[i] == NF_SYMBOLTYPE_STAR
- || nTypeArray[i] == NF_SYMBOLTYPE_BLANK))
- i++;
- if (sStrArray[i].Len() > 0)
- res = sStrArray[i].GetChar(0);
- }
- return res;
-}
-
-BOOL ImpSvNumberformatScan::IsLastBlankBeforeFrac(USHORT i)
-{
- BOOL res = TRUE;
- if (i < nAnzStrings-1)
- {
- BOOL bStop = FALSE;
- i++;
- while (i < nAnzStrings-1 && !bStop)
- {
- i++;
- if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL &&
- sStrArray[i].GetChar(0) == '/')
- bStop = TRUE;
- else if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL &&
- sStrArray[i].GetChar(0) == ' ')
- res = FALSE;
- }
- if (!bStop) // kein '/'
- res = FALSE;
- }
- else
- res = FALSE; // kein '/' mehr
-
- return res;
-}
-
-void ImpSvNumberformatScan::Reset()
-{
- nAnzStrings = 0;
- nAnzResStrings = 0;
-#if 0
-// ER 20.06.97 14:05 nicht noetig, wenn nAnzStrings beachtet wird
- for (size_t i = 0; i < NF_MAX_FORMAT_SYMBOLS; i++)
- {
- sStrArray[i].Erase();
- nTypeArray[i] = 0;
- }
-#endif
- eScannedType = NUMBERFORMAT_UNDEFINED;
- nRepPos = 0;
- bExp = FALSE;
- bThousand = FALSE;
- nThousand = 0;
- bDecSep = FALSE;
- nDecPos = -1;
- nExpPos = (USHORT) -1;
- nBlankPos = (USHORT) -1;
- nCntPre = 0;
- nCntPost = 0;
- nCntExp = 0;
- bFrac = FALSE;
- bBlank = FALSE;
- nNatNumModifier = 0;
-}
-
-
-BOOL ImpSvNumberformatScan::Is100SecZero( USHORT i, BOOL bHadDecSep )
-{
- USHORT nIndexPre = PreviousKeyword( i );
- return (nIndexPre == NF_KEY_S || nIndexPre == NF_KEY_SS)
- && (bHadDecSep // S, SS ','
- || (i>0 && nTypeArray[i-1] == NF_SYMBOLTYPE_STRING));
- // SS"any"00 take "any" as a valid decimal separator
-}
-
-
-xub_StrLen ImpSvNumberformatScan::ScanType(const String&)
-{
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
-
- xub_StrLen nPos = 0;
- USHORT i = 0;
- short eNewType;
- BOOL bMatchBracket = FALSE;
- bool bHaveGeneral = false; // if General/Standard encountered
-
- SkipStrings(i, nPos);
- while (i < nAnzStrings)
- {
- if (nTypeArray[i] > 0)
- { // keyword
- switch (nTypeArray[i])
- {
- case NF_KEY_E: // E
- eNewType = NUMBERFORMAT_SCIENTIFIC;
- break;
- case NF_KEY_AMPM: // AM,A,PM,P
- case NF_KEY_AP:
- case NF_KEY_H: // H
- case NF_KEY_HH: // HH
- case NF_KEY_S: // S
- case NF_KEY_SS: // SS
- eNewType = NUMBERFORMAT_TIME;
- break;
- case NF_KEY_M: // M
- case NF_KEY_MM: // MM
- { // minute or month
- USHORT nIndexPre = PreviousKeyword(i);
- USHORT nIndexNex = NextKeyword(i);
- sal_Unicode cChar = PreviousChar(i);
- if (nIndexPre == NF_KEY_H || // H
- nIndexPre == NF_KEY_HH || // HH
- nIndexNex == NF_KEY_S || // S
- nIndexNex == NF_KEY_SS || // SS
- cChar == '[' ) // [M
- {
- eNewType = NUMBERFORMAT_TIME;
- nTypeArray[i] -= 2; // 6 -> 4, 7 -> 5
- }
- else
- eNewType = NUMBERFORMAT_DATE;
- }
- break;
- case NF_KEY_MMM: // MMM
- case NF_KEY_MMMM: // MMMM
- case NF_KEY_MMMMM: // MMMMM
- case NF_KEY_Q: // Q
- case NF_KEY_QQ: // QQ
- case NF_KEY_D: // D
- case NF_KEY_DD: // DD
- case NF_KEY_DDD: // DDD
- case NF_KEY_DDDD: // DDDD
- case NF_KEY_YY: // YY
- case NF_KEY_YYYY: // YYYY
- case NF_KEY_NN: // NN
- case NF_KEY_NNN: // NNN
- case NF_KEY_NNNN: // NNNN
- case NF_KEY_WW : // WW
- case NF_KEY_AAA : // AAA
- case NF_KEY_AAAA : // AAAA
- case NF_KEY_EC : // E
- case NF_KEY_EEC : // EE
- case NF_KEY_G : // G
- case NF_KEY_GG : // GG
- case NF_KEY_GGG : // GGG
- case NF_KEY_R : // R
- case NF_KEY_RR : // RR
- eNewType = NUMBERFORMAT_DATE;
- break;
- case NF_KEY_CCC: // CCC
- eNewType = NUMBERFORMAT_CURRENCY;
- break;
- case NF_KEY_GENERAL: // Standard
- eNewType = NUMBERFORMAT_NUMBER;
- bHaveGeneral = true;
- break;
- default:
- eNewType = NUMBERFORMAT_UNDEFINED;
- break;
- }
- }
- else
- { // control character
- switch ( sStrArray[i].GetChar(0) )
- {
- case '#':
- case '?':
- eNewType = NUMBERFORMAT_NUMBER;
- break;
- case '0':
- {
- if ( (eScannedType & NUMBERFORMAT_TIME) == NUMBERFORMAT_TIME )
- {
- if ( Is100SecZero( i, bDecSep ) )
- {
- bDecSep = TRUE; // subsequent 0's
- eNewType = NUMBERFORMAT_TIME;
- }
- else
- return nPos; // Error
- }
- else
- eNewType = NUMBERFORMAT_NUMBER;
- }
- break;
- case '%':
- eNewType = NUMBERFORMAT_PERCENT;
- break;
- case '/':
- eNewType = NUMBERFORMAT_FRACTION;
- break;
- case '[':
- {
- if ( i < nAnzStrings-1 &&
- nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
- sStrArray[i+1].GetChar(0) == '$' )
- { // as of SV_NUMBERFORMATTER_VERSION_NEW_CURR
- eNewType = NUMBERFORMAT_CURRENCY;
- bMatchBracket = TRUE;
- }
- else if ( i < nAnzStrings-1 &&
- nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
- sStrArray[i+1].GetChar(0) == '~' )
- { // as of SV_NUMBERFORMATTER_VERSION_CALENDAR
- eNewType = NUMBERFORMAT_DATE;
- bMatchBracket = TRUE;
- }
- else
- {
- USHORT nIndexNex = NextKeyword(i);
- if (nIndexNex == NF_KEY_H || // H
- nIndexNex == NF_KEY_HH || // HH
- nIndexNex == NF_KEY_M || // M
- nIndexNex == NF_KEY_MM || // MM
- nIndexNex == NF_KEY_S || // S
- nIndexNex == NF_KEY_SS ) // SS
- eNewType = NUMBERFORMAT_TIME;
- else
- return nPos; // Error
- }
- }
- break;
- case '@':
- eNewType = NUMBERFORMAT_TEXT;
- break;
- default:
- if ( sStrArray[i] == pLoc->getTime100SecSep() )
- bDecSep = TRUE; // for SS,0
- eNewType = NUMBERFORMAT_UNDEFINED;
- break;
- }
- }
- if (eScannedType == NUMBERFORMAT_UNDEFINED)
- eScannedType = eNewType;
- else if (eScannedType == NUMBERFORMAT_TEXT || eNewType == NUMBERFORMAT_TEXT)
- eScannedType = NUMBERFORMAT_TEXT; // Text bleibt immer Text
- else if (eNewType == NUMBERFORMAT_UNDEFINED)
- { // bleibt wie bisher
- }
- else if (eScannedType != eNewType)
- {
- switch (eScannedType)
- {
- case NUMBERFORMAT_DATE:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_TIME:
- eScannedType = NUMBERFORMAT_DATETIME;
- break;
- case NUMBERFORMAT_FRACTION: // DD/MM
- break;
- default:
- {
- if (nCurrPos != STRING_NOTFOUND)
- eScannedType = NUMBERFORMAT_UNDEFINED;
- else if ( sStrArray[i] != pFormatter->GetDateSep() )
- return nPos;
- }
- }
- }
- break;
- case NUMBERFORMAT_TIME:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_DATE:
- eScannedType = NUMBERFORMAT_DATETIME;
- break;
- case NUMBERFORMAT_FRACTION: // MM/SS
- break;
- default:
- {
- if (nCurrPos != STRING_NOTFOUND)
- eScannedType = NUMBERFORMAT_UNDEFINED;
- else if ( sStrArray[i] != pLoc->getTimeSep() )
- return nPos;
- }
- }
- }
- break;
- case NUMBERFORMAT_DATETIME:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_TIME:
- case NUMBERFORMAT_DATE:
- break;
- case NUMBERFORMAT_FRACTION: // DD/MM
- break;
- default:
- {
- if (nCurrPos != STRING_NOTFOUND)
- eScannedType = NUMBERFORMAT_UNDEFINED;
- else if ( sStrArray[i] != pFormatter->GetDateSep()
- && sStrArray[i] != pLoc->getTimeSep() )
- return nPos;
- }
- }
- }
- break;
- case NUMBERFORMAT_PERCENT:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_NUMBER: // nur Zahl nach Prozent
- break;
- default:
- return nPos;
- }
- }
- break;
- case NUMBERFORMAT_SCIENTIFIC:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_NUMBER: // nur Zahl nach E
- break;
- default:
- return nPos;
- }
- }
- break;
- case NUMBERFORMAT_NUMBER:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_SCIENTIFIC:
- case NUMBERFORMAT_PERCENT:
- case NUMBERFORMAT_FRACTION:
- case NUMBERFORMAT_CURRENCY:
- eScannedType = eNewType;
- break;
- default:
- if (nCurrPos != STRING_NOTFOUND)
- eScannedType = NUMBERFORMAT_UNDEFINED;
- else
- return nPos;
- }
- }
- break;
- case NUMBERFORMAT_FRACTION:
- {
- switch (eNewType)
- {
- case NUMBERFORMAT_NUMBER: // nur Zahl nach Bruch
- break;
- default:
- return nPos;
- }
- }
- break;
- default:
- break;
- }
- }
- nPos = nPos + sStrArray[i].Len(); // Korrekturposition
- i++;
- if ( bMatchBracket )
- { // no type detection inside of matching brackets if [$...], [~...]
- while ( bMatchBracket && i < nAnzStrings )
- {
- if ( nTypeArray[i] == NF_SYMBOLTYPE_DEL
- && sStrArray[i].GetChar(0) == ']' )
- bMatchBracket = FALSE;
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- if ( bMatchBracket )
- return nPos; // missing closing bracket at end of code
- }
- SkipStrings(i, nPos);
- }
-
- if ((eScannedType == NUMBERFORMAT_NUMBER || eScannedType == NUMBERFORMAT_UNDEFINED)
- && nCurrPos != STRING_NOTFOUND && !bHaveGeneral)
- eScannedType = NUMBERFORMAT_CURRENCY; // old "automatic" currency
- if (eScannedType == NUMBERFORMAT_UNDEFINED)
- eScannedType = NUMBERFORMAT_DEFINED;
- return 0; // Alles ok
-}
-
-
-bool ImpSvNumberformatScan::InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr )
-{
- if (nAnzStrings >= NF_MAX_FORMAT_SYMBOLS || nPos > nAnzStrings)
- return false;
- ++nAnzResStrings;
- if (nPos > 0 && nTypeArray[nPos-1] == NF_SYMBOLTYPE_EMPTY)
- --nPos; // reuse position
- else
- {
- ++nAnzStrings;
- for (size_t i = nAnzStrings; i > nPos; --i)
- {
- nTypeArray[i] = nTypeArray[i-1];
- sStrArray[i] = sStrArray[i-1];
- }
- }
- nTypeArray[nPos] = static_cast<short>(eType);
- sStrArray[nPos] = rStr;
- return true;
-}
-
-
-int ImpSvNumberformatScan::FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i,
- USHORT& rAnzResStrings )
-{
- if ( sStrArray[i].GetChar(0) == '[' &&
- i < nAnzStrings-1 &&
- nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
- sStrArray[i+1].GetChar(0) == '~' )
- { // [~calendarID]
- // as of SV_NUMBERFORMATTER_VERSION_CALENDAR
- nPos = nPos + sStrArray[i].Len(); // [
- nTypeArray[i] = NF_SYMBOLTYPE_CALDEL;
- nPos = nPos + sStrArray[++i].Len(); // ~
- sStrArray[i-1] += sStrArray[i]; // [~
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- rAnzResStrings--;
- if ( ++i >= nAnzStrings )
- return -1; // error
- nPos = nPos + sStrArray[i].Len(); // calendarID
- String& rStr = sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_CALENDAR; // convert
- i++;
- while ( i < nAnzStrings &&
- sStrArray[i].GetChar(0) != ']' )
- {
- nPos = nPos + sStrArray[i].Len();
- rStr += sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- rAnzResStrings--;
- i++;
- }
- if ( rStr.Len() && i < nAnzStrings &&
- sStrArray[i].GetChar(0) == ']' )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_CALDEL;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- else
- return -1; // error
- return 1;
- }
- return 0;
-}
-
-xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment )
-{
- const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
-
- // save values for convert mode
- String sOldDecSep = pFormatter->GetNumDecimalSep();
- String sOldThousandSep = pFormatter->GetNumThousandSep();
- String sOldDateSep = pFormatter->GetDateSep();
- String sOldTimeSep = pLoc->getTimeSep();
- String sOldTime100SecSep= pLoc->getTime100SecSep();
- String sOldCurSymbol = GetCurSymbol();
- String sOldCurString = GetCurString();
- sal_Unicode cOldKeyH = sKeyword[NF_KEY_H].GetChar(0);
- sal_Unicode cOldKeyMI = sKeyword[NF_KEY_MI].GetChar(0);
- sal_Unicode cOldKeyS = sKeyword[NF_KEY_S].GetChar(0);
-
- // If the group separator is a Non-Breaking Space (French) continue with a
- // normal space instead so queries on space work correctly.
- // The format string is adjusted to allow both.
- // For output of the format code string the LocaleData characters are used.
- if ( sOldThousandSep.GetChar(0) == cNonBreakingSpace && sOldThousandSep.Len() == 1 )
- sOldThousandSep = ' ';
-
- // change locale data et al
- if (bConvertMode)
- {
- pFormatter->ChangeIntl(eNewLnge);
- //! pointer may have changed
- pLoc = pFormatter->GetLocaleData();
- //! init new keywords
- InitKeywords();
- }
- const CharClass* pChrCls = pFormatter->GetCharClass();
-
- xub_StrLen nPos = 0; // error correction position
- USHORT i = 0; // symbol loop counter
- USHORT nCounter = 0; // counts digits
- nAnzResStrings = nAnzStrings; // counts remaining symbols
- bDecSep = FALSE; // reset in case already used in TypeCheck
- bool bThaiT = false; // Thai T NatNum modifier present
-
- switch (eScannedType)
- {
- case NUMBERFORMAT_TEXT:
- case NUMBERFORMAT_DEFINED:
- {
- while (i < nAnzStrings)
- {
- switch (nTypeArray[i])
- {
- case NF_SYMBOLTYPE_BLANK:
- case NF_SYMBOLTYPE_STAR:
- break;
- case NF_SYMBOLTYPE_COMMENT:
- {
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- SvNumberformat::EraseCommentBraces( rStr );
- rComment += rStr;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- break;
- case NF_KEY_GENERAL : // #77026# "General" is the same as "@"
- break;
- default:
- {
- if ( nTypeArray[i] != NF_SYMBOLTYPE_DEL ||
- sStrArray[i].GetChar(0) != '@' )
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- }
- break;
- }
- nPos = nPos + sStrArray[i].Len();
- i++;
- } // of while
- }
- break;
- case NUMBERFORMAT_NUMBER:
- case NUMBERFORMAT_PERCENT:
- case NUMBERFORMAT_CURRENCY:
- case NUMBERFORMAT_SCIENTIFIC:
- case NUMBERFORMAT_FRACTION:
- {
- sal_Unicode cThousandFill = ' ';
- while (i < nAnzStrings)
- {
- if (eScannedType == NUMBERFORMAT_FRACTION && // special case
- nTypeArray[i] == NF_SYMBOLTYPE_DEL && // # ### #/#
- StringEqualsChar( sOldThousandSep, ' ' ) && // e.g. France or Sweden
- StringEqualsChar( sStrArray[i], ' ' ) &&
- !bFrac &&
- IsLastBlankBeforeFrac(i) )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING; // del->string
- } // kein Taus.p.
-
-
- if (nTypeArray[i] == NF_SYMBOLTYPE_BLANK ||
- nTypeArray[i] == NF_SYMBOLTYPE_STAR ||
- nTypeArray[i] == NF_KEY_CCC || // CCC
- nTypeArray[i] == NF_KEY_GENERAL ) // Standard
- {
- if (nTypeArray[i] == NF_KEY_GENERAL)
- {
- nThousand = FLAG_STANDARD_IN_FORMAT;
- if ( bConvertMode )
- sStrArray[i] = sNameStandardFormat;
- }
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- else if (nTypeArray[i] == NF_SYMBOLTYPE_STRING || // Strings oder
- nTypeArray[i] > 0) // Keywords
- {
- if (eScannedType == NUMBERFORMAT_SCIENTIFIC &&
- nTypeArray[i] == NF_KEY_E) // E+
- {
- if (bExp) // doppelt
- return nPos;
- bExp = TRUE;
- nExpPos = i;
- if (bDecSep)
- nCntPost = nCounter;
- else
- nCntPre = nCounter;
- nCounter = 0;
- nTypeArray[i] = NF_SYMBOLTYPE_EXP;
- }
- else if (eScannedType == NUMBERFORMAT_FRACTION &&
- sStrArray[i].GetChar(0) == ' ')
- {
- if (!bBlank && !bFrac) // nicht doppelt oder hinter /
- {
- if (bDecSep && nCounter > 0) // Nachkommastellen
- return nPos; // Fehler
- bBlank = TRUE;
- nBlankPos = i;
- nCntPre = nCounter;
- nCounter = 0;
- }
- nTypeArray[i] = NF_SYMBOLTYPE_FRACBLANK;
- }
- else if (nTypeArray[i] == NF_KEY_THAI_T)
- {
- bThaiT = true;
- sStrArray[i] = sKeyword[nTypeArray[i]];
- }
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- else if (nTypeArray[i] == NF_SYMBOLTYPE_DEL)
- {
- sal_Unicode cHere = sStrArray[i].GetChar(0);
- // Handle not pre-known separators in switch.
- sal_Unicode cSimplified;
- if (StringEqualsChar( pFormatter->GetNumThousandSep(), cHere))
- cSimplified = ',';
- else if (StringEqualsChar( pFormatter->GetNumDecimalSep(), cHere))
- cSimplified = '.';
- else
- cSimplified = cHere;
- switch ( cSimplified )
- {
- case '#':
- case '0':
- case '?':
- {
- if (nThousand > 0) // #... #
- return nPos; // Fehler
- else if (bFrac && cHere == '0')
- return nPos; // 0 im Nenner
- nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- i++;
- nCounter++;
- while (i < nAnzStrings &&
- (sStrArray[i].GetChar(0) == '#' ||
- sStrArray[i].GetChar(0) == '0' ||
- sStrArray[i].GetChar(0) == '?')
- )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
- nPos = nPos + sStrArray[i].Len();
- nCounter++;
- i++;
- }
- }
- break;
- case '-':
- {
- if ( bDecSep && nDecPos+1 == i &&
- nTypeArray[nDecPos] == NF_SYMBOLTYPE_DECSEP )
- { // "0.--"
- nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- i++;
- nCounter++;
- while (i < nAnzStrings &&
- (sStrArray[i].GetChar(0) == '-') )
- {
- // If more than two dashes are present in
- // currency formats the last dash will be
- // interpreted literally as a minus sign.
- // Has to be this ugly. Period.
- if ( eScannedType == NUMBERFORMAT_CURRENCY
- && rStr.Len() >= 2 &&
- (i == nAnzStrings-1 ||
- sStrArray[i+1].GetChar(0) != '-') )
- break;
- rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- nCounter++;
- i++;
- }
- }
- else
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- }
- break;
- case '.':
- case ',':
- case '\'':
- case ' ':
- {
- sal_Unicode cSep = cHere; // remember
- if ( StringEqualsChar( sOldThousandSep, cSep ) )
- {
- // previous char with skip empty
- sal_Unicode cPre = PreviousChar(i);
- sal_Unicode cNext;
- if (bExp || bBlank || bFrac)
- { // after E, / or ' '
- if ( !StringEqualsChar( sOldThousandSep, ' ' ) )
- {
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++; // eat it
- }
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- }
- else if (i > 0 && i < nAnzStrings-1 &&
- (cPre == '#' || cPre == '0') &&
- ((cNext = NextChar(i)) == '#' || cNext == '0')
- ) // #,#
- {
- nPos = nPos + sStrArray[i].Len();
- if (!bThousand) // only once
- {
- bThousand = TRUE;
- cThousandFill = sStrArray[i+1].GetChar(0);
- }
- // Eat it, will be reinserted at proper
- // grouping positions further down.
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- else if (i > 0 && (cPre == '#' || cPre == '0')
- && PreviousType(i) == NF_SYMBOLTYPE_DIGIT
- && nThousand < FLAG_STANDARD_IN_FORMAT )
- { // #,,,,
- if ( StringEqualsChar( sOldThousandSep, ' ' ) )
- { // strange, those French..
- BOOL bFirst = TRUE;
- String& rStr = sStrArray[i];
- // set a hard Non-Breaking Space or ConvertMode
- const String& rSepF = pFormatter->GetNumThousandSep();
- while ( i < nAnzStrings
- && sStrArray[i] == sOldThousandSep
- && StringEqualsChar( sOldThousandSep, NextChar(i) ) )
- { // last was a space or another space
- // is following => separator
- nPos = nPos + sStrArray[i].Len();
- if ( bFirst )
- {
- bFirst = FALSE;
- rStr = rSepF;
- nTypeArray[i] = NF_SYMBOLTYPE_THSEP;
- }
- else
- {
- rStr += rSepF;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- nThousand++;
- i++;
- }
- if ( i < nAnzStrings-1
- && sStrArray[i] == sOldThousandSep )
- { // something following last space
- // => space if currency contained,
- // else separator
- nPos = nPos + sStrArray[i].Len();
- if ( (nPos <= nCurrPos &&
- nCurrPos < nPos + sStrArray[i+1].Len())
- || nTypeArray[i+1] == NF_KEY_CCC
- || (i < nAnzStrings-2 &&
- sStrArray[i+1].GetChar(0) == '[' &&
- sStrArray[i+2].GetChar(0) == '$') )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- }
- else
- {
- if ( bFirst )
- {
- bFirst = FALSE;
- rStr = rSepF;
- nTypeArray[i] = NF_SYMBOLTYPE_THSEP;
- }
- else
- {
- rStr += rSepF;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- nThousand++;
- }
- i++;
- }
- }
- else
- {
- do
- {
- nThousand++;
- nTypeArray[i] = NF_SYMBOLTYPE_THSEP;
- nPos = nPos + sStrArray[i].Len();
- sStrArray[i] = pFormatter->GetNumThousandSep();
- i++;
- } while (i < nAnzStrings &&
- sStrArray[i] == sOldThousandSep);
- }
- }
- else // any grsep
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- i++;
- while ( i < nAnzStrings &&
- sStrArray[i] == sOldThousandSep )
- {
- rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- }
- }
- else if ( StringEqualsChar( sOldDecSep, cSep ) )
- {
- if (bBlank || bFrac) // . behind / or ' '
- return nPos; // error
- else if (bExp) // behind E
- {
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++; // eat it
- }
- else if (bDecSep) // any .
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- i++;
- while ( i < nAnzStrings &&
- sStrArray[i] == sOldDecSep )
- {
- rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- }
- else
- {
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_DECSEP;
- sStrArray[i] = pFormatter->GetNumDecimalSep();
- bDecSep = TRUE;
- nDecPos = i;
- nCntPre = nCounter;
- nCounter = 0;
-
- i++;
- }
- } // of else = DecSep
- else // . without meaning
- {
- if (cSep == ' ' &&
- eScannedType == NUMBERFORMAT_FRACTION &&
- StringEqualsChar( sStrArray[i], ' ' ) )
- {
- if (!bBlank && !bFrac) // no dups
- { // or behind /
- if (bDecSep && nCounter > 0)// dec.
- return nPos; // error
- bBlank = TRUE;
- nBlankPos = i;
- nCntPre = nCounter;
- nCounter = 0;
- }
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- }
- else
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- i++;
- while (i < nAnzStrings &&
- StringEqualsChar( sStrArray[i], cSep ) )
- {
- rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- }
- }
- }
- break;
- case '/':
- {
- if (eScannedType == NUMBERFORMAT_FRACTION)
- {
- if ( i == 0 ||
- (nTypeArray[i-1] != NF_SYMBOLTYPE_DIGIT &&
- nTypeArray[i-1] != NF_SYMBOLTYPE_EMPTY) )
- return nPos ? nPos : 1; // /? not allowed
- else if (!bFrac || (bDecSep && nCounter > 0))
- {
- bFrac = TRUE;
- nCntPost = nCounter;
- nCounter = 0;
- nTypeArray[i] = NF_SYMBOLTYPE_FRAC;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- else // / doppelt od. , imZaehl
- return nPos; // Fehler
- }
- else
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- }
- break;
- case '[' :
- {
- if ( eScannedType == NUMBERFORMAT_CURRENCY &&
- i < nAnzStrings-1 &&
- nTypeArray[i+1] == NF_SYMBOLTYPE_STRING &&
- sStrArray[i+1].GetChar(0) == '$' )
- { // [$DM-xxx]
- // ab SV_NUMBERFORMATTER_VERSION_NEW_CURR
- nPos = nPos + sStrArray[i].Len(); // [
- nTypeArray[i] = NF_SYMBOLTYPE_CURRDEL;
- nPos = nPos + sStrArray[++i].Len(); // $
- sStrArray[i-1] += sStrArray[i]; // [$
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- if ( ++i >= nAnzStrings )
- return nPos; // Fehler
- nPos = nPos + sStrArray[i].Len(); // DM
- String& rStr = sStrArray[i];
- String* pStr = &sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_CURRENCY; // wandeln
- BOOL bHadDash = FALSE;
- i++;
- while ( i < nAnzStrings &&
- sStrArray[i].GetChar(0) != ']' )
- {
- nPos = nPos + sStrArray[i].Len();
- if ( bHadDash )
- {
- *pStr += sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- else
- {
- if ( sStrArray[i].GetChar(0) == '-' )
- {
- bHadDash = TRUE;
- pStr = &sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_CURREXT;
- }
- else
- {
- *pStr += sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- }
- i++;
- }
- if ( rStr.Len() && i < nAnzStrings &&
- sStrArray[i].GetChar(0) == ']' )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_CURRDEL;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- else
- return nPos; // Fehler
- }
- else
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- }
- break;
- default: // andere Dels
- {
- if (eScannedType == NUMBERFORMAT_PERCENT &&
- cHere == '%')
- nTypeArray[i] = NF_SYMBOLTYPE_PERCENT;
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- } // of switch (Del)
- } // of else Del
- else if ( nTypeArray[i] == NF_SYMBOLTYPE_COMMENT )
- {
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- SvNumberformat::EraseCommentBraces( rStr );
- rComment += rStr;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- else
- {
- DBG_ERRORFILE( "unknown NF_SYMBOLTYPE_..." );
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- } // of while
- if (eScannedType == NUMBERFORMAT_FRACTION)
- {
- if (bFrac)
- nCntExp = nCounter;
- else if (bBlank)
- nCntPost = nCounter;
- else
- nCntPre = nCounter;
- }
- else
- {
- if (bExp)
- nCntExp = nCounter;
- else if (bDecSep)
- nCntPost = nCounter;
- else
- nCntPre = nCounter;
- }
- if (bThousand) // Expansion of grouping separators
- {
- USHORT nMaxPos;
- if (bFrac)
- {
- if (bBlank)
- nMaxPos = nBlankPos;
- else
- nMaxPos = 0; // no grouping
- }
- else if (bDecSep) // decimal separator present
- nMaxPos = nDecPos;
- else if (bExp) // 'E' exponent present
- nMaxPos = nExpPos;
- else // up to end
- nMaxPos = i;
- // Insert separators at proper positions.
- xub_StrLen nCount = 0;
- utl::DigitGroupingIterator aGrouping( pLoc->getDigitGrouping());
- size_t nFirstDigitSymbol = nMaxPos;
- size_t nFirstGroupingSymbol = nMaxPos;
- i = nMaxPos;
- while (i-- > 0)
- {
- if (nTypeArray[i] == NF_SYMBOLTYPE_DIGIT)
- {
- nFirstDigitSymbol = i;
- nCount = nCount + sStrArray[i].Len(); // MSC converts += to int and then warns, so ...
- // Insert separator only if not leftmost symbol.
- if (i > 0 && nCount >= aGrouping.getPos())
- {
- DBG_ASSERT( sStrArray[i].Len() == 1,
- "ImpSvNumberformatScan::FinalScan: combined digits in group separator insertion");
- if (!InsertSymbol( i, NF_SYMBOLTYPE_THSEP,
- pFormatter->GetNumThousandSep()))
- // nPos isn't correct here, but signals error
- return nPos;
- // i may have been decremented by 1
- nFirstDigitSymbol = i + 1;
- nFirstGroupingSymbol = i;
- aGrouping.advance();
- }
- }
- }
- // Generated something like "string",000; remove separator again.
- if (nFirstGroupingSymbol < nFirstDigitSymbol)
- {
- nTypeArray[nFirstGroupingSymbol] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- }
- // Combine digits into groups to save memory (Info will be copied
- // later, taking only non-empty symbols).
- for (i = 0; i < nAnzStrings; ++i)
- {
- if (nTypeArray[i] == NF_SYMBOLTYPE_DIGIT)
- {
- String& rStr = sStrArray[i];
- while (++i < nAnzStrings &&
- nTypeArray[i] == NF_SYMBOLTYPE_DIGIT)
- {
- rStr += sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- }
- }
- }
- break; // of NUMBERFORMAT_NUMBER
- case NUMBERFORMAT_DATE:
- {
- while (i < nAnzStrings)
- {
- switch (nTypeArray[i])
- {
- case NF_SYMBOLTYPE_BLANK:
- case NF_SYMBOLTYPE_STAR:
- case NF_SYMBOLTYPE_STRING:
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- case NF_SYMBOLTYPE_COMMENT:
- {
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- SvNumberformat::EraseCommentBraces( rStr );
- rComment += rStr;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- break;
- case NF_SYMBOLTYPE_DEL:
- {
- int nCalRet;
- if (sStrArray[i] == sOldDateSep)
- {
- nTypeArray[i] = NF_SYMBOLTYPE_DATESEP;
- nPos = nPos + sStrArray[i].Len();
- if (bConvertMode)
- sStrArray[i] = pFormatter->GetDateSep();
- i++;
- }
- else if ( (nCalRet = FinalScanGetCalendar( nPos, i, nAnzResStrings )) != 0 )
- {
- if ( nCalRet < 0 )
- return nPos; // error
- }
- else
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- }
- break;
- case NF_KEY_THAI_T :
- bThaiT = true;
- // fall thru
- case NF_KEY_M: // M
- case NF_KEY_MM: // MM
- case NF_KEY_MMM: // MMM
- case NF_KEY_MMMM: // MMMM
- case NF_KEY_MMMMM: // MMMMM
- case NF_KEY_Q: // Q
- case NF_KEY_QQ: // QQ
- case NF_KEY_D: // D
- case NF_KEY_DD: // DD
- case NF_KEY_DDD: // DDD
- case NF_KEY_DDDD: // DDDD
- case NF_KEY_YY: // YY
- case NF_KEY_YYYY: // YYYY
- case NF_KEY_NN: // NN
- case NF_KEY_NNN: // NNN
- case NF_KEY_NNNN: // NNNN
- case NF_KEY_WW : // WW
- case NF_KEY_AAA : // AAA
- case NF_KEY_AAAA : // AAAA
- case NF_KEY_EC : // E
- case NF_KEY_EEC : // EE
- case NF_KEY_G : // G
- case NF_KEY_GG : // GG
- case NF_KEY_GGG : // GGG
- case NF_KEY_R : // R
- case NF_KEY_RR : // RR
- sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- default: // andere Keywords
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- }
- } // of while
- }
- break; // of NUMBERFORMAT_DATE
- case NUMBERFORMAT_TIME:
- {
- while (i < nAnzStrings)
- {
- switch (nTypeArray[i])
- {
- case NF_SYMBOLTYPE_BLANK:
- case NF_SYMBOLTYPE_STAR:
- {
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- case NF_SYMBOLTYPE_DEL:
- {
- switch( sStrArray[i].GetChar(0) )
- {
- case '0':
- {
- if ( Is100SecZero( i, bDecSep ) )
- {
- bDecSep = TRUE;
- nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
- String& rStr = sStrArray[i];
- i++;
- nPos = nPos + sStrArray[i].Len();
- nCounter++;
- while (i < nAnzStrings &&
- sStrArray[i].GetChar(0) == '0')
- {
- rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- nCounter++;
- i++;
- }
- }
- else
- return nPos;
- }
- break;
- case '#':
- case '?':
- return nPos;
- case '[':
- {
- if (bThousand) // doppelt
- return nPos;
- bThousand = TRUE; // bei Time frei
- sal_Unicode cChar = pChrCls->upper( NextChar(i) ).GetChar(0);
- if ( cChar == cOldKeyH )
- nThousand = 1; // H
- else if ( cChar == cOldKeyMI )
- nThousand = 2; // M
- else if ( cChar == cOldKeyS )
- nThousand = 3; // S
- else
- return nPos;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- case ']':
- {
- if (!bThousand) // kein [ vorher
- return nPos;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- default:
- {
- nPos = nPos + sStrArray[i].Len();
- if ( sStrArray[i] == sOldTimeSep )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_TIMESEP;
- if ( bConvertMode )
- sStrArray[i] = pLoc->getTimeSep();
- }
- else if ( sStrArray[i] == sOldTime100SecSep )
- {
- bDecSep = TRUE;
- nTypeArray[i] = NF_SYMBOLTYPE_TIME100SECSEP;
- if ( bConvertMode )
- sStrArray[i] = pLoc->getTime100SecSep();
- }
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- i++;
- }
- break;
- }
- }
- break;
- case NF_SYMBOLTYPE_STRING:
- {
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- case NF_SYMBOLTYPE_COMMENT:
- {
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- SvNumberformat::EraseCommentBraces( rStr );
- rComment += rStr;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- break;
- case NF_KEY_AMPM: // AM/PM
- case NF_KEY_AP: // A/P
- {
- bExp = TRUE; // missbraucht fuer A/P
- sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- case NF_KEY_THAI_T :
- bThaiT = true;
- // fall thru
- case NF_KEY_MI: // M
- case NF_KEY_MMI: // MM
- case NF_KEY_H: // H
- case NF_KEY_HH: // HH
- case NF_KEY_S: // S
- case NF_KEY_SS: // SS
- {
- sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- default: // andere Keywords
- {
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- }
- } // of while
- nCntPost = nCounter; // Zaehler der Nullen
- if (bExp)
- nCntExp = 1; // merkt AM/PM
- }
- break; // of NUMBERFORMAT_TIME
- case NUMBERFORMAT_DATETIME:
- {
- BOOL bTimePart = FALSE;
- while (i < nAnzStrings)
- {
- switch (nTypeArray[i])
- {
- case NF_SYMBOLTYPE_BLANK:
- case NF_SYMBOLTYPE_STAR:
- case NF_SYMBOLTYPE_STRING:
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- case NF_SYMBOLTYPE_COMMENT:
- {
- String& rStr = sStrArray[i];
- nPos = nPos + rStr.Len();
- SvNumberformat::EraseCommentBraces( rStr );
- rComment += rStr;
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- i++;
- }
- break;
- case NF_SYMBOLTYPE_DEL:
- {
- int nCalRet;
- if ( (nCalRet = FinalScanGetCalendar( nPos, i, nAnzResStrings )) != 0 )
- {
- if ( nCalRet < 0 )
- return nPos; // error
- }
- else
- {
- switch( sStrArray[i].GetChar(0) )
- {
- case '0':
- {
- if ( bTimePart && Is100SecZero( i, bDecSep ) )
- {
- bDecSep = TRUE;
- nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
- String& rStr = sStrArray[i];
- i++;
- nPos = nPos + sStrArray[i].Len();
- nCounter++;
- while (i < nAnzStrings &&
- sStrArray[i].GetChar(0) == '0')
- {
- rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].Len();
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- nCounter++;
- i++;
- }
- }
- else
- return nPos;
- }
- break;
- case '#':
- case '?':
- return nPos;
- default:
- {
- nPos = nPos + sStrArray[i].Len();
- if (bTimePart)
- {
- if ( sStrArray[i] == sOldTimeSep )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_TIMESEP;
- if ( bConvertMode )
- sStrArray[i] = pLoc->getTimeSep();
- }
- else if ( sStrArray[i] == sOldTime100SecSep )
- {
- bDecSep = TRUE;
- nTypeArray[i] = NF_SYMBOLTYPE_TIME100SECSEP;
- if ( bConvertMode )
- sStrArray[i] = pLoc->getTime100SecSep();
- }
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- }
- else
- {
- if ( sStrArray[i] == sOldDateSep )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_DATESEP;
- if (bConvertMode)
- sStrArray[i] = pFormatter->GetDateSep();
- }
- else
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- }
- i++;
- }
- }
- }
- }
- break;
- case NF_KEY_AMPM: // AM/PM
- case NF_KEY_AP: // A/P
- {
- bTimePart = TRUE;
- bExp = TRUE; // missbraucht fuer A/P
- sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
- nPos = nPos + sStrArray[i].Len();
- i++;
- }
- break;
- case NF_KEY_MI: // M
- case NF_KEY_MMI: // MM
- case NF_KEY_H: // H
- case NF_KEY_HH: // HH
- case NF_KEY_S: // S
- case NF_KEY_SS: // SS
- bTimePart = TRUE;
- sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- case NF_KEY_M: // M
- case NF_KEY_MM: // MM
- case NF_KEY_MMM: // MMM
- case NF_KEY_MMMM: // MMMM
- case NF_KEY_MMMMM: // MMMMM
- case NF_KEY_Q: // Q
- case NF_KEY_QQ: // QQ
- case NF_KEY_D: // D
- case NF_KEY_DD: // DD
- case NF_KEY_DDD: // DDD
- case NF_KEY_DDDD: // DDDD
- case NF_KEY_YY: // YY
- case NF_KEY_YYYY: // YYYY
- case NF_KEY_NN: // NN
- case NF_KEY_NNN: // NNN
- case NF_KEY_NNNN: // NNNN
- case NF_KEY_WW : // WW
- case NF_KEY_AAA : // AAA
- case NF_KEY_AAAA : // AAAA
- case NF_KEY_EC : // E
- case NF_KEY_EEC : // EE
- case NF_KEY_G : // G
- case NF_KEY_GG : // GG
- case NF_KEY_GGG : // GGG
- case NF_KEY_R : // R
- case NF_KEY_RR : // RR
- bTimePart = FALSE;
- sStrArray[i] = sKeyword[nTypeArray[i]]; // tTtT -> TTTT
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- case NF_KEY_THAI_T :
- bThaiT = true;
- sStrArray[i] = sKeyword[nTypeArray[i]];
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- default: // andere Keywords
- nTypeArray[i] = NF_SYMBOLTYPE_STRING;
- nPos = nPos + sStrArray[i].Len();
- i++;
- break;
- }
- } // of while
- nCntPost = nCounter; // decimals (100th seconds)
- if (bExp)
- nCntExp = 1; // merkt AM/PM
- }
- break; // of NUMBERFORMAT_DATETIME
- default:
- break;
- }
- if (eScannedType == NUMBERFORMAT_SCIENTIFIC &&
- (nCntPre + nCntPost == 0 || nCntExp == 0))
- return nPos;
- else if (eScannedType == NUMBERFORMAT_FRACTION && (nCntExp > 8 || nCntExp == 0))
- return nPos;
-
- if (bThaiT && !GetNatNumModifier())
- SetNatNumModifier(1);
-
- if ( bConvertMode )
- { // strings containing keywords of the target locale must be quoted, so
- // the user sees the difference and is able to edit the format string
- for ( i=0; i < nAnzStrings; i++ )
- {
- if ( nTypeArray[i] == NF_SYMBOLTYPE_STRING &&
- sStrArray[i].GetChar(0) != '\"' )
- {
- if ( bConvertSystemToSystem && eScannedType == NUMBERFORMAT_CURRENCY )
- { // don't stringize automatic currency, will be converted
- if ( sStrArray[i] == sOldCurSymbol )
- continue; // for
- // DM might be splitted into D and M
- if ( sStrArray[i].Len() < sOldCurSymbol.Len() &&
- pChrCls->toUpper( sStrArray[i], 0, 1 ).GetChar(0) ==
- sOldCurString.GetChar(0) )
- {
- String aTmp( sStrArray[i] );
- USHORT j = i + 1;
- while ( aTmp.Len() < sOldCurSymbol.Len() &&
- j < nAnzStrings &&
- nTypeArray[j] == NF_SYMBOLTYPE_STRING )
- {
- aTmp += sStrArray[j++];
- }
- if ( pChrCls->upper( aTmp ) == sOldCurString )
- {
- sStrArray[i++] = aTmp;
- for ( ; i<j; i++ )
- {
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- i = j - 1;
- continue; // for
- }
- }
- }
- String& rStr = sStrArray[i];
- xub_StrLen nLen = rStr.Len();
- for ( xub_StrLen j=0; j<nLen; j++ )
- {
- if ( (j == 0 || rStr.GetChar(j-1) != '\\') && GetKeyWord( rStr, j ) )
- {
- rStr.Insert( '\"', 0 );
- rStr += '\"';
- break; // for
- }
- }
- }
- }
- }
- // concatenate strings, remove quotes for output, and rebuild the format string
- rString.Erase();
- i = 0;
- while (i < nAnzStrings)
- {
- switch ( nTypeArray[i] )
- {
- case NF_SYMBOLTYPE_STRING :
- {
- xub_StrLen nStringPos = rString.Len();
- xub_StrLen nArrPos = 0;
- USHORT iPos = i;
- do
- {
- if (sStrArray[i].Len() == 2 &&
- sStrArray[i].GetChar(0) == '\\')
- {
- // Unescape some simple forms of symbols even in the UI
- // visible string to prevent duplicates that differ
- // only in notation, originating from import.
- // e.g. YYYY-MM-DD and YYYY\-MM\-DD are identical,
- // but 0\ 000 0 and 0 000 0 in a French locale are not.
- sal_Unicode c = sStrArray[i].GetChar(1);
- switch (c)
- {
- case '+':
- case '-':
- rString += c;
- break;
- case ' ':
- case '.':
- case '/':
- if (((eScannedType & NUMBERFORMAT_DATE) == 0)
- && (StringEqualsChar(
- pFormatter->GetNumThousandSep(),
- c) || StringEqualsChar(
- pFormatter->GetNumDecimalSep(),
- c) || (c == ' ' &&
- StringEqualsChar(
- pFormatter->GetNumThousandSep(),
- cNonBreakingSpace))))
- rString += sStrArray[i];
- else if ((eScannedType & NUMBERFORMAT_DATE) &&
- StringEqualsChar(
- pFormatter->GetDateSep(), c))
- rString += sStrArray[i];
- else if ((eScannedType & NUMBERFORMAT_TIME) &&
- (StringEqualsChar( pLoc->getTimeSep(),
- c) ||
- StringEqualsChar(
- pLoc->getTime100SecSep(), c)))
- rString += sStrArray[i];
- else if (eScannedType & NUMBERFORMAT_FRACTION)
- rString += sStrArray[i];
- else
- rString += c;
- break;
- default:
- rString += sStrArray[i];
- }
- }
- else
- rString += sStrArray[i];
- if ( RemoveQuotes( sStrArray[i] ) > 0 )
- { // update currency up to quoted string
- if ( eScannedType == NUMBERFORMAT_CURRENCY )
- { // dM -> DM or DM -> $ in old automatic
- // currency formats, oh my ..., why did we ever
- // introduce them?
- String aTmp( pChrCls->toUpper(
- sStrArray[iPos], nArrPos,
- sStrArray[iPos].Len()-nArrPos ) );
- xub_StrLen nCPos = aTmp.Search( sOldCurString );
- if ( nCPos != STRING_NOTFOUND )
- {
- const String& rCur =
- bConvertMode && bConvertSystemToSystem ?
- GetCurSymbol() : sOldCurSymbol;
- sStrArray[iPos].Replace( nArrPos+nCPos,
- sOldCurString.Len(), rCur );
- rString.Replace( nStringPos+nCPos,
- sOldCurString.Len(), rCur );
- }
- nStringPos = rString.Len();
- if ( iPos == i )
- nArrPos = sStrArray[iPos].Len();
- else
- nArrPos = sStrArray[iPos].Len() + sStrArray[i].Len();
- }
- }
- if ( iPos != i )
- {
- sStrArray[iPos] += sStrArray[i];
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- i++;
- } while ( i < nAnzStrings && nTypeArray[i] == NF_SYMBOLTYPE_STRING );
- if ( i < nAnzStrings )
- i--; // enter switch on next symbol again
- if ( eScannedType == NUMBERFORMAT_CURRENCY && nStringPos < rString.Len() )
- { // same as above, since last RemoveQuotes
- String aTmp( pChrCls->toUpper(
- sStrArray[iPos], nArrPos,
- sStrArray[iPos].Len()-nArrPos ) );
- xub_StrLen nCPos = aTmp.Search( sOldCurString );
- if ( nCPos != STRING_NOTFOUND )
- {
- const String& rCur =
- bConvertMode && bConvertSystemToSystem ?
- GetCurSymbol() : sOldCurSymbol;
- sStrArray[iPos].Replace( nArrPos+nCPos,
- sOldCurString.Len(), rCur );
- rString.Replace( nStringPos+nCPos,
- sOldCurString.Len(), rCur );
- }
- }
- }
- break;
- case NF_SYMBOLTYPE_CURRENCY :
- {
- rString += sStrArray[i];
- RemoveQuotes( sStrArray[i] );
- }
- break;
- case NF_KEY_THAI_T:
- if (bThaiT && GetNatNumModifier() == 1)
- { // Remove T from format code, will be replaced with a [NatNum1] prefix.
- nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
- nAnzResStrings--;
- }
- else
- rString += sStrArray[i];
- break;
- case NF_SYMBOLTYPE_EMPTY :
- // nothing
- break;
- default:
- rString += sStrArray[i];
- }
- i++;
- }
- return 0;
-}
-
-
-xub_StrLen ImpSvNumberformatScan::RemoveQuotes( String& rStr )
-{
- if ( rStr.Len() > 1 )
- {
- sal_Unicode c = rStr.GetChar(0);
- xub_StrLen n;
- if ( c == '"' && rStr.GetChar( (n = xub_StrLen(rStr.Len()-1)) ) == '"' )
- {
- rStr.Erase(n,1);
- rStr.Erase(0,1);
- return 2;
- }
- else if ( c == '\\' )
- {
- rStr.Erase(0,1);
- return 1;
- }
- }
- return 0;
-}
-
-
-xub_StrLen ImpSvNumberformatScan::ScanFormat( String& rString, String& rComment )
-{
- xub_StrLen res = Symbol_Division(rString); //lexikalische Analyse
- if (!res)
- res = ScanType(rString); // Erkennung des Formattyps
- if (!res)
- res = FinalScan( rString, rComment ); // Typabhaengige Endanalyse
- return res; // res = Kontrollposition
- // res = 0 => Format ok
-}
-
-void ImpSvNumberformatScan::CopyInfo(ImpSvNumberformatInfo* pInfo, USHORT nAnz)
-{
- size_t i,j;
- j = 0;
- i = 0;
- while (i < nAnz && j < NF_MAX_FORMAT_SYMBOLS)
- {
- if (nTypeArray[j] != NF_SYMBOLTYPE_EMPTY)
- {
- pInfo->sStrArray[i] = sStrArray[j];
- pInfo->nTypeArray[i] = nTypeArray[j];
- i++;
- }
- j++;
- }
- pInfo->eScannedType = eScannedType;
- pInfo->bThousand = bThousand;
- pInfo->nThousand = nThousand;
- pInfo->nCntPre = nCntPre;
- pInfo->nCntPost = nCntPost;
- pInfo->nCntExp = nCntExp;
-}
-
-
diff --git a/svtools/source/numbers/zforscan.hxx b/svtools/source/numbers/zforscan.hxx
deleted file mode 100644
index bc19ac5b633f..000000000000
--- a/svtools/source/numbers/zforscan.hxx
+++ /dev/null
@@ -1,278 +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: zforscan.hxx,v $
- * $Revision: 1.24.136.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _ZFORSCAN_HXX
-#define _ZFORSCAN_HXX
-
-#include <tools/string.hxx>
-#include <tools/date.hxx>
-#include <i18npool/lang.h>
-#include <tools/color.hxx>
-#include <svtools/nfkeytab.hxx>
-#include "nfsymbol.hxx"
-
-class SvNumberFormatter;
-struct ImpSvNumberformatInfo;
-
-
-const size_t NF_MAX_FORMAT_SYMBOLS = 100;
-const size_t NF_MAX_DEFAULT_COLORS = 10;
-
-// Hack: nThousand==1000 => "Default" occurs in format string
-const USHORT FLAG_STANDARD_IN_FORMAT = 1000;
-
-class ImpSvNumberformatScan
-{
-public:
-
- ImpSvNumberformatScan( SvNumberFormatter* pFormatter );
- ~ImpSvNumberformatScan();
- void ChangeIntl(); // tauscht Keywords aus
-
- void ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear);
- // tauscht Referenzdatum aus
- void ChangeStandardPrec(short nPrec); // tauscht Standardprecision aus
-
- xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse
-
- void CopyInfo(ImpSvNumberformatInfo* pInfo,
- USHORT nAnz); // Kopiert die FormatInfo
- USHORT GetAnzResStrings() const { return nAnzResStrings; }
-
- const CharClass& GetChrCls() const { return *pFormatter->GetCharClass(); }
- const LocaleDataWrapper& GetLoc() const { return *pFormatter->GetLocaleData(); }
- CalendarWrapper& GetCal() const { return *pFormatter->GetCalendar(); }
-
- const String* GetKeywords() const
- {
- if ( bKeywordsNeedInit )
- InitKeywords();
- return sKeyword;
- }
- // Keywords used in output like TRUE and FALSE
- const String& GetSpecialKeyword( NfKeywordIndex eIdx ) const
- {
- if ( !sKeyword[eIdx].Len() )
- InitSpecialKeyword( eIdx );
- return sKeyword[eIdx];
- }
- const String& GetTrueString() const { return GetSpecialKeyword( NF_KEY_TRUE ); }
- const String& GetFalseString() const { return GetSpecialKeyword( NF_KEY_FALSE ); }
- const String& GetColorString() const { return GetKeywords()[NF_KEY_COLOR]; }
- const String& GetRedString() const { return GetKeywords()[NF_KEY_RED]; }
- const String& GetBooleanString() const { return GetKeywords()[NF_KEY_BOOLEAN]; }
- const String& GetErrorString() const { return sErrStr; }
-
- Date* GetNullDate() const { return pNullDate; }
- const String& GetStandardName() const
- {
- if ( bKeywordsNeedInit )
- InitKeywords();
- return sNameStandardFormat;
- }
- short GetStandardPrec() const { return nStandardPrec; }
- const Color& GetRedColor() const { return StandardColor[4]; }
- Color* GetColor(String& sStr); // Setzt Hauptfarben oder
- // definierte Farben
-
- // the compatibility currency symbol for old automatic currency formats
- const String& GetCurSymbol() const
- {
- if ( bCompatCurNeedInit )
- InitCompatCur();
- return sCurSymbol;
- }
-
- // the compatibility currency abbreviation for CCC format code
- const String& GetCurAbbrev() const
- {
- if ( bCompatCurNeedInit )
- InitCompatCur();
- return sCurAbbrev;
- }
-
- // the compatibility currency symbol upper case for old automatic currency formats
- const String& GetCurString() const
- {
- if ( bCompatCurNeedInit )
- InitCompatCur();
- return sCurString;
- }
-
- void SetConvertMode(LanguageType eTmpLge, LanguageType eNewLge,
- BOOL bSystemToSystem = FALSE )
- {
- bConvertMode = TRUE;
- eNewLnge = eNewLge;
- eTmpLnge = eTmpLge;
- bConvertSystemToSystem = bSystemToSystem;
- }
- void SetConvertMode(BOOL bMode) { bConvertMode = bMode; }
- // Veraendert nur die Bool-Variable
- // (zum temporaeren Unterbrechen des
- // Convert-Modus)
- BOOL GetConvertMode() const { return bConvertMode; }
- LanguageType GetNewLnge() const { return eNewLnge; }
- // Lesezugriff auf ConvertMode
- // und Konvertierungsland/Spr.
- LanguageType GetTmpLnge() const { return eTmpLnge; }
- // Lesezugriff auf
- // und Ausgangsland/Spr.
-
- /// get Thai T speciality
- BYTE GetNatNumModifier() const { return nNatNumModifier; }
- /// set Thai T speciality
- void SetNatNumModifier( BYTE n ) { nNatNumModifier = n; }
-
- SvNumberFormatter* GetNumberformatter() { return pFormatter; }
- // Zugriff auf Formatierer
- // (fuer zformat.cxx)
-
-
-private: // ---- privater Teil
- NfKeywordTable sKeyword; // Schluesselworte der Syntax
- Color StandardColor[NF_MAX_DEFAULT_COLORS];
- // Array der Standardfarben
- Date* pNullDate; // 30Dec1899
- String sNameStandardFormat; // "Standard"
- short nStandardPrec; // default Precision fuer Standardformat (2)
- SvNumberFormatter* pFormatter; // Pointer auf die Formatliste
-
- String sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Symbole
- short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array der Infos
- // externe Infos:
- USHORT nAnzResStrings; // Anzahl der Ergebnissymbole
-#if !(defined SOLARIS && defined X86)
- short eScannedType; // Typ gemaess Scan
-#else
- int eScannedType; // wg. Optimierung
-#endif
- BOOL bThousand; // Mit Tausenderpunkt
- USHORT nThousand; // Zaehlt ....-Folgen
- USHORT nCntPre; // Zaehlt Vorkommastellen
- USHORT nCntPost; // Zaehlt Nachkommastellen
- USHORT nCntExp; // Zaehlt Exp.Stellen, AM/PM
- // interne Infos:
- USHORT nAnzStrings; // Anzahl der Symbole
- USHORT nRepPos; // Position eines '*'
- USHORT nExpPos; // interne Position des E
- USHORT nBlankPos; // interne Position des Blank
- short nDecPos; // interne Pos. des ,
- BOOL bExp; // wird bei Lesen des E gesetzt
- BOOL bFrac; // wird bei Lesen des / gesetzt
- BOOL bBlank; // wird bei ' '(Fraction) ges.
- BOOL bDecSep; // Wird beim ersten , gesetzt
- mutable BOOL bKeywordsNeedInit; // Locale dependent keywords need to be initialized
- mutable BOOL bCompatCurNeedInit; // Locale dependent compatibility currency need to be initialized
- String sCurSymbol; // Currency symbol for compatibility format codes
- String sCurString; // Currency symbol in upper case
- String sCurAbbrev; // Currency abbreviation
- String sErrStr; // String fuer Fehlerausgaben
-
- BOOL bConvertMode; // Wird im Convert-Mode gesetzt
- // Land/Sprache, in die der
- LanguageType eNewLnge; // gescannte String konvertiert
- // wird (fuer Excel Filter)
- // Land/Sprache, aus der der
- LanguageType eTmpLnge; // gescannte String konvertiert
- // wird (fuer Excel Filter)
- BOOL bConvertSystemToSystem; // Whether the conversion is
- // from one system locale to
- // another system locale (in
- // this case the automatic
- // currency symbol is converted
- // too).
-
- xub_StrLen nCurrPos; // Position des Waehrungssymbols
-
- BYTE nNatNumModifier; // Thai T speciality
-
- void InitKeywords() const;
- void InitSpecialKeyword( NfKeywordIndex eIdx ) const;
- void InitCompatCur() const;
-
-#ifdef _ZFORSCAN_CXX // ----- private Methoden -----
- void SetDependentKeywords();
- // Setzt die Sprachabh. Keyw.
- void SkipStrings(USHORT& i,xub_StrLen& nPos);// Ueberspringt StringSymbole
- USHORT PreviousKeyword(USHORT i); // Gibt Index des vorangeh.
- // Schluesselworts oder 0
- USHORT NextKeyword(USHORT i); // Gibt Index des naechsten
- // Schluesselworts oder 0
- sal_Unicode PreviousChar(USHORT i); // Gibt letzten Buchstaben
- // vor der Position,
- // skipt EMPTY, STRING, STAR, BLANK
- sal_Unicode NextChar(USHORT i); // Gibt ersten Buchst. danach
- short PreviousType( USHORT i ); // Gibt Typ vor Position,
- // skipt EMPTY
- BOOL IsLastBlankBeforeFrac(USHORT i); // True <=> es kommt kein ' '
- // mehr bis zum '/'
- void Reset(); // Reset aller Variablen
- // vor Analysestart
- short GetKeyWord( const String& sSymbol, // determine keyword at nPos
- xub_StrLen nPos ); // return 0 <=> not found
-
- inline BOOL IsAmbiguousE( short nKey ) // whether nKey is ambiguous E of NF_KEY_E/NF_KEY_EC
- {
- return (nKey == NF_KEY_EC || nKey == NF_KEY_E) &&
- (GetKeywords()[NF_KEY_EC] == GetKeywords()[NF_KEY_E]);
- }
-
- // if 0 at strArray[i] is of S,00 or SS,00 or SS"any"00 in ScanType() or FinalScan()
- BOOL Is100SecZero( USHORT i, BOOL bHadDecSep );
-
- short Next_Symbol(const String& rStr,
- xub_StrLen& nPos,
- String& sSymbol); // Naechstes Symbol
- xub_StrLen Symbol_Division(const String& rString);// lexikalische Voranalyse
- xub_StrLen ScanType(const String& rString); // Analyse des Formattyps
- xub_StrLen FinalScan( String& rString, String& rComment ); // Endanalyse mit Vorgabe
- // des Typs
- // -1:= error, return nPos in FinalScan; 0:= no calendar, 1:= calendar found
- int FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i, USHORT& nAnzResStrings );
-
- /** Insert symbol into nTypeArray and sStrArray, e.g. grouping separator.
- If at nPos-1 a symbol type NF_SYMBOLTYPE_EMPTY is present, that is
- reused instead of shifting all one up and nPos is decremented! */
- bool InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr );
-
- static inline BOOL StringEqualsChar( const String& rStr, sal_Unicode ch )
- { return rStr.GetChar(0) == ch && rStr.Len() == 1; }
- // Yes, for efficiency get the character first and then compare length
- // because in most places where this is used the string is one char.
-
- // remove "..." and \... quotes from rStr, return how many chars removed
- static xub_StrLen RemoveQuotes( String& rStr );
-
-#endif //_ZFORSCAN_CXX
-};
-
-
-
-#endif // _ZFORSCAN_HXX
diff --git a/svtools/source/passwordcontainer/exports.map b/svtools/source/passwordcontainer/exports.map
deleted file mode 100644
index f4ed78b9e970..000000000000
--- a/svtools/source/passwordcontainer/exports.map
+++ /dev/null
@@ -1,8 +0,0 @@
-UDK_3_0_0 {
- global:
- component_getImplementationEnvironment;
- component_writeInfo;
- component_getFactory;
- local:
- *;
-};
diff --git a/svtools/source/passwordcontainer/makefile.mk b/svtools/source/passwordcontainer/makefile.mk
deleted file mode 100644
index 31e1336ad966..000000000000
--- a/svtools/source/passwordcontainer/makefile.mk
+++ /dev/null
@@ -1,66 +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: makefile.mk,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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJNAME=svtools
-TARGET=passwordcontainer.uno
-LIBTARGET=NO
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings ----------------------------------
-
-.INCLUDE : settings.mk
-DLLPRE=
-
-# --- Files -------------------------------------
-
-SLOFILES= \
- $(SLO)$/passwordcontainer.obj\
- $(SLO)$/syscreds.obj
-
-SHL1TARGET= $(TARGET)
-SHL1IMPLIB= i$(TARGET)
-SHL1OBJS= $(SLOFILES)
-SHL1STDLIBS=\
- $(UNOTOOLSLIB) \
- $(UCBHELPERLIB) \
- $(CPPUHELPERLIB) \
- $(CPPULIB) \
- $(SALLIB)
-
-SHL1VERSIONMAP=exports.map
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-DEF1NAME= $(SHL1TARGET)
-
-# --- Targets ----------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/passwordcontainer/passwordcontainer.cxx b/svtools/source/passwordcontainer/passwordcontainer.cxx
deleted file mode 100644
index cebde0705f12..000000000000
--- a/svtools/source/passwordcontainer/passwordcontainer.cxx
+++ /dev/null
@@ -1,1595 +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: passwordcontainer.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_svtools.hxx"
-
-#include "passwordcontainer.hxx"
-
-#include <svtools/pathoptions.hxx>
-#include "cppuhelper/factory.hxx"
-#include <com/sun/star/registry/XSimpleRegistry.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/task/MasterPasswordRequest.hpp>
-#include <com/sun/star/task/NoMasterException.hpp>
-
-#include <rtl/cipher.h>
-#include <rtl/digest.h>
-#include <rtl/byteseq.hxx>
-
-#ifndef _TOOLS_INETSTRM_HXX
-// @@@ #include <inetstrm.hxx>
-#endif
-
-using namespace std;
-using namespace osl;
-using namespace utl;
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::registry;
-using namespace com::sun::star::lang;
-using namespace com::sun::star::task;
-using namespace com::sun::star::ucb;
-
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-
-static ::rtl::OUString createIndex( vector< ::rtl::OUString > lines )
-{
- ::rtl::OString aResult;
- const sal_Char* pLine;
-
- for( unsigned int i = 0; i < lines.size(); i++ )
- {
- if( i )
- aResult += ::rtl::OString( "__" );
- ::rtl::OString line = ::rtl::OUStringToOString( lines[i], RTL_TEXTENCODING_UTF8 );
- pLine = line.getStr();
-
- while( *pLine )
- {
- if( ( *pLine >= 'A' && *pLine <= 'Z' )
- || ( *pLine >= 'a' && *pLine <= 'z' )
- || ( *pLine >= '0' && *pLine <= '9' ) )
- {
- aResult += ::rtl::OString::valueOf( *pLine );
- }
- else
- {
- aResult += ::rtl::OString("_");
- aResult += ::rtl::OString::valueOf( (sal_Int32) *pLine, 16 );
- }
-
- pLine++;
- }
- }
-
- return ::rtl::OUString::createFromAscii( aResult.getStr() );
-}
-
-//-------------------------------------------------------------------------
-
-static vector< ::rtl::OUString > getInfoFromInd( ::rtl::OUString aInd )
-{
- vector< ::rtl::OUString > aResult;
- sal_Bool aStart = sal_True;
-
- ::rtl::OString line = ::rtl::OUStringToOString( aInd, RTL_TEXTENCODING_ASCII_US );
- const sal_Char* pLine = line.getStr();
- do
- {
- ::rtl::OUString newItem;
- if( !aStart )
- pLine += 2;
- else
- aStart = sal_False;
-
- while( *pLine && !( pLine[0] == '_' && pLine[1] == '_' ))
- if( *pLine != '_' )
- {
- newItem += ::rtl::OUString::valueOf( (sal_Unicode) *pLine );
- pLine++;
- }
- else
- {
- ::rtl::OUString aNum;
- for( int i = 1; i < 3; i++ )
- {
- if( !pLine[i]
- || ( ( pLine[i] < '0' || pLine[i] > '9' )
- && ( pLine[i] < 'a' || pLine[i] > 'f' )
- && ( pLine[i] < 'A' || pLine[i] > 'F' ) ) )
- {
- OSL_ENSURE( sal_False, "Wrong index syntax!\n" );
- return aResult;
- }
-
- aNum += ::rtl::OUString::valueOf( (sal_Unicode) pLine[i] );
- }
-
- newItem += ::rtl::OUString::valueOf( (sal_Unicode) aNum.toInt32( 16 ) );
- pLine += 3;
- }
-
- aResult.push_back( newItem );
- } while( pLine[0] == '_' && pLine[1] == '_' );
-
- if( *pLine )
- OSL_ENSURE( sal_False, "Wrong index syntax!\n" );
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-static sal_Bool shorterUrl( ::rtl::OUString& aURL )
-{
- sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) );
-
- if( aInd > 0 )
- {
- sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd );
- if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) )
- != aPrevInd - 2 ||
- aInd != aURL.getLength() - 1 )
- {
- aURL = aURL.copy( 0, aInd );
- return sal_True;
- }
- }
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-
-static ::rtl::OUString getAsciiLine( const ::rtl::ByteSequence& buf )
-{
- ::rtl::OUString aResult;
-
- ::rtl::ByteSequence outbuf( buf.getLength()*2+1 );
-
- for( int ind = 0; ind < buf.getLength(); ind++ )
- {
- outbuf[ind*2] = ( ((sal_uInt8)buf[ind]) >> 4 ) + 'a';
- outbuf[ind*2+1] = ( ((sal_uInt8)buf[ind]) & 0x0f ) + 'a';
- }
- outbuf[buf.getLength()*2] = '\0';
-
- aResult = ::rtl::OUString::createFromAscii( (sal_Char*)outbuf.getArray() );
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-static ::rtl::ByteSequence getBufFromAsciiLine( ::rtl::OUString line )
-{
- OSL_ENSURE( line.getLength() % 2 == 0, "Wrong syntax!\n" );
- ::rtl::OString tmpLine = ::rtl::OUStringToOString( line, RTL_TEXTENCODING_ASCII_US );
- ::rtl::ByteSequence aResult(line.getLength()/2);
-
- for( int ind = 0; ind < tmpLine.getLength()/2; ind++ )
- {
- aResult[ind] = ( (sal_uInt8)( tmpLine.getStr()[ind*2] - 'a' ) << 4 ) | (sal_uInt8)( tmpLine.getStr()[ind*2+1] - 'a' );
- }
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-static Sequence< ::rtl::OUString > copyVectorToSequence( const vector< ::rtl::OUString >& original )
-{
- Sequence< ::rtl::OUString > newOne ( original.size() );
- for( unsigned int i = 0; i < original.size() ; i++ )
- newOne[i] = original[i];
-
- return newOne;
-}
-
-static vector< ::rtl::OUString > copySequenceToVector( const Sequence< ::rtl::OUString >& original )
-{
- vector< ::rtl::OUString > newOne ( original.getLength() );
- for( int i = 0; i < original.getLength() ; i++ )
- newOne[i] = original[i];
-
- return newOne;
-}
-
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-
-PassMap StorageItem::getInfo()
-{
- PassMap aResult;
-
- Sequence< ::rtl::OUString > aNodeNames = ConfigItem::GetNodeNames( ::rtl::OUString::createFromAscii("Store") );
- sal_Int32 aNodeCount = aNodeNames.getLength();
- Sequence< ::rtl::OUString > aPropNames( aNodeCount );
- sal_Int32 aNodeInd;
-
- for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd )
- {
- aPropNames[aNodeInd] = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" );
- aPropNames[aNodeInd] += aNodeNames[aNodeInd];
- aPropNames[aNodeInd] += ::rtl::OUString::createFromAscii( "']/Password" );
- }
-
- Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aPropNames );
-
- if( aPropertyValues.getLength() != aNodeNames.getLength() )
- {
- OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" );
- return aResult;
- }
-
- for( aNodeInd = 0; aNodeInd < aNodeCount; ++aNodeInd )
- {
- vector< ::rtl::OUString > aUrlUsr = getInfoFromInd( aNodeNames[aNodeInd] );
-
- if( aUrlUsr.size() == 2 )
- {
- ::rtl::OUString aUrl = aUrlUsr[0];
- ::rtl::OUString aName = aUrlUsr[1];
-
- ::rtl::OUString aEPasswd;
- aPropertyValues[aNodeInd] >>= aEPasswd;
-
- PassMap::iterator aIter = aResult.find( aUrl );
- if( aIter != aResult.end() )
- aIter->second.push_back( NamePassRecord( aName, aEPasswd ) );
- else
- {
- NamePassRecord aNewRecord( aName, aEPasswd );
- list< NamePassRecord > listToAdd( 1, aNewRecord );
-
- aResult.insert( PairUrlRecord( aUrl, listToAdd ) );
- }
- }
- else
- OSL_ENSURE( sal_False, "Wrong index sintax!\n" );
- }
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::setUseStorage( sal_Bool bUse )
-{
- Sequence< ::rtl::OUString > sendNames(1);
- Sequence< uno::Any > sendVals(1);
-
- sendNames[0] = ::rtl::OUString::createFromAscii( "UseStorage" );
-
- sendVals[0] <<= bUse;
-
- ConfigItem::SetModified();
- ConfigItem::PutProperties( sendNames, sendVals );
-}
-
-//-------------------------------------------------------------------------
-
-sal_Bool StorageItem::useStorage()
-{
- Sequence< ::rtl::OUString > aNodeNames( 1 );
- aNodeNames[0] = ::rtl::OUString::createFromAscii( "UseStorage" );
-
- Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames );
-
- if( aPropertyValues.getLength() != aNodeNames.getLength() )
- {
- OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" );
- return sal_False;
- }
-
- sal_Bool aResult = false;
- aPropertyValues[0] >>= aResult;
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-sal_Bool StorageItem::getEncodedMP( ::rtl::OUString& aResult )
-{
- if( hasEncoded )
- {
- aResult = mEncoded;
- return sal_True;
- }
-
- Sequence< ::rtl::OUString > aNodeNames( 2 );
- aNodeNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" );
- aNodeNames[1] = ::rtl::OUString::createFromAscii( "Master" );
-
- Sequence< Any > aPropertyValues = ConfigItem::GetProperties( aNodeNames );
-
- if( aPropertyValues.getLength() != aNodeNames.getLength() )
- {
- OSL_ENSURE( aPropertyValues.getLength() == aNodeNames.getLength(), "Problems during reading\n" );
- return sal_False;
- }
-
- aPropertyValues[0] >>= hasEncoded;
- aPropertyValues[1] >>= mEncoded;
-
- aResult = mEncoded;
-
- return hasEncoded;
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::setEncodedMP( const ::rtl::OUString& aEncoded, sal_Bool bAcceptEmpty )
-{
- Sequence< ::rtl::OUString > sendNames(2);
- Sequence< uno::Any > sendVals(2);
-
- sendNames[0] = ::rtl::OUString::createFromAscii( "HasMaster" );
- sendNames[1] = ::rtl::OUString::createFromAscii( "Master" );
-
- sal_Bool bHasMaster = ( aEncoded.getLength() > 0 || bAcceptEmpty );
- sendVals[0] <<= bHasMaster;
- sendVals[1] <<= aEncoded;
-
- ConfigItem::SetModified();
- ConfigItem::PutProperties( sendNames, sendVals );
-
- hasEncoded = bHasMaster;
- mEncoded = aEncoded;
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::remove( const ::rtl::OUString& aURL, const ::rtl::OUString& aName )
-{
- vector < ::rtl::OUString > forIndex;
- forIndex.push_back( aURL );
- forIndex.push_back( aName );
-
- Sequence< ::rtl::OUString > sendSeq(1);
-
- sendSeq[0] = createIndex( forIndex );
- // sendSeq[0] = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" );
- // sendSeq[0] += createIndex( forIndex );
- // sendSeq[0] += ::rtl::OUString::createFromAscii( "']" );
-
- ConfigItem::ClearNodeElements( ::rtl::OUString::createFromAscii( "Store" ), sendSeq );
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::clear()
-{
- Sequence< ::rtl::OUString > sendSeq(1);
-
- ConfigItem::ClearNodeSet( ::rtl::OUString::createFromAscii( "Store" ) );
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::update( const ::rtl::OUString& aURL, const NamePassRecord& aRecord )
-{
- if ( !aRecord.HasPasswords( PERSISTENT_RECORD ) )
- {
- OSL_ASSERT( "Unexpected storing of a record!" );
- return;
- }
-
- vector < ::rtl::OUString > forIndex;
- forIndex.push_back( aURL );
- forIndex.push_back( aRecord.GetUserName() );
-
- Sequence< beans::PropertyValue > sendSeq(1);
-
- sendSeq[0].Name = ::rtl::OUString::createFromAscii( "Store/Passwordstorage['" );
- sendSeq[0].Name += createIndex( forIndex );
- sendSeq[0].Name += ::rtl::OUString::createFromAscii( "']/Password" );
-
- sendSeq[0].Value <<= aRecord.GetPersPasswords();
-
- ConfigItem::SetModified();
- ConfigItem::SetSetProperties( ::rtl::OUString::createFromAscii( "Store" ), sendSeq );
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::Notify( const Sequence< ::rtl::OUString >& )
-{
- // this feature still should not be used
- if( mainCont )
- mainCont->Notify();
-}
-
-//-------------------------------------------------------------------------
-
-void StorageItem::Commit()
-{
- // Do nothing, we stored everything we want already
-}
-
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-
-PasswordContainer::PasswordContainer( const Reference<XMultiServiceFactory>& xServiceFactory ):
- m_pStorageFile( NULL )
-{
- // m_pStorageFile->Notify() can be called
- ::osl::MutexGuard aGuard( mMutex );
-
- mComponent = Reference< XComponent >( xServiceFactory, UNO_QUERY );
- mComponent->addEventListener( this );
-
- m_pStorageFile = new StorageItem( this, ::rtl::OUString::createFromAscii( "Office.Common/Passwords" ) );
- if( m_pStorageFile )
- if( m_pStorageFile->useStorage() )
- m_aContainer = m_pStorageFile->getInfo();
-}
-
-//-------------------------------------------------------------------------
-
-PasswordContainer::~PasswordContainer()
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if( m_pStorageFile )
- {
- delete m_pStorageFile;
- m_pStorageFile = NULL;
- }
-
- if( mComponent.is() )
- {
- mComponent->removeEventListener(this);
- mComponent = Reference< XComponent >();
- }
-}
-
-//-------------------------------------------------------------------------
-
-void SAL_CALL PasswordContainer::disposing( const EventObject& ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if( m_pStorageFile )
- {
- delete m_pStorageFile;
- m_pStorageFile = NULL;
- }
-
- if( mComponent.is() )
- {
- //mComponent->removeEventListener(this);
- mComponent = Reference< XComponent >();
- }
-}
-
-//-------------------------------------------------------------------------
-
-vector< ::rtl::OUString > PasswordContainer::DecodePasswords( const ::rtl::OUString& aLine, const ::rtl::OUString& aMasterPasswd ) throw(RuntimeException)
-{
- if( aMasterPasswd.getLength() )
- {
- rtlCipher aDecoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
- OSL_ENSURE( aDecoder, "Can't create decoder\n" );
-
- if( aDecoder )
- {
- OSL_ENSURE( aMasterPasswd.getLength() == RTL_DIGEST_LENGTH_MD5 * 2, "Wrong master password format!\n" );
-
- unsigned char code[RTL_DIGEST_LENGTH_MD5];
- for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16));
-
- rtlCipherError result = rtl_cipher_init (
- aDecoder, rtl_Cipher_DirectionDecode,
- code, RTL_DIGEST_LENGTH_MD5, NULL, 0 );
-
- if( result == rtl_Cipher_E_None )
- {
- ::rtl::ByteSequence aSeq = getBufFromAsciiLine( aLine );
-
- ::rtl::ByteSequence resSeq( aSeq.getLength() );
-
- result = rtl_cipher_decode ( aDecoder, (sal_uInt8*)aSeq.getArray(), aSeq.getLength(),
- (sal_uInt8*)resSeq.getArray(), resSeq.getLength() );
-
- ::rtl::OUString aPasswd( ( sal_Char* )resSeq.getArray(), resSeq.getLength(), RTL_TEXTENCODING_UTF8 );
-
- rtl_cipher_destroy (aDecoder);
-
- return getInfoFromInd( aPasswd );
- }
-
- rtl_cipher_destroy (aDecoder);
- }
- }
- else
- {
- OSL_ENSURE( sal_False, "No master password provided!\n" );
- // throw special exception
- }
-
- // problems with decoding
- OSL_ENSURE( sal_False, "Problem with decoding\n" );
- throw RuntimeException( ::rtl::OUString::createFromAscii( "Can't decode!" ), Reference< XInterface >() );
-}
-
-
-//-------------------------------------------------------------------------
-
-::rtl::OUString PasswordContainer::EncodePasswords( vector< ::rtl::OUString > lines, const ::rtl::OUString& aMasterPasswd ) throw(RuntimeException)
-{
- if( aMasterPasswd.getLength() )
- {
- ::rtl::OString aSeq = ::rtl::OUStringToOString( createIndex( lines ), RTL_TEXTENCODING_UTF8 );
-
- rtlCipher aEncoder = rtl_cipher_create (rtl_Cipher_AlgorithmBF, rtl_Cipher_ModeStream );
- OSL_ENSURE( aEncoder, "Can't create encoder\n" );
-
- if( aEncoder )
- {
- OSL_ENSURE( aMasterPasswd.getLength() == RTL_DIGEST_LENGTH_MD5 * 2, "Wrong master password format!\n" );
-
- unsigned char code[RTL_DIGEST_LENGTH_MD5];
- for( int ind = 0; ind < RTL_DIGEST_LENGTH_MD5; ind++ )
- code[ ind ] = (char)(aMasterPasswd.copy( ind*2, 2 ).toInt32(16));
-
- rtlCipherError result = rtl_cipher_init (
- aEncoder, rtl_Cipher_DirectionEncode,
- code, RTL_DIGEST_LENGTH_MD5, NULL, 0 );
-
- if( result == rtl_Cipher_E_None )
- {
- ::rtl::ByteSequence resSeq(aSeq.getLength()+1);
-
- result = rtl_cipher_encode ( aEncoder, (sal_uInt8*)aSeq.getStr(), aSeq.getLength()+1,
- (sal_uInt8*)resSeq.getArray(), resSeq.getLength() );
-
-/*
- //test
- rtlCipherError result = rtl_cipher_init (
- aEncoder, rtl_Cipher_DirectionDecode,
- code, RTL_DIGEST_LENGTH_MD5, NULL, 0 );
-
-
- if( result == rtl_Cipher_E_None )
- {
- ::rtl::OUString testOU = getAsciiLine( resSeq );
- ::rtl::ByteSequence aSeq1 = getBufFromAsciiLine( testOU );
-
- ::rtl::ByteSequence resSeq1( aSeq1.getLength() );
-
- if( resSeq.getLength() == aSeq1.getLength() )
- {
- for( int ind = 0; ind < aSeq1.getLength(); ind++ )
- if( resSeq[ind] != aSeq1[ind] )
- testOU = ::rtl::OUString();
- }
-
- result = rtl_cipher_decode ( aEncoder, (sal_uInt8*)aSeq1.getArray(), aSeq1.getLength(),
- (sal_uInt8*)resSeq1.getArray(), resSeq1.getLength() );
-
- ::rtl::OUString aPasswd( ( sal_Char* )resSeq1.getArray(), resSeq1.getLength(), RTL_TEXTENCODING_UTF8 );
- }
-*/
-
- rtl_cipher_destroy (aEncoder);
-
- if( result == rtl_Cipher_E_None )
- return getAsciiLine( resSeq );
-
- }
-
- rtl_cipher_destroy (aEncoder);
- }
- }
- else
- {
- OSL_ENSURE( sal_False, "No master password provided!\n" );
- // throw special exception
- }
-
- // problems with encoding
- OSL_ENSURE( sal_False, "Problem with encoding\n" );
- throw RuntimeException( ::rtl::OUString::createFromAscii( "Can't encode!" ), Reference< XInterface >() );
-}
-
-//-------------------------------------------------------------------------
-
-void PasswordContainer::UpdateVector( const ::rtl::OUString& aURL, list< NamePassRecord >& toUpdate, NamePassRecord& aRecord, sal_Bool writeFile ) throw(RuntimeException)
-{
- for( list< NamePassRecord >::iterator aNPIter = toUpdate.begin(); aNPIter != toUpdate.end(); aNPIter++ )
- if( aNPIter->GetUserName().equals( aRecord.GetUserName() ) )
- {
- if( aRecord.HasPasswords( MEMORY_RECORD ) )
- aNPIter->SetMemPasswords( aRecord.GetMemPasswords() );
-
- if( aRecord.HasPasswords( PERSISTENT_RECORD ) )
- {
- aNPIter->SetPersPasswords( aRecord.GetPersPasswords() );
-
- if( writeFile )
- {
- // the password must be already encoded
- m_pStorageFile->update( aURL, aRecord ); // change existing ( aURL, aName ) record in the configfile
- }
- }
-
- return;
- }
-
-
- if( aRecord.HasPasswords( PERSISTENT_RECORD ) && writeFile )
- {
- // the password must be already encoded
- m_pStorageFile->update( aURL, aRecord ); // add new aName to the existing url
- }
-
- toUpdate.insert( toUpdate.begin(), aRecord );
-}
-
-//-------------------------------------------------------------------------
-
-UserRecord PasswordContainer::CopyToUserRecord( const NamePassRecord& aRecord, sal_Bool& io_bTryToDecode, const Reference< XInteractionHandler >& aHandler )
-{
- ::std::vector< ::rtl::OUString > aPasswords;
- if( aRecord.HasPasswords( MEMORY_RECORD ) )
- aPasswords = aRecord.GetMemPasswords();
-
- if( io_bTryToDecode && aRecord.HasPasswords( PERSISTENT_RECORD ) )
- {
- try
- {
- ::std::vector< ::rtl::OUString > aDecodedPasswords = DecodePasswords( aRecord.GetPersPasswords(), GetMasterPassword( aHandler ) );
- aPasswords.insert( aPasswords.end(), aDecodedPasswords.begin(), aDecodedPasswords.end() );
- }
- catch( NoMasterException& )
- {
- // if master password could not be detected the entry will be just ignored
- io_bTryToDecode = sal_False;
- }
- }
-
- return UserRecord( aRecord.GetUserName(), copyVectorToSequence( aPasswords ) );
-}
-
-//-------------------------------------------------------------------------
-
-Sequence< UserRecord > PasswordContainer::CopyToUserRecordSequence( const list< NamePassRecord >& original, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- Sequence< UserRecord > aResult( original.size() );
- sal_uInt32 nInd = 0;
- sal_Bool bTryToDecode = sal_True;
-
- for( list< NamePassRecord >::const_iterator aNPIter = original.begin();
- aNPIter != original.end();
- aNPIter++, nInd++ )
- {
- aResult[nInd] = CopyToUserRecord( *aNPIter, bTryToDecode, aHandler );
- }
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-void SAL_CALL PasswordContainer::add( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- PrivateAdd( Url, UserName, Passwords, MEMORY_RECORD, aHandler );
-}
-
-//-------------------------------------------------------------------------
-
-void SAL_CALL PasswordContainer::addPersistent( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- PrivateAdd( Url, UserName, Passwords, PERSISTENT_RECORD, aHandler );
-}
-
-//-------------------------------------------------------------------------
-
-void PasswordContainer::PrivateAdd( const ::rtl::OUString& Url, const ::rtl::OUString& UserName, const Sequence< ::rtl::OUString >& Passwords, char Mode, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- NamePassRecord aRecord( UserName );
- ::std::vector< ::rtl::OUString > aStorePass = copySequenceToVector( Passwords );
-
- if( Mode == PERSISTENT_RECORD )
- aRecord.SetPersPasswords( EncodePasswords( aStorePass, GetMasterPassword( aHandler ) ) );
- else if( Mode == MEMORY_RECORD )
- aRecord.SetMemPasswords( aStorePass );
- else
- {
- OSL_ASSERT( "Unexpected persistence status!" );
- return;
- }
-
- if( !m_aContainer.empty() )
- {
- PassMap::iterator aIter = m_aContainer.find( Url );
-
- if( aIter != m_aContainer.end() )
- {
- UpdateVector( aIter->first, aIter->second, aRecord, sal_True );
- return;
- }
- }
-
- list< NamePassRecord > listToAdd( 1, aRecord );
- m_aContainer.insert( PairUrlRecord( Url, listToAdd ) );
-
- if( Mode == PERSISTENT_RECORD && m_pStorageFile && m_pStorageFile->useStorage() )
- m_pStorageFile->update( Url, aRecord );
-
-}
-
-//-------------------------------------------------------------------------
-
-
-UrlRecord SAL_CALL PasswordContainer::find( const ::rtl::OUString& aURL, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- return find( aURL, rtl::OUString(), false, aHandler );
-}
-
-//-------------------------------------------------------------------------
-
-UrlRecord SAL_CALL PasswordContainer::findForName( const ::rtl::OUString& aURL, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- return find( aURL, aName, true, aHandler );
-}
-
-//-------------------------------------------------------------------------
-
-Sequence< UserRecord > PasswordContainer::FindUsr( const list< NamePassRecord >& userlist, const ::rtl::OUString& aName, const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- sal_uInt32 nInd = 0;
- for( list< NamePassRecord >::const_iterator aNPIter = userlist.begin();
- aNPIter != userlist.end();
- aNPIter++, nInd++ )
- {
- if( aNPIter->GetUserName().equals( aName ) )
- {
- Sequence< UserRecord > aResult(1);
- sal_Bool bTryToDecode = sal_True;
- aResult[0] = CopyToUserRecord( *aNPIter, bTryToDecode, aHandler );
-
- return aResult;
- }
- }
-
- return Sequence< UserRecord >();
-}
-
-//-------------------------------------------------------------------------
-
-bool PasswordContainer::createUrlRecord(
- const PassMap::iterator & rIter,
- bool bName,
- const ::rtl::OUString & aName,
- const Reference< XInteractionHandler >& aHandler,
- UrlRecord & rRec )
- throw( RuntimeException )
-{
- if ( bName )
- {
- Sequence< UserRecord > aUsrRec
- = FindUsr( rIter->second, aName, aHandler );
- if( aUsrRec.getLength() )
- {
- rRec = UrlRecord( rIter->first, aUsrRec );
- return true;
- }
- }
- else
- {
- rRec = UrlRecord(
- rIter->first,
- CopyToUserRecordSequence( rIter->second, aHandler ) );
- return true;
- }
- return false;
-}
-
-//-------------------------------------------------------------------------
-
-UrlRecord PasswordContainer::find(
- const ::rtl::OUString& aURL,
- const ::rtl::OUString& aName,
- bool bName, // only needed to support empty user names
- const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if( !m_aContainer.empty() && aURL.getLength() )
- {
- ::rtl::OUString aUrl( aURL );
-
- // each iteration remove last '/...' section from the aUrl
- // while it's possible, up to the most left '://'
- do
- {
- // first look for <url>/somename and then look for <url>/somename/...
- PassMap::iterator aIter = m_aContainer.find( aUrl );
- if( aIter != m_aContainer.end() )
- {
- UrlRecord aRec;
- if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) )
- return aRec;
- }
- else
- {
- ::rtl::OUString tmpUrl( aUrl );
- if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
- tmpUrl += ::rtl::OUString::createFromAscii( "/" );
-
- aIter = m_aContainer.lower_bound( tmpUrl );
- if( aIter != m_aContainer.end() && aIter->first.match( tmpUrl ) )
- {
- UrlRecord aRec;
- if ( createUrlRecord( aIter, bName, aName, aHandler, aRec ) )
- return aRec;
- }
- }
- }
- while( shorterUrl( aUrl ) && aUrl.getLength() );
- }
-
- return UrlRecord();
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString PasswordContainer::GetDefaultMasterPassword()
-{
- ::rtl::OUString aResult;
- for ( sal_Int32 nInd = 0; nInd < RTL_DIGEST_LENGTH_MD5; nInd++ )
- aResult += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "aa" ) );
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString PasswordContainer::RequestPasswordFromUser( PasswordRequestMode aRMode, const uno::Reference< task::XInteractionHandler >& xHandler )
-{
- // empty string means that the call was cancelled or just failed
- ::rtl::OUString aResult;
-
- if ( xHandler.is() )
- {
- ::rtl::Reference< MasterPasswordRequest_Impl > xRequest = new MasterPasswordRequest_Impl( aRMode );
-
- xHandler->handle( xRequest.get() );
-
- ::rtl::Reference< ucbhelper::InteractionContinuation > xSelection = xRequest->getSelection();
-
- if ( xSelection.is() )
- {
- Reference< XInteractionAbort > xAbort( xSelection.get(), UNO_QUERY );
- if ( !xAbort.is() )
- {
- const ::rtl::Reference< ucbhelper::InteractionSupplyAuthentication > & xSupp
- = xRequest->getAuthenticationSupplier();
-
- aResult = xSupp->getPassword();
- }
- }
- }
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-
-::rtl::OUString PasswordContainer::GetMasterPassword( const Reference< XInteractionHandler >& aHandler ) throw(RuntimeException)
-{
- PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER;
- if( !m_pStorageFile || !m_pStorageFile->useStorage() )
- throw NoMasterException( ::rtl::OUString::createFromAscii( "Password storing is not active!" ), Reference< XInterface >(), aRMode );
-
- if( !m_aMasterPasswd.getLength() && aHandler.is() )
- {
- ::rtl::OUString aEncodedMP;
- sal_Bool bAskAgain = sal_False;
- sal_Bool bDefaultPassword = sal_False;
-
- if( !m_pStorageFile->getEncodedMP( aEncodedMP ) )
- aRMode = PasswordRequestMode_PASSWORD_CREATE;
- else if ( !aEncodedMP.getLength() )
- {
- m_aMasterPasswd = GetDefaultMasterPassword();
- bDefaultPassword = sal_True;
- }
-
- if ( !bDefaultPassword )
- {
- do {
- bAskAgain = sal_False;
-
- ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, aHandler );
- if ( aPass.getLength() )
- {
- if( aRMode == PasswordRequestMode_PASSWORD_CREATE )
- {
- m_aMasterPasswd = aPass;
- vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd );
-
- m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) );
- }
- else
- {
- vector< ::rtl::OUString > aRM( DecodePasswords( aEncodedMP, aPass ) );
- if( !aRM.size() || !aPass.equals( aRM[0] ) )
- {
- bAskAgain = sal_True;
- aRMode = PasswordRequestMode_PASSWORD_REENTER;
- }
- else
- m_aMasterPasswd = aPass;
- }
- }
-
- } while( bAskAgain );
- }
- }
-
- if ( !m_aMasterPasswd.getLength() )
- throw NoMasterException( ::rtl::OUString::createFromAscii( "No master password!" ), Reference< XInterface >(), aRMode );
-
- return m_aMasterPasswd;
-}
-
-//-------------------------------------------------------------------------
-
-void SAL_CALL PasswordContainer::remove( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- ::rtl::OUString aUrl( aURL );
- if( !m_aContainer.empty() )
- {
- PassMap::iterator aIter = m_aContainer.find( aUrl );
-
- if( aIter == m_aContainer.end() )
- {
- sal_Int32 aInd = aUrl.lastIndexOf( sal_Unicode( '/' ) );
- if( aInd > 0 && aUrl.getLength()-1 == aInd )
- aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
- else
- aUrl += ::rtl::OUString::createFromAscii( "/" );
-
- aIter = m_aContainer.find( aUrl );
- }
-
- if( aIter != m_aContainer.end() )
- {
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ )
- if( aNPIter->GetUserName().equals( aName ) )
- {
- if( aNPIter->HasPasswords( PERSISTENT_RECORD ) && m_pStorageFile )
- m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName )
-
- // the iterator will not be used any more so it can be removed directly
- aIter->second.erase( aNPIter );
-
- if( aIter->second.begin() == aIter->second.end() )
- m_aContainer.erase( aIter );
-
- return;
- }
- }
- }
-}
-
-//-------------------------------------------------------------------------
-
-void SAL_CALL PasswordContainer::removePersistent( const ::rtl::OUString& aURL, const ::rtl::OUString& aName ) throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- ::rtl::OUString aUrl( aURL );
- if( !m_aContainer.empty() )
- {
- PassMap::iterator aIter = m_aContainer.find( aUrl );
-
- if( aIter == m_aContainer.end() )
- {
- sal_Int32 aInd = aUrl.lastIndexOf( sal_Unicode( '/' ) );
- if( aInd > 0 && aUrl.getLength()-1 == aInd )
- aUrl = aUrl.copy( 0, aUrl.getLength() - 1 );
- else
- aUrl += ::rtl::OUString::createFromAscii( "/" );
-
- aIter = m_aContainer.find( aUrl );
- }
-
- if( aIter != m_aContainer.end() )
- {
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ )
- if( aNPIter->GetUserName().equals( aName ) )
- {
- if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
- {
- // TODO/LATER: should the password be converted to MemoryPassword?
- aNPIter->RemovePasswords( PERSISTENT_RECORD );
-
- if ( m_pStorageFile )
- m_pStorageFile->remove( aURL, aName ); // remove record ( aURL, aName )
- }
-
- if( !aNPIter->HasPasswords( MEMORY_RECORD ) )
- aIter->second.erase( aNPIter );
-
- if( aIter->second.begin() == aIter->second.end() )
- m_aContainer.erase( aIter );
-
- return;
- }
- }
- }
-}
-//-------------------------------------------------------------------------
-
-void SAL_CALL PasswordContainer::removeAllPersistent() throw(RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if( m_pStorageFile )
- m_pStorageFile->clear();
-
- for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); )
- {
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); )
- {
- if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
- {
- // TODO/LATER: should the password be converted to MemoryPassword?
- aNPIter->RemovePasswords( PERSISTENT_RECORD );
-
- if ( m_pStorageFile )
- m_pStorageFile->remove( aIter->first, aNPIter->GetUserName() ); // remove record ( aURL, aName )
- }
-
- if( !aNPIter->HasPasswords( MEMORY_RECORD ) )
- {
- list< NamePassRecord >::iterator aIterToDelete( aNPIter );
- aNPIter++;
- aIter->second.erase( aIterToDelete );
- }
- else
- aNPIter++;
- }
-
- if( aIter->second.begin() == aIter->second.end() )
- {
- PassMap::iterator aIterToDelete( aIter );
- aIter++;
- m_aContainer.erase( aIterToDelete );
- }
- else
- aIter++;
- }
-}
-//-------------------------------------------------------------------------
-
-Sequence< UrlRecord > SAL_CALL PasswordContainer::getAllPersistent( const Reference< XInteractionHandler >& xHandler ) throw(RuntimeException)
-{
- Sequence< UrlRecord > aResult;
-
- ::osl::MutexGuard aGuard( mMutex );
- for( PassMap::iterator aIter = m_aContainer.begin(); aIter != m_aContainer.end(); aIter++ )
- {
- Sequence< UserRecord > aUsers;
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ )
- if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
- {
- sal_Int32 oldLen = aUsers.getLength();
- aUsers.realloc( oldLen + 1 );
- aUsers[ oldLen ] = UserRecord( aNPIter->GetUserName(), copyVectorToSequence( DecodePasswords( aNPIter->GetPersPasswords(), GetMasterPassword( xHandler ) ) ) );
- }
-
- if( aUsers.getLength() )
- {
- sal_Int32 oldLen = aResult.getLength();
- aResult.realloc( oldLen + 1 );
- aResult[ oldLen ] = UrlRecord( aIter->first, aUsers );
- }
- }
-
- return aResult;
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL PasswordContainer::authorizateWithMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler )
- throw (uno::RuntimeException)
-{
- sal_Bool bResult = sal_False;
- ::rtl::OUString aEncodedMP;
- uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
- ::osl::MutexGuard aGuard( mMutex );
-
- // the method should fail if there is no master password
- if( m_pStorageFile && m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) )
- {
- if ( !aEncodedMP.getLength() )
- {
- // this is a default master password
- // no UI is necessary
- bResult = sal_True;
- }
- else
- {
- if ( !xTmpHandler.is() )
- {
- uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW );
- xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW );
- }
-
- if ( m_aMasterPasswd.getLength() )
- {
- // there is a password, it should be just rechecked
- PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_ENTER;
- ::rtl::OUString aPass;
-
- do {
- aPass = RequestPasswordFromUser( aRMode, xTmpHandler );
- bResult = ( aPass.getLength() && aPass.equals( m_aMasterPasswd ) );
- aRMode = PasswordRequestMode_PASSWORD_REENTER; // further questions with error notification
- } while( !bResult && aPass.getLength() );
- }
- else
- {
- try
- {
- // ask for the password, if user provide no correct password an exception will be thrown
- bResult = ( GetMasterPassword( xTmpHandler ).getLength() > 0 );
- }
- catch( uno::Exception& )
- {}
- }
- }
- }
-
- return bResult;
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL PasswordContainer::changeMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler )
- throw (uno::RuntimeException)
-{
- sal_Bool bResult = sal_False;
- uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
- ::osl::MutexGuard aGuard( mMutex );
-
- if ( m_pStorageFile && m_pStorageFile->useStorage() )
- {
- if ( !xTmpHandler.is() )
- {
- uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW );
- xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW );
- }
-
- sal_Bool bCanChangePassword = sal_True;
- // if there is already a stored master password it should be entered by the user before the change happen
- ::rtl::OUString aEncodedMP;
- if( m_aMasterPasswd.getLength() || m_pStorageFile->getEncodedMP( aEncodedMP ) )
- bCanChangePassword = authorizateWithMasterPassword( xTmpHandler );
-
- if ( bCanChangePassword )
- {
- // ask for the new password, but do not set it
- PasswordRequestMode aRMode = PasswordRequestMode_PASSWORD_CREATE;
- ::rtl::OUString aPass = RequestPasswordFromUser( aRMode, xTmpHandler );
-
- if ( aPass.getLength() )
- {
- // get all the persistent entries if it is possible
- Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() );
-
- // remove the master password and the entries persistence
- removeMasterPassword();
-
- // store the new master password
- m_aMasterPasswd = aPass;
- vector< ::rtl::OUString > aMaster( 1, m_aMasterPasswd );
- m_pStorageFile->setEncodedMP( EncodePasswords( aMaster, m_aMasterPasswd ) );
-
- // store all the entries with the new password
- for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ )
- for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ )
- addPersistent( aPersistent[nURLInd].Url,
- aPersistent[nURLInd].UserList[nNameInd].UserName,
- aPersistent[nURLInd].UserList[nNameInd].Passwords,
- uno::Reference< task::XInteractionHandler >() );
-
- bResult = sal_True;
- }
- }
- }
-
- return bResult;
-}
-
-//-------------------------------------------------------------------------
-void SAL_CALL PasswordContainer::removeMasterPassword()
- throw (uno::RuntimeException)
-{
- // remove all the stored passwords and the master password
- removeAllPersistent();
-
- ::osl::MutexGuard aGuard( mMutex );
- if ( m_pStorageFile )
- {
- m_aMasterPasswd = ::rtl::OUString();
- m_pStorageFile->setEncodedMP( ::rtl::OUString() ); // let the master password be removed from configuration
- }
-}
-
-//-------------------------------------------------------------------------
-::sal_Bool SAL_CALL PasswordContainer::hasMasterPassword( )
- throw (::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if ( !m_pStorageFile )
- throw uno::RuntimeException();
-
- ::rtl::OUString aEncodedMP;
- return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) );
-}
-
-//-------------------------------------------------------------------------
-::sal_Bool SAL_CALL PasswordContainer::allowPersistentStoring( ::sal_Bool bAllow )
- throw (::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if ( !m_pStorageFile )
- throw uno::RuntimeException();
-
- if ( !bAllow )
- removeMasterPassword();
-
- if ( m_pStorageFile->useStorage() == bAllow )
- return bAllow;
-
- m_pStorageFile->setUseStorage( bAllow );
- return !bAllow;
-}
-
-//-------------------------------------------------------------------------
-::sal_Bool SAL_CALL PasswordContainer::isPersistentStoringAllowed()
- throw (::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if ( !m_pStorageFile )
- throw uno::RuntimeException();
-
- return m_pStorageFile->useStorage();
-}
-
-//-------------------------------------------------------------------------
-::sal_Bool SAL_CALL PasswordContainer::useDefaultMasterPassword( const uno::Reference< task::XInteractionHandler >& xHandler )
- throw ( uno::RuntimeException )
-{
- sal_Bool bResult = sal_False;
- uno::Reference< task::XInteractionHandler > xTmpHandler = xHandler;
- ::osl::MutexGuard aGuard( mMutex );
-
- if ( m_pStorageFile && m_pStorageFile->useStorage() )
- {
- if ( !xTmpHandler.is() )
- {
- uno::Reference< lang::XMultiServiceFactory > xFactory( mComponent, uno::UNO_QUERY_THROW );
- xTmpHandler.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.InteractionHandler" ) ) ), uno::UNO_QUERY_THROW );
- }
-
- sal_Bool bCanChangePassword = sal_True;
- // if there is already a stored nondefault master password it should be entered by the user before the change happen
- ::rtl::OUString aEncodedMP;
- if( m_pStorageFile->getEncodedMP( aEncodedMP ) && aEncodedMP.getLength() )
- bCanChangePassword = authorizateWithMasterPassword( xTmpHandler );
-
- if ( bCanChangePassword )
- {
- // generate the default password
- ::rtl::OUString aPass = GetDefaultMasterPassword();
- if ( aPass.getLength() )
- {
- // get all the persistent entries if it is possible
- Sequence< UrlRecord > aPersistent = getAllPersistent( uno::Reference< task::XInteractionHandler >() );
-
- // remove the master password and the entries persistence
- removeMasterPassword();
-
- // store the empty string to flag the default master password
- m_aMasterPasswd = aPass;
- m_pStorageFile->setEncodedMP( ::rtl::OUString(), sal_True );
-
- // store all the entries with the new password
- for ( int nURLInd = 0; nURLInd < aPersistent.getLength(); nURLInd++ )
- for ( int nNameInd = 0; nNameInd< aPersistent[nURLInd].UserList.getLength(); nNameInd++ )
- addPersistent( aPersistent[nURLInd].Url,
- aPersistent[nURLInd].UserList[nNameInd].UserName,
- aPersistent[nURLInd].UserList[nNameInd].Passwords,
- uno::Reference< task::XInteractionHandler >() );
-
- bResult = sal_True;
- }
- }
- }
-
- return bResult;
-
-}
-
-//-------------------------------------------------------------------------
-::sal_Bool SAL_CALL PasswordContainer::isDefaultMasterPasswordUsed()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- if ( !m_pStorageFile )
- throw uno::RuntimeException();
-
- ::rtl::OUString aEncodedMP;
- return ( m_pStorageFile->useStorage() && m_pStorageFile->getEncodedMP( aEncodedMP ) && !aEncodedMP.getLength() );
-}
-
-
-//-------------------------------------------------------------------------
-void SAL_CALL PasswordContainer::addUrl( const ::rtl::OUString& Url, ::sal_Bool MakePersistent )
- throw (uno::RuntimeException)
-{
- mUrlContainer.add( Url, MakePersistent );
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL PasswordContainer::findUrl( const ::rtl::OUString& Url )
- throw (uno::RuntimeException)
-{
- return mUrlContainer.find( Url );
-}
-
-//-------------------------------------------------------------------------
-void SAL_CALL PasswordContainer::removeUrl( const ::rtl::OUString& Url )
- throw (uno::RuntimeException)
-{
- mUrlContainer.remove( Url );
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getUrls( ::sal_Bool OnlyPersistent )
- throw (uno::RuntimeException)
-{
- return mUrlContainer.list( OnlyPersistent );
-}
-
-//-------------------------------------------------------------------------
-
-void PasswordContainer::Notify()
-{
- ::osl::MutexGuard aGuard( mMutex );
-
- PassMap::iterator aIter;
-
- // remove the cached persistent values in the memory
- for( aIter = m_aContainer.begin(); aIter != m_aContainer.end(); aIter++ )
- {
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); )
- {
- if( aNPIter->HasPasswords( PERSISTENT_RECORD ) )
- {
- aNPIter->RemovePasswords( PERSISTENT_RECORD );
-
- if ( m_pStorageFile )
- m_pStorageFile->remove( aIter->first, aNPIter->GetUserName() ); // remove record ( aURL, aName )
- }
-
- if( !aNPIter->HasPasswords( MEMORY_RECORD ) )
- {
- list< NamePassRecord >::iterator aIterToDelete( aNPIter );
- aNPIter++;
- aIter->second.erase( aIterToDelete );
- }
- else
- aNPIter++;
- }
- }
-
- PassMap addon;
- if( m_pStorageFile )
- addon = m_pStorageFile->getInfo();
-
- for( aIter = addon.begin(); aIter != addon.end(); aIter++ )
- {
- PassMap::iterator aSearchIter = m_aContainer.find( aIter->first );
- if( aSearchIter != m_aContainer.end() )
- for( list< NamePassRecord >::iterator aNPIter = aIter->second.begin(); aNPIter != aIter->second.end(); aNPIter++ )
- UpdateVector( aSearchIter->first, aSearchIter->second, *aNPIter, sal_False );
- else
- m_aContainer.insert( PairUrlRecord( aIter->first, aIter->second ) );
- }
-}
-
-//-------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL PasswordContainer::getImplementationName( ) throw(uno::RuntimeException)
-{
- return impl_getStaticImplementationName();
-}
-
-//-------------------------------------------------------------------------
-
-sal_Bool SAL_CALL PasswordContainer::supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException)
-{
- if ( ServiceName.compareToAscii("com.sun.star.task.PasswordContainer") == 0 )
- return sal_True;
- else
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-
-Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::getSupportedServiceNames( ) throw(uno::RuntimeException)
-{
- return impl_getStaticSupportedServiceNames();
-}
-
-//-------------------------------------------------------------------------
-
-Sequence< ::rtl::OUString > SAL_CALL PasswordContainer::impl_getStaticSupportedServiceNames( ) throw(uno::RuntimeException)
-{
- Sequence< ::rtl::OUString > aRet(1);
- *aRet.getArray() = ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer");
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-
-::rtl::OUString SAL_CALL PasswordContainer::impl_getStaticImplementationName() throw(uno::RuntimeException)
-{
- return ::rtl::OUString::createFromAscii("stardiv.svtools.PasswordContainer");
-}
-
-//-------------------------------------------------------------------------
-
-Reference< XInterface > SAL_CALL PasswordContainer::impl_createInstance( const Reference< XMultiServiceFactory >& xServiceManager ) throw( RuntimeException )
-{
- return Reference< XInterface >( *new PasswordContainer( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-
-Reference< XSingleServiceFactory > SAL_CALL PasswordContainer::impl_createFactory( const Reference< XMultiServiceFactory >& ServiceManager ) throw(RuntimeException)
-{
- Reference< XSingleServiceFactory > xReturn( ::cppu::createOneInstanceFactory( ServiceManager,
- PasswordContainer::impl_getStaticImplementationName(),
- PasswordContainer::impl_createInstance,
- PasswordContainer::impl_getStaticSupportedServiceNames()));
- return xReturn ;
-
-}
-
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-
-MasterPasswordRequest_Impl::MasterPasswordRequest_Impl( PasswordRequestMode Mode )
-{
- MasterPasswordRequest aRequest;
-
- aRequest.Classification = InteractionClassification_ERROR;
- aRequest.Mode = Mode;
-
- setRequest( makeAny( aRequest ) );
-
- // Fill continuations...
- Sequence< RememberAuthentication > aRememberModes( 1 );
- aRememberModes[ 0 ] = RememberAuthentication_NO;
-
- m_xAuthSupplier
- = new ::ucbhelper::InteractionSupplyAuthentication(
- this,
- sal_False, // bCanSetRealm
- sal_False, // bCanSetUserName
- sal_True, // bCanSetPassword
- sal_False, // bCanSetAccount
- aRememberModes, // rRememberPasswordModes
- RememberAuthentication_NO, // eDefaultRememberPasswordMode
- aRememberModes, // rRememberAccountModes
- RememberAuthentication_NO, // eDefaultRememberAccountMode
- sal_False, // bCanUseSystemCredentials
- sal_False // bDefaultUseSystemCredentials
- );
-
- Sequence<
- Reference< XInteractionContinuation > > aContinuations( 3 );
- aContinuations[ 0 ] = new ::ucbhelper::InteractionAbort( this );
- aContinuations[ 1 ] = new ::ucbhelper::InteractionRetry( this );
- aContinuations[ 2 ] = m_xAuthSupplier.get();
-
- setContinuations( aContinuations );
-}
-
-//-------------------------------------------------------------------------
-//-------------------------------------------------------------------------
-
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
- const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
-{
- *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
-}
-
-SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
- void * /* pServiceManager */, void * pRegistryKey)
-{
- if (pRegistryKey)
- {
- Reference< XRegistryKey > xRegistryKey (
- reinterpret_cast< XRegistryKey* >( pRegistryKey ));
- Reference< XRegistryKey > xNewKey;
-
- xNewKey = xRegistryKey->createKey(
- ::rtl::OUString::createFromAscii( "/stardiv.svtools.PasswordContainer/UNO/SERVICES" ));
- xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.task.PasswordContainer"));
-
- return sal_True;
- }
- return sal_False;
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
- const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
-{
- void * pResult = 0;
- if (pServiceManager)
- {
- Reference< XSingleServiceFactory > xFactory;
- if (PasswordContainer::impl_getStaticImplementationName().compareToAscii (pImplementationName) == 0)
- {
- xFactory = PasswordContainer::impl_createFactory (
- reinterpret_cast< XMultiServiceFactory* >(pServiceManager));
- }
- if (xFactory.is())
- {
- xFactory->acquire();
- pResult = xFactory.get();
- }
- }
- return pResult;
-}
-
-} // extern "C"
diff --git a/svtools/source/passwordcontainer/syscreds.cxx b/svtools/source/passwordcontainer/syscreds.cxx
deleted file mode 100644
index b8c223040e6d..000000000000
--- a/svtools/source/passwordcontainer/syscreds.cxx
+++ /dev/null
@@ -1,298 +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: $
- * $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.
- *
- ************************************************************************/
-
-#include "syscreds.hxx"
-#include "com/sun/star/beans/PropertyValue.hpp"
-
-using namespace com::sun::star;
-
-SysCredentialsConfigItem::SysCredentialsConfigItem(
- SysCredentialsConfig * pOwner )
-: utl::ConfigItem( rtl::OUString::createFromAscii( "Office.Common/Passwords" ),
- CONFIG_MODE_IMMEDIATE_UPDATE ),
- m_bInited( false ),
- m_pOwner( pOwner )
-{
- uno::Sequence< ::rtl::OUString > aNode( 1 );
- aNode[ 0 ] = rtl::OUString::createFromAscii(
- "Office.Common/Passwords/AuthenticateUsingSystemCredentials" );
- EnableNotification( aNode );
-}
-
-//virtual
-void SysCredentialsConfigItem::Notify(
- const uno::Sequence< rtl::OUString > & /*seqPropertyNames*/ )
-{
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- m_bInited = false;
- // rebuild m_seqURLs
- getSystemCredentialsURLs();
- }
- m_pOwner->persistentConfigChanged();
-}
-
-uno::Sequence< rtl::OUString >
-SysCredentialsConfigItem::getSystemCredentialsURLs()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !m_bInited )
- {
- // read config item
- uno::Sequence< ::rtl::OUString > aPropNames( 1 );
- aPropNames[ 0 ] = rtl::OUString::createFromAscii(
- "AuthenticateUsingSystemCredentials" );
- uno::Sequence< uno::Any > aAnyValues(
- utl::ConfigItem::GetProperties( aPropNames ) );
-
- OSL_ENSURE(
- aAnyValues.getLength() == 1,
- "SysCredentialsConfigItem::getSystemCredentialsURLs: "
- "Error reading config item!" );
-
- uno::Sequence< rtl::OUString > aValues;
- if ( ( aAnyValues[ 0 ] >>= aValues ) ||
- ( !aAnyValues[ 0 ].hasValue() ) )
- {
- m_seqURLs = aValues;
- m_bInited = true;
- }
- }
- return m_seqURLs;
-}
-
-void SysCredentialsConfigItem::setSystemCredentialsURLs(
- const uno::Sequence< rtl::OUString > & seqURLList )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- // write config item.
- uno::Sequence< rtl::OUString > aPropNames( 1 );
- uno::Sequence< uno::Any > aPropValues( 1 );
- aPropNames[ 0 ]
- = ::rtl::OUString::createFromAscii(
- "AuthenticateUsingSystemCredentials" );
- aPropValues[ 0 ] <<= seqURLList;
-
- utl::ConfigItem::SetModified();
- utl::ConfigItem::PutProperties( aPropNames, aPropValues );
-
- m_seqURLs = seqURLList;
- m_bInited = true;
-}
-
-//============================================================================
-
-namespace
-{
- // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx
- bool removeLastSegment( ::rtl::OUString & aURL )
- {
- sal_Int32 aInd = aURL.lastIndexOf( sal_Unicode( '/' ) );
-
- if( aInd > 0 )
- {
- sal_Int32 aPrevInd = aURL.lastIndexOf( sal_Unicode( '/' ), aInd );
- if ( aURL.indexOf( ::rtl::OUString::createFromAscii( "://" ) )
- != aPrevInd - 2 ||
- aInd != aURL.getLength() - 1 )
- {
- aURL = aURL.copy( 0, aInd );
- return true;
- }
- }
-
- return false;
- }
-
- bool findURL( StringSet const & rContainer, rtl::OUString const & aURL, rtl::OUString & aResult )
- {
- // TODO: This code is actually copied from svtools/source/passwordcontainer.cxx
- if( !rContainer.empty() && aURL.getLength() )
- {
- ::rtl::OUString aUrl( aURL );
-
- // each iteration remove last '/...' section from the aUrl
- // while it's possible, up to the most left '://'
- do
- {
- // first look for <url>/somename and then look for <url>/somename/...
- StringSet::const_iterator aIter = rContainer.find( aUrl );
- if( aIter != rContainer.end() )
- {
- aResult = *aIter;
- return true;
- }
- else
- {
- ::rtl::OUString tmpUrl( aUrl );
- if ( tmpUrl.getStr()[tmpUrl.getLength() - 1] != (sal_Unicode)'/' )
- tmpUrl += ::rtl::OUString::createFromAscii( "/" );
-
- aIter = rContainer.lower_bound( tmpUrl );
- if( aIter != rContainer.end() && aIter->match( tmpUrl ) )
- {
- aResult = *aIter;
- return true;
- }
- }
- }
- while( removeLastSegment( aUrl ) && aUrl.getLength() );
- }
- aResult = rtl::OUString();
- return false;
- }
-
-} // namespace
-
-SysCredentialsConfig::SysCredentialsConfig()
-: m_aConfigItem( this ),
- m_bCfgInited( false )
-{
-}
-
-void SysCredentialsConfig::initCfg()
-{
- osl::MutexGuard aGuard( m_aMutex );
- if ( !m_bCfgInited )
- {
- uno::Sequence< rtl::OUString > aURLs(
- m_aConfigItem.getSystemCredentialsURLs() );
- for ( sal_Int32 n = 0; n < aURLs.getLength(); ++n )
- m_aCfgContainer.insert( aURLs[ n ] );
-
- m_bCfgInited = true;
- }
-}
-
-void SysCredentialsConfig::writeCfg()
-{
- osl::MutexGuard aGuard( m_aMutex );
-
- OSL_ENSURE( m_bCfgInited, "SysCredentialsConfig::writeCfg : not initialized!" );
-
- uno::Sequence< rtl::OUString > aURLs( m_aCfgContainer.size() );
- StringSet::const_iterator it = m_aCfgContainer.begin();
- const StringSet::const_iterator end = m_aCfgContainer.end();
- sal_Int32 n = 0;
-
- while ( it != end )
- {
- aURLs[ n ] = *it;
- ++it;
- ++n;
- }
-
- m_aConfigItem.setSystemCredentialsURLs( aURLs );
-}
-
-rtl::OUString SysCredentialsConfig::find( rtl::OUString const & aURL )
-{
- osl::MutexGuard aGuard( m_aMutex );
- rtl::OUString aResult;
- if ( findURL( m_aMemContainer, aURL, aResult ) )
- return aResult;
-
- initCfg();
- if ( findURL( m_aCfgContainer, aURL, aResult ) )
- return aResult;
-
- return rtl::OUString();
-}
-
-void SysCredentialsConfig::add( rtl::OUString const & rURL, bool bPersistent )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( bPersistent )
- {
- m_aMemContainer.erase( rURL );
-
- initCfg();
- m_aCfgContainer.insert( rURL );
- writeCfg();
- }
- else
- {
- initCfg();
- if ( m_aCfgContainer.erase( rURL ) > 0 )
- writeCfg();
-
- m_aMemContainer.insert( rURL );
- }
-}
-
-void SysCredentialsConfig::remove( rtl::OUString const & rURL )
-{
- m_aMemContainer.erase( rURL );
-
- initCfg();
- if ( m_aCfgContainer.erase( rURL ) > 0 )
- writeCfg();
-}
-
-uno::Sequence< rtl::OUString > SysCredentialsConfig::list( bool bOnlyPersistent )
-{
- initCfg();
- sal_Int32 nCount = m_aCfgContainer.size()
- + ( bOnlyPersistent ? 0 : m_aMemContainer.size() );
- uno::Sequence< rtl::OUString > aResult( nCount );
-
- StringSet::const_iterator it = m_aCfgContainer.begin();
- StringSet::const_iterator end = m_aCfgContainer.end();
- sal_Int32 n = 0;
-
- while ( it != end )
- {
- aResult[ n ] = *it;
- ++it;
- ++n;
- }
-
- if ( !bOnlyPersistent )
- {
- it = m_aMemContainer.begin();
- end = m_aMemContainer.end();
-
- while ( it != end )
- {
- aResult[ n ] = *it;
- ++it;
- ++n;
- }
- }
- return aResult;
-}
-
-void SysCredentialsConfig::persistentConfigChanged()
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- m_bCfgInited = false; // re-init on demand.
-}
diff --git a/svtools/source/passwordcontainer/syscreds.hxx b/svtools/source/passwordcontainer/syscreds.hxx
deleted file mode 100644
index b037e17c348e..000000000000
--- a/svtools/source/passwordcontainer/syscreds.hxx
+++ /dev/null
@@ -1,95 +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: $
- * $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 INCLUDED_SVTOOLS_SYSCREDS_HXX
-#define INCLUDED_SVTOOLS_SYSCREDS_HXX
-
-#include <set>
-#include <memory>
-#include "osl/mutex.hxx"
-#include "rtl/ustring.hxx"
-#include "com/sun/star/uno/Sequence.hxx"
-#include "unotools/configitem.hxx"
-
-class SysCredentialsConfig;
-
-class SysCredentialsConfigItem : public utl::ConfigItem
-{
- public:
- SysCredentialsConfigItem( SysCredentialsConfig * pOwner );
- //virtual ~SysCredentialsConfigItem();
-
- virtual void Notify(
- const com::sun::star::uno::Sequence< rtl::OUString > &
- seqPropertyNames );
- //virtual void Commit();
-
- com::sun::star::uno::Sequence< rtl::OUString >
- getSystemCredentialsURLs();
-
- void setSystemCredentialsURLs(
- const com::sun::star::uno::Sequence< rtl::OUString > &
- seqURLList );
-
- //bool isSystemCredentialsURL( const rtl::OUString & rURL ) const;
-
-private:
- ::osl::Mutex m_aMutex;
- bool m_bInited;
- com::sun::star::uno::Sequence< rtl::OUString > m_seqURLs;
- SysCredentialsConfig * m_pOwner;
-};
-
-typedef std::set< rtl::OUString > StringSet;
-
-class SysCredentialsConfig
-{
- public:
- SysCredentialsConfig();
-
- rtl::OUString find( rtl::OUString const & rURL );
- void add( rtl::OUString const & rURL, bool bPersistent );
- void remove( rtl::OUString const & rURL );
- com::sun::star::uno::Sequence< rtl::OUString > list( bool bOnlyPersistent );
-
- void persistentConfigChanged();
-
- private:
- void initCfg();
- void writeCfg();
-
- ::osl::Mutex m_aMutex;
- StringSet m_aMemContainer;
- StringSet m_aCfgContainer;
- SysCredentialsConfigItem m_aConfigItem;
- bool m_bCfgInited;
-};
-
-#endif // INCLUDED_SVTOOLS_SYSCREDS_HXX
diff --git a/svtools/source/plugapp/testtool.src b/svtools/source/plugapp/testtool.src
index 599675a6c494..78b63c2fb819 100644
--- a/svtools/source/plugapp/testtool.src
+++ b/svtools/source/plugapp/testtool.src
@@ -28,7 +28,7 @@
*
************************************************************************/
#include "testtool.hrc"
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#define Control_Control 5
diff --git a/svtools/source/productregistration/makefile.mk b/svtools/source/productregistration/makefile.mk
index bc964e142232..1892f1600dd8 100644
--- a/svtools/source/productregistration/makefile.mk
+++ b/svtools/source/productregistration/makefile.mk
@@ -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
@@ -57,6 +57,7 @@ SHL1STDLIBS=\
$(TKLIB) \
$(VCLLIB) \
$(SVLLIB) \
+ $(UNOTOOLSLIB) \
$(TOOLSLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx
index b3d90a73b231..f5fc03337cd6 100644
--- a/svtools/source/productregistration/productregistration.cxx
+++ b/svtools/source/productregistration/productregistration.cxx
@@ -32,10 +32,10 @@
#include "precompiled_svtools.hxx"
#include "productregistration.hxx"
-#include "regoptions.hxx"
+#include "unotools/regoptions.hxx"
#include "registrationdlg.hxx"
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implbase1.hxx>
@@ -308,18 +308,18 @@ namespace svt
sal_Bool bDeactivateJob = sal_True;
// our config options
- RegOptions aRegOptions;
+ utl::RegOptions aRegOptions;
// check them for the permissions for the dialog
- RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() );
+ utl::RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() );
- if ( RegOptions::dpDisabled != ePermission )
+ if ( utl::RegOptions::dpDisabled != ePermission )
{ // the dialog is _not_ disabled
// for this session, I'm no interested in the dialog registration anymore
aRegOptions.markSessionDone( );
- if ( ( RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached
- || ( RegOptions::dpRemindLater == ePermission ) // or at a later reminder date
+ if ( ( utl::RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached
+ || ( utl::RegOptions::dpRemindLater == ePermission ) // or at a later reminder date
)
{ // the dialog should be executed during one of the next sessions
bDeactivateJob = sal_False;
@@ -327,7 +327,7 @@ namespace svt
else
{
// if we're here, the dialog should be executed during this session
- OSL_ENSURE( RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" );
+ OSL_ENSURE( utl::RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" );
{
// this is some kind of HACK.
@@ -412,7 +412,7 @@ namespace svt
OSL_ENSURE( xSystemShell.is(), "OProductRegistration::doOnlineRegistration: invalid SystemExecute component!" );
// access the configuration to retrieve the URL we shall use for registration
- RegOptions aOptions;
+ utl::RegOptions aOptions;
OUString sRegistrationURL( aOptions.getRegistrationURL( ) );
OSL_ENSURE( sRegistrationURL.getLength(), "OProductRegistration::doOnlineRegistration: invalid URL found!" );
@@ -436,7 +436,7 @@ namespace svt
aRegistrationError.Execute();
// try again later
- RegOptions aRegOptions;
+ utl::RegOptions aRegOptions;
aRegOptions.activateReminder( 7 );
}
}
diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx
index 83018cfa804b..d3969828cb1f 100644
--- a/svtools/source/productregistration/registrationdlg.cxx
+++ b/svtools/source/productregistration/registrationdlg.cxx
@@ -35,7 +35,7 @@
#if 0 /* @@@ */
#include <svtools/svtdata.hxx>
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#endif /* @@@ */
diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src
index 86024ef765cd..f9462a420061 100644
--- a/svtools/source/productregistration/registrationdlg.src
+++ b/svtools/source/productregistration/registrationdlg.src
@@ -32,7 +32,7 @@
#include "registrationdlg.hrc"
#endif
#ifndef _SVTOOLS_HRC
-#include <svtools/svtools.hrc>
+#include <svl/svtools.hrc>
#endif
#ifndef _SVT_HELPID_HRC
#include <svtools/helpid.hrc>
diff --git a/svtools/source/svdde/ddecli.cxx b/svtools/source/svdde/ddecli.cxx
deleted file mode 100644
index e31e53d07522..000000000000
--- a/svtools/source/svdde/ddecli.cxx
+++ /dev/null
@@ -1,474 +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: ddecli.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#define UNICODE
-#include <string.h> // memset
-#include "ddeimp.hxx"
-#include <svtools/svdde.hxx>
-
-#include <osl/thread.h>
-#include <tools/debug.hxx>
-#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
-
-// static DWORD hDdeInst = NULL;
-// static short nInstance = 0;
-
-// DdeConnections* DdeConnection::pConnections = NULL;
-
-DdeInstData* ImpInitInstData()
-{
- DdeInstData* pData = new DdeInstData;
- memset( pData,0,sizeof(DdeInstData) );
- DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE );
- *ppInst = pData;
- return pData;
-}
-
-void ImpDeinitInstData()
-{
- DdeInstData** ppInst = (DdeInstData**)GetAppData( SHL_SVDDE );
- delete (*ppInst);
- *ppInst = 0;
-}
-
-
-struct DdeImp
-{
- HCONV hConv;
- long nStatus;
-};
-
-// --- DdeInternat::CliCallback() ----------------------------------
-
-HDDEDATA CALLBACK DdeInternal::CliCallback(
- WORD nCode, WORD nCbType, HCONV hConv, HSZ, HSZ hText2,
- HDDEDATA hData, DWORD nInfo1, DWORD )
-{
- HDDEDATA nRet = DDE_FNOTPROCESSED;
- DdeConnections& rAll = (DdeConnections&)DdeConnection::GetConnections();
- DdeConnection* self = 0;
-
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
-
- for ( self = rAll.First(); self; self = rAll.Next() )
- if ( self->pImp->hConv == hConv )
- break;
-
- if( self )
- {
- DdeTransaction* t;
- BOOL bFound = FALSE;
- for( t = self->aTransactions.First(); t; t = self->aTransactions.Next() )
- {
- switch( nCode )
- {
- case XTYP_XACT_COMPLETE:
- if( (DWORD)t->nId == nInfo1 )
- {
- nCode = t->nType & (XCLASS_MASK | XTYP_MASK);
- t->bBusy = FALSE;
- t->Done( 0 != hData );
- bFound = TRUE;
- }
- break;
-
- case XTYP_DISCONNECT:
- self->pImp->hConv = DdeReconnect( hConv );
- self->pImp->nStatus = self->pImp->hConv
- ? DMLERR_NO_ERROR
- : DdeGetLastError( pInst->hDdeInstCli );
- t = 0;
- nRet = 0;
- bFound = TRUE;
- break;
-
- case XTYP_ADVDATA:
- bFound = BOOL( *t->pName == hText2 );
- break;
- }
- if( bFound )
- break;
- }
-
- if( t )
- {
- switch( nCode )
- {
- case XTYP_ADVDATA:
- if( !hData )
- {
- ((DdeLink*) t)->Notify();
- nRet = (HDDEDATA)DDE_FACK;
- break;
- }
- // kein break;
-
- case XTYP_REQUEST:
- if( !hData && XTYP_REQUEST == nCode )
- {
-
- }
-
- DdeData d;
- d.pImp->hData = hData;
- d.pImp->nFmt = DdeData::GetInternalFormat( nCbType );
- d.Lock();
- t->Data( &d );
- nRet = (HDDEDATA)DDE_FACK;
- break;
- }
- }
- }
- return nRet;
-}
-
-// --- DdeConnection::DdeConnection() ------------------------------
-
-DdeConnection::DdeConnection( const String& rService, const String& rTopic )
-{
- pImp = new DdeImp;
- pImp->nStatus = DMLERR_NO_ERROR;
- pImp->hConv = NULL;
-
- DdeInstData* pInst = ImpGetInstData();
- if( !pInst )
- pInst = ImpInitInstData();
- pInst->nRefCount++;
- pInst->nInstanceCli++;
- if ( !pInst->hDdeInstCli )
- {
- pImp->nStatus = DdeInitialize( &pInst->hDdeInstCli,
- (PFNCALLBACK)DdeInternal::CliCallback,
- APPCLASS_STANDARD | APPCMD_CLIENTONLY |
- CBF_FAIL_ALLSVRXACTIONS |
- CBF_SKIP_REGISTRATIONS |
- CBF_SKIP_UNREGISTRATIONS, 0L );
- pInst->pConnections = new DdeConnections;
- }
-
- pService = new DdeString( pInst->hDdeInstCli, rService );
- pTopic = new DdeString( pInst->hDdeInstCli, rTopic );
-
- if ( pImp->nStatus == DMLERR_NO_ERROR )
- {
- pImp->hConv = DdeConnect( pInst->hDdeInstCli,*pService,*pTopic, NULL);
- if( !pImp->hConv )
- pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli );
- }
-
- if ( pInst->pConnections )
- pInst->pConnections->Insert( this );
-}
-
-// --- DdeConnection::~DdeConnection() -----------------------------
-
-DdeConnection::~DdeConnection()
-{
- if ( pImp->hConv )
- DdeDisconnect( pImp->hConv );
-
- delete pService;
- delete pTopic;
-
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- if ( pInst->pConnections )
- pInst->pConnections->Remove( this );
-
- pInst->nInstanceCli--;
- pInst->nRefCount--;
- if ( !pInst->nInstanceCli && pInst->hDdeInstCli )
- {
- if( DdeUninitialize( pInst->hDdeInstCli ) )
- {
- pInst->hDdeInstCli = NULL;
- delete pInst->pConnections;
- pInst->pConnections = NULL;
- if( pInst->nRefCount == 0 )
- ImpDeinitInstData();
- }
- }
- delete pImp;
-}
-
-// --- DdeConnection::IsConnected() --------------------------------
-
-BOOL DdeConnection::IsConnected()
-{
- CONVINFO c;
-#ifdef OS2
- c.nSize = sizeof( c );
-#else
- c.cb = sizeof( c );
-#endif
- if ( DdeQueryConvInfo( pImp->hConv, QID_SYNC, &c ) )
- return TRUE;
- else
- {
- DdeInstData* pInst = ImpGetInstData();
- pImp->hConv = DdeReconnect( pImp->hConv );
- pImp->nStatus = pImp->hConv ? DMLERR_NO_ERROR : DdeGetLastError( pInst->hDdeInstCli );
- return BOOL( pImp->nStatus == DMLERR_NO_ERROR );
- }
-}
-
-// --- DdeConnection::GetServiceName() -----------------------------
-
-const String& DdeConnection::GetServiceName()
-{
- return (const String&)*pService;
-}
-
-// --- DdeConnection::GetTopicName() -------------------------------
-
-const String& DdeConnection::GetTopicName()
-{
- return (const String&)*pTopic;
-}
-
-// --- DdeConnection::GetConvId() ----------------------------------
-
-long DdeConnection::GetConvId()
-{
- return (long)pImp->hConv;
-}
-
-const DdeConnections& DdeConnection::GetConnections()
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- return *(pInst->pConnections);
-}
-
-// --- DdeTransaction::DdeTransaction() ----------------------------
-
-DdeTransaction::DdeTransaction( DdeConnection& d, const String& rItemName,
- long n ) :
- rDde( d )
-{
- DdeInstData* pInst = ImpGetInstData();
- pName = new DdeString( pInst->hDdeInstCli, rItemName );
- nTime = n;
- nId = 0;
- nType = 0;
- bBusy = FALSE;
-
- rDde.aTransactions.Insert( this );
-}
-
-// --- DdeTransaction::~DdeTransaction() ---------------------------
-
-DdeTransaction::~DdeTransaction()
-{
- if ( nId && rDde.pImp->hConv )
- {
- DdeInstData* pInst = ImpGetInstData();
- DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId );
- }
-
- delete pName;
- rDde.aTransactions.Remove( this );
-}
-
-// --- DdeTransaction::Execute() -----------------------------------
-
-void DdeTransaction::Execute()
-{
- HSZ hItem = *pName;
- void* pData = (void*)(const void *)aDdeData;
- DWORD nData = (DWORD)(long)aDdeData;
- ULONG nIntFmt = aDdeData.pImp->nFmt;
- UINT nExtFmt = DdeData::GetExternalFormat( nIntFmt );
- DdeInstData* pInst = ImpGetInstData();
-
- if ( nType == XTYP_EXECUTE )
- hItem = NULL;
- if ( nType != XTYP_EXECUTE && nType != XTYP_POKE )
- {
- pData = NULL;
- nData = 0L;
- }
- if ( nTime )
- {
- HDDEDATA hData = DdeClientTransaction( (unsigned char*)pData,
- nData, rDde.pImp->hConv,
- hItem, nExtFmt, (UINT)nType,
- (DWORD)nTime, (DWORD FAR*)NULL );
-
- rDde.pImp->nStatus = DdeGetLastError( pInst->hDdeInstCli );
- if( hData && nType == XTYP_REQUEST )
- {
- {
- DdeData d;
- d.pImp->hData = hData;
- d.pImp->nFmt = nIntFmt;
- d.Lock();
- Data( &d );
- }
- DdeFreeDataHandle( hData );
- }
- }
- else
- {
- if ( nId && rDde.pImp->hConv )
- DdeAbandonTransaction( pInst->hDdeInstCli, rDde.pImp->hConv, nId);
- nId = 0;
- bBusy = TRUE;
- HDDEDATA hRet = DdeClientTransaction( (unsigned char*)pData, nData,
- rDde.pImp->hConv, hItem, nExtFmt,
- (UINT)nType, TIMEOUT_ASYNC,
- (DWORD FAR *) ((long*) &nId) );
- rDde.pImp->nStatus = hRet ? DMLERR_NO_ERROR
- : DdeGetLastError( pInst->hDdeInstCli );
- }
-}
-
-// --- DdeTransaction::GetName() -----------------------------------
-
-const String& DdeTransaction::GetName() const
-{
- return *pName;
-}
-
-// --- DdeTransaction::Data() --------------------------------------
-
-
-void __EXPORT DdeTransaction::Data( const DdeData* p )
-{
- Application::GetSolarMutex().acquire();
- aData.Call( (void*)p );
- Application::GetSolarMutex().release();
-}
-
-// --- DdeTransaction::Done() --------------------------------------
-
-void __EXPORT DdeTransaction::Done( BOOL bDataValid )
-{
- aDone.Call( (void*)bDataValid );
-}
-
-// --- DdeLink::DdeLink() ------------------------------------------
-
-DdeLink::DdeLink( DdeConnection& d, const String& aItemName, long n ) :
- DdeTransaction (d, aItemName, n)
-{
-}
-
-// --- DdeLink::~DdeLink() -----------------------------------------
-
-DdeLink::~DdeLink()
-{
- nType = (USHORT)XTYP_ADVSTOP;
- nTime = 0;
-}
-
-// --- DdeLink::Notify() -----------------------------------------
-
-void __EXPORT DdeLink::Notify()
-{
- aNotify.Call( NULL );
-}
-
-// --- DdeRequest::DdeRequest() ------------------------------------
-
-DdeRequest::DdeRequest( DdeConnection& d, const String& i, long n ) :
- DdeTransaction( d, i, n )
-{
- nType = XTYP_REQUEST;
-}
-
-// --- DdeWarmLink::DdeWarmLink() ----------------------------------
-
-DdeWarmLink::DdeWarmLink( DdeConnection& d, const String& i, long n ) :
- DdeLink( d, i, n )
-{
- nType = XTYP_ADVSTART | XTYPF_NODATA;
-}
-
-// --- DdeHotLink::DdeHotLink() ------------------------------------
-
-DdeHotLink::DdeHotLink( DdeConnection& d, const String& i, long n ) :
- DdeLink( d, i, n )
-{
- nType = XTYP_ADVSTART;
-}
-
-// --- DdePoke::DdePoke() ------------------------------------------
-
-DdePoke::DdePoke( DdeConnection& d, const String& i, const char* p,
- long l, ULONG f, long n ) :
- DdeTransaction( d, i, n )
-{
- aDdeData = DdeData( p, l, f );
- nType = XTYP_POKE;
-}
-
-// --- DdePoke::DdePoke() ------------------------------------------
-
-DdePoke::DdePoke( DdeConnection& d, const String& i, const String& rData,
- long n ) :
- DdeTransaction( d, i, n )
-{
-// ByteString aByteStr( rData, osl_getThreadTextEncoding() );
- aDdeData = DdeData( (void*) rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len()), CF_TEXT );
- nType = XTYP_POKE;
-}
-
-// --- DdePoke::DdePoke() ------------------------------------------
-
-DdePoke::DdePoke( DdeConnection& d, const String& i, const DdeData& rData,
- long n ) :
- DdeTransaction( d, i, n )
-{
- aDdeData = rData;
- nType = XTYP_POKE;
-}
-
-// --- DdeExecute::DdeExecute() ------------------------------------
-
-DdeExecute::DdeExecute( DdeConnection& d, const String& rData, long n ) :
- DdeTransaction( d, String(), n )
-{
-// ByteString aByteStr( rData, osl_getThreadTextEncoding() );
- aDdeData = DdeData( (void*)rData.GetBuffer(), sizeof(sal_Unicode) * (rData.Len() + 1), CF_TEXT );
- nType = XTYP_EXECUTE;
-}
-
-// --- DdeConnection::GetError() -----------------------------------
-
-long DdeConnection::GetError()
-{
- return pImp->nStatus;
-}
diff --git a/svtools/source/svdde/ddedata.cxx b/svtools/source/svdde/ddedata.cxx
deleted file mode 100644
index 9167c8585b08..000000000000
--- a/svtools/source/svdde/ddedata.cxx
+++ /dev/null
@@ -1,233 +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: ddedata.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_svtools.hxx"
-
-// ACHTUNG: es wird angenommen, dass StarView-Clipboard-Foamatnummern
-// und Windows-Formatnummern identisch sind! Ist dies einmal nicht der
-// Fall, muessen die Routinen hier angepasst werden. Die Implementation
-// verwendet die hier defineirten Konversionen.
-
-#define UNICODE
-
-#include <string.h>
-#include "ddeimp.hxx"
-#include <svtools/svdde.hxx>
-
-#include <osl/thread.h>
-
-#if defined( WIN ) && defined( MSC )
-#pragma code_seg( "SVDDE_MISC_CODE" )
-#endif
-
-// --- DdeData::DdeData() ------------------------------------------
-
-DdeData::DdeData()
-{
- pImp = new DdeDataImp;
- pImp->hData = NULL;
- pImp->nData = 0;
- pImp->pData = NULL;
- pImp->nFmt = CF_TEXT;
-}
-
-// --- DdeData::DdeData() ------------------------------------------
-
-DdeData::DdeData( const void* p, long n, ULONG f )
-{
- pImp = new DdeDataImp;
- pImp->hData = NULL;
- pImp->pData = (LPBYTE)p;
- pImp->nData = n;
- pImp->nFmt = f;
-}
-
-// --- DdeData::DdeData() ------------------------------------------
-
-DdeData::DdeData( const String& s )
-{
- pImp = new DdeDataImp;
- pImp->hData = NULL;
- pImp->pData = (LPBYTE)s.GetBuffer();
- pImp->nData = s.Len()+1;
- pImp->nFmt = CF_TEXT;
-}
-
-// --- DdeData::DdeData() ------------------------------------------
-
-DdeData::DdeData( const DdeData& rData )
-{
- pImp = new DdeDataImp;
- pImp->hData = rData.pImp->hData;
- pImp->nData = rData.pImp->nData;
- pImp->pData = rData.pImp->pData;
- pImp->nFmt = rData.pImp->nFmt;
- Lock();
-}
-
-// --- DdeData::~DdeData() -----------------------------------------
-
-DdeData::~DdeData()
-{
- if ( pImp && pImp->hData )
- DdeUnaccessData( pImp->hData );
- delete pImp;
-}
-
-// --- DdeData::Lock() ---------------------------------------------
-
-void DdeData::Lock()
-{
- if ( pImp->hData )
- pImp->pData = DdeAccessData( pImp->hData, (LPDWORD) &pImp->nData );
-}
-
-// --- DdeData::GetFormat() ----------------------------------------
-
-ULONG DdeData::GetFormat() const
-{
- return pImp->nFmt;
-}
-
-void DdeData::SetFormat( ULONG nFmt )
-{
- pImp->nFmt = nFmt;
-}
-
-// --- DdeData::operator const char*() -----------------------------
-
-DdeData::operator const void*() const
-{
- return pImp->pData;
-}
-
-// --- DdeData::operator long() ------------------------------------
-
-DdeData::operator long() const
-{
- return pImp->nData;
-}
-
-// --- DdeData::operator =() ---------------------------------------
-
-DdeData& DdeData::operator = ( const DdeData& rData )
-{
- if ( &rData != this )
- {
- DdeData tmp( rData );
- delete pImp;
- pImp = tmp.pImp;
- tmp.pImp = NULL;
- }
-
- return *this;
-}
-
-ULONG DdeData::GetExternalFormat( ULONG nFmt )
-{
- switch( nFmt )
- {
- case FORMAT_STRING:
- nFmt = CF_TEXT;
- break;
- case FORMAT_BITMAP:
- nFmt = CF_BITMAP;
- break;
- case FORMAT_GDIMETAFILE:
- nFmt = CF_METAFILEPICT;
- break;
-
- default:
- {
-#if defined(WNT) || defined(WIN) || defined( PM2 )
- String aName( SotExchange::GetFormatName( nFmt ) );
-
-#if defined(WNT) || defined(WIN)
-
- if( aName.Len() )
- nFmt = RegisterClipboardFormat( reinterpret_cast<LPCWSTR>(aName.GetBuffer()) );
-#endif
-#if defined( PM2 )
-
- if( aName.Len() )
- {
- HATOMTBL hSysTable = WinQuerySystemAtomTable();
- nFmt = (ULONG)WinAddAtom( hSysTable, (PSZ)aName.GetBuffer() );
- }
-#endif
-#endif
- }
- }
- return nFmt;
-}
-
-ULONG DdeData::GetInternalFormat( ULONG nFmt )
-{
- switch( nFmt )
- {
- case CF_TEXT:
- nFmt = FORMAT_STRING;
- break;
-
- case CF_BITMAP:
- nFmt = FORMAT_BITMAP;
- break;
-
- case CF_METAFILEPICT:
- nFmt = FORMAT_GDIMETAFILE;
- break;
-
- default:
-#if defined(WIN) || defined(WNT)
- if( nFmt >= CF_MAX )
- {
- TCHAR szName[ 256 ];
-
- if( GetClipboardFormatName( nFmt, szName, sizeof(szName) ) )
- nFmt = SotExchange::RegisterFormatName( String(reinterpret_cast<const sal_Unicode*>(szName)) );
- }
-#endif
-#if defined(PM2)
- if( nFmt > CF_PALETTE )
- {
- char szName[ 256 ];
-
- HATOMTBL hSysTable = WinQuerySystemAtomTable();
- WinQueryAtomName( hSysTable, (ATOM)nFmt, (PSZ)szName,
- sizeof( szName ) );
- nFmt = SotExchange::RegisterFormatName( String( szName ) );
- }
-#endif
- break;
- }
- return nFmt;
-}
-
diff --git a/svtools/source/svdde/ddedll.cxx b/svtools/source/svdde/ddedll.cxx
deleted file mode 100644
index 696d7b2851d2..000000000000
--- a/svtools/source/svdde/ddedll.cxx
+++ /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: ddedll.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#ifdef WIN
-
-
-#include <sysdep.hxx> // included svwin.h
-
-// Statische DLL-Verwaltungs-Variablen
-static HINSTANCE hDLLInst = 0; // HANDLE der DLL
-
-/***************************************************************************
-|* LibMain()
-|* Beschreibung Initialisierungsfunktion der DLL
-***************************************************************************/
-extern "C" int CALLBACK LibMain( HINSTANCE hDLL, WORD, WORD nHeap, LPSTR )
-{
-#ifndef WNT
- if ( nHeap )
- UnlockData( 0 );
-#endif
-
- hDLLInst = hDLL;
-
- return TRUE;
-}
-
-/***************************************************************************
-|* WEP()
-|* Beschreibung DLL-Deinitialisierung
-***************************************************************************/
-extern "C" int CALLBACK WEP( int )
-{
- return 1;
-}
-
-#endif
-
diff --git a/svtools/source/svdde/ddeimp.hxx b/svtools/source/svdde/ddeimp.hxx
deleted file mode 100644
index dcdf5b3be33c..000000000000
--- a/svtools/source/svdde/ddeimp.hxx
+++ /dev/null
@@ -1,180 +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: ddeimp.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 _DDEIMP_HXX
-#define _DDEIMP_HXX
-
-#ifdef OS2
-
-#include "ddemlos2.h"
-
-#define WORD USHORT
-#define DWORD ULONG
-#define LPBYTE BYTE*
-#define LPWORD USHORT*
-#define LPDWORD ULONG*
-#define LPCTSTR PCSZ
-
-#else
-
-#include <tools/prewin.h>
-#include <ddeml.h>
-#include <tools/postwin.h>
-#include "ddewrap.hxx"
-
-/*
-extern "C"
-{
-#define BOOL WIN_BOOL
-#define BYTE WIN_BYTE
-#undef BOOL
-#undef BYTE
-};
-*/
-
-#endif
-#include <tools/string.hxx>
-#include <tools/list.hxx>
-#include <tools/shl.hxx>
-
-class DdeService;
-class DdeTopic;
-class DdeItem;
-class DdeTopics;
-class DdeItems;
-
-// ----------------
-// - Conversation -
-// ----------------
-
-struct Conversation
-{
- HCONV hConv;
- DdeTopic* pTopic;
-};
-
-DECLARE_LIST( ConvList, Conversation* );
-
-// ---------------
-// - DdeInternal -
-// ---------------
-
-class DdeInternal
-{
-public:
-#ifdef WNT
- static HDDEDATA CALLBACK CliCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
- static HDDEDATA CALLBACK SvrCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
- static HDDEDATA CALLBACK InfCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
-#else
-#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC )
- static HDDEDATA CALLBACK __EXPORT CliCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
- static HDDEDATA CALLBACK __EXPORT SvrCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
- static HDDEDATA CALLBACK __EXPORT InfCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
-#else
- static HDDEDATA CALLBACK _export CliCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
- static HDDEDATA CALLBACK _export SvrCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
- static HDDEDATA CALLBACK _export InfCallback
- ( WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD );
-#endif
-#endif
- static DdeService* FindService( HSZ );
- static DdeTopic* FindTopic( DdeService&, HSZ );
- static DdeItem* FindItem( DdeTopic&, HSZ );
-};
-
-// -------------
-// - DdeString -
-// -------------
-
-class DdeString : public String
-{
-protected:
- HSZ hString;
- DWORD hInst;
-
-public:
- DdeString( DWORD, const sal_Unicode* );
- DdeString( DWORD, const String& );
- ~DdeString();
-
- int operator==( HSZ );
- operator HSZ();
-};
-
-// --------------
-// - DdeDataImp -
-// --------------
-
-struct DdeDataImp
-{
- HDDEDATA hData;
- LPBYTE pData;
- long nData;
- ULONG nFmt;
-};
-
-class DdeConnections;
-class DdeServices;
-
-struct DdeInstData
-{
- USHORT nRefCount;
- DdeConnections* pConnections;
- // Server
- long hCurConvSvr;
- ULONG hDdeInstSvr;
- short nInstanceSvr;
- DdeServices* pServicesSvr;
- // Client
- ULONG hDdeInstCli;
- short nInstanceCli;
-};
-
-#ifndef SHL_SVDDE
-#define SHL_SVDDE SHL_SHL2
-#endif
-
-inline DdeInstData* ImpGetInstData()
-{
- return (DdeInstData*)(*GetAppData( SHL_SVDDE ));
-}
-DdeInstData* ImpInitInstData();
-void ImpDeinitInstData();
-
-#endif // _DDEIMP_HXX
diff --git a/svtools/source/svdde/ddeinf.cxx b/svtools/source/svdde/ddeinf.cxx
deleted file mode 100644
index 7c2fb82789e6..000000000000
--- a/svtools/source/svdde/ddeinf.cxx
+++ /dev/null
@@ -1,193 +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: ddeinf.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_svtools.hxx"
-
-#define UNICODE
-
-#include <string.h>
-#include "ddeimp.hxx"
-#include <svtools/svdde.hxx>
-
-// --- DdeInternal::InfCallback() ----------------------------------
-
-#ifdef WNT
-HDDEDATA CALLBACK DdeInternal::InfCallback(
- WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD )
-#else
-#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC )
-HDDEDATA CALLBACK __EXPORT DdeInternal::InfCallback(
- WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD )
-#else
-HDDEDATA CALLBACK _export DdeInternal::InfCallback(
- WORD, WORD, HCONV, HSZ, HSZ, HDDEDATA, DWORD, DWORD )
-#endif
-#endif
-{
- return (HDDEDATA)DDE_FNOTPROCESSED;
-}
-
-// --- DdeServiceList::DdeServiceList() ----------------------------
-
-DdeServiceList::DdeServiceList( const String* pTopic )
-{
- DWORD hDdeInst = NULL;
- HCONVLIST hConvList = NULL;
- HCONV hConv = NULL;
- UINT nStatus = DMLERR_NO_ERROR;
- HSZ hTopic = NULL;
-
-#ifndef OS2 // YD FIXME
-
- nStatus = DdeInitialize( &hDdeInst, (PFNCALLBACK) DdeInternal::InfCallback,
- APPCLASS_STANDARD | APPCMD_CLIENTONLY |
- CBF_FAIL_ALLSVRXACTIONS |
- CBF_SKIP_ALLNOTIFICATIONS, 0L );
-
- if ( nStatus == DMLERR_NO_ERROR )
- {
- if ( pTopic )
- {
- LPCTSTR p = reinterpret_cast<LPCTSTR>(pTopic->GetBuffer());
-#ifdef __MINGW32__
- hTopic = DdeCreateStringHandle( hDdeInst, const_cast<LPTSTR>(p), CP_WINUNICODE );
-#else
- hTopic = DdeCreateStringHandle( hDdeInst, p, CP_WINUNICODE );
-#endif
- }
-
- hConvList = DdeConnectList( hDdeInst, NULL, hTopic, NULL, NULL );
- nStatus = DdeGetLastError( hDdeInst );
- }
-
- if ( nStatus == DMLERR_NO_ERROR )
- {
- while ( ( hConv = DdeQueryNextServer( hConvList, hConv ) ) != NULL)
- {
- CONVINFO aInf;
- TCHAR buf[256], *p;
- HSZ h;
-#ifdef OS2
- aInf.nSize = sizeof( aInf );
-#else
- aInf.cb = sizeof( aInf );
-#endif
- if( DdeQueryConvInfo( hConv, QID_SYNC, &aInf))
- {
- h = aInf.hszServiceReq;
- if ( !h )
-#ifndef OS2
- h = aInf.hszSvcPartner;
-#else
- h = aInf.hszPartner;
-#endif
- DdeQueryString( hDdeInst, h, buf, sizeof(buf) / sizeof(TCHAR), CP_WINUNICODE );
- p = buf + lstrlen( buf );
- *p++ = '|'; *p = 0;
- DdeQueryString( hDdeInst, aInf.hszTopic, p, sizeof(buf)/sizeof(TCHAR)-lstrlen( buf ),
- CP_WINUNICODE );
- aServices.Insert( new String( reinterpret_cast<const sal_Unicode*>(buf) ) );
- }
- }
- DdeDisconnectList( hConvList );
- }
-
- if ( hTopic)
- DdeFreeStringHandle( hDdeInst, hTopic );
- if ( hDdeInst )
- DdeUninitialize( hDdeInst );
-
-#endif
-
-}
-
-// --- DdeServiceList::~DdeServiceList() ---------------------------
-
-DdeServiceList::~DdeServiceList()
-{
- String* s;
- while ( ( s = aServices.First() ) != NULL )
- {
- aServices.Remove( s );
- delete s;
- }
-}
-
-// --- DdeTopicList::DdeTopicList() --------------------------------
-
-DdeTopicList::DdeTopicList( const String& rService )
-{
- DdeConnection aSys( rService, String( reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) ) );
-
- if ( !aSys.GetError() )
- {
- DdeRequest aReq( aSys, String( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_TOPICS) ), 500 );
- aReq.SetDataHdl( LINK( this, DdeTopicList, Data ) );
- aReq.Execute();
- }
-}
-
-// --- DdeTopicList::~DdeTopicList() -------------------------------
-
-DdeTopicList::~DdeTopicList()
-{
- String* s;
- while ( ( s = aTopics.First() ) != NULL )
- {
- aTopics.Remove( s );
- delete s;
- }
-}
-
-// --- DdeTopicList::Data() --------------------------------------------
-
-IMPL_LINK( DdeTopicList, Data, DdeData*, pData )
-{
- char* p = (char*) (const void *) *pData;
- char* q = p;
- short i;
- char buf[256];
-
- while ( *p && *p != '\r' && *p != '\n' )
- {
- q = buf; i = 0;
- while ( i < 255 && *p && *p != '\r' && *p != '\n' && *p != '\t' )
- *q++ = *p++, i++;
- *q = 0;
- while ( *p && *p != '\r' && *p != '\n' && *p != '\t' )
- p++;
- aTopics.Insert( new String( String::CreateFromAscii(buf) ) );
- if ( *p == '\t' )
- p++;
- }
- return 0;
-}
-
diff --git a/svtools/source/svdde/ddeml1.cxx b/svtools/source/svdde/ddeml1.cxx
deleted file mode 100644
index 6cc09b612ecf..000000000000
--- a/svtools/source/svdde/ddeml1.cxx
+++ /dev/null
@@ -1,2661 +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: ddeml1.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-/*
- ToDo / Bugs:
-
- - DdeInitiate: Eigener Thread?
- - Timeout bei Disconnects (IBM:nicht auf Ack warten!)
- - Konzept Errorhandling (globale/lokale Fehler)
- - Bedeutung/Anwendung Conversation-Contexte
- - Bei Zugriffen auf ConversationHandles WindowHandles checken
- - Namen der Partner-App ermitteln
- - Codepage-Geraffel
-*/
-#define INCL_DOSPROCESS
-
-#include "ddemlimp.hxx"
-
-#define LOGFILE
-#define STATUSFILE
-#define DDEDATAFILE
-#include "ddemldeb.hxx"
-
-
-#if defined (OS2) && defined (__BORLANDC__)
-#pragma option -w-par
-#endif
-
-// static
-inline BOOL ImpDdeMgr::MyWinDdePostMsg( HWND hWndTo, HWND hWndFrom,
- USHORT nMsg, PDDESTRUCT pData, ULONG nFlags )
-{
- BOOL bSuccess = WinDdePostMsg( hWndTo,hWndFrom,nMsg,pData,nFlags);
- if( !bSuccess )
- {
- WRITELOG("WinDdePostMsg:Failed!")
- if ( !(nFlags & DDEPM_NOFREE) )
- {
- MyDosFreeMem( pData,"MyWinDdePostMsg" );
- }
- }
- return bSuccess;
-}
-
-
-// *********************************************************************
-// ImpDdeMgr
-// *********************************************************************
-
-USHORT ImpDdeMgr::nLastErrInstance = 0;
-
-//
-// Conversation-WndProc
-// Steuert Transaktionen eines Conversationhandles
-//
-MRESULT EXPENTRY ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2)
-{
-#if defined(DBG_UTIL) && defined(OV_DEBUG)
- if( nMsg >= WM_DDE_FIRST && nMsg <= WM_DDE_LAST)
- {
- ////WRITELOG("::ConvWndProc:DDE-Msg received")
- }
-#endif
- ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 );
- return pObj->pThis->ConvWndProc( hWnd, nMsg, nPar1, nPar2 );
-}
-
-//
-// Server-WndProc
-// DDE-Server-Window der App
-//
-MRESULT EXPENTRY ServerWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2)
-{
-#if defined(DBG_UTIL) && defined(OV_DEBUG)
- if( nMsg >= WM_DDE_FIRST && nMsg <= WM_DDE_LAST)
- {
- ////WRITELOG("::ServerWndProc:DDE-Msg received")
- }
-#endif
- ImpDdeMgr* pObj = (ImpDdeMgr*)WinQueryWindowULong( hWnd, 0 );
- return pObj->SrvWndProc( hWnd, nMsg, nPar1, nPar2 );
-}
-
-
-inline HDDEDATA ImpDdeMgr::Callback( USHORT nTransactionType,
- USHORT nClipboardFormat, HCONV hConversationHandle, HSZ hsz1,
- HSZ hsz2, HDDEDATA hData, ULONG nData1, ULONG nData2 )
-{
- HDDEDATA hRet = (HDDEDATA)0;
- if( pCallback )
- hRet = (*pCallback)(nTransactionType, nClipboardFormat,
- hConversationHandle, hsz1, hsz2, hData, nData1, nData2);
- return hRet;
-}
-
-
-
-ImpDdeMgr::ImpDdeMgr()
-{
- nLastErrInstance = DMLERR_NO_ERROR;
- pCallback = 0;
- nTransactFilter = 0;
- nServiceCount = 0;
- pServices = 0;
- pAppTable = 0;
- pConvTable = 0;
- pTransTable = 0;
- bServFilterOn = TRUE;
- bInSyncTrans = FALSE;
-
- CreateServerWnd();
- pData = InitAll();
- if ( !pData )
- nLastErrInstance = DMLERR_MEMORY_ERROR;
- else
- RegisterDDEMLApp();
-}
-
-ImpDdeMgr::~ImpDdeMgr()
-{
- CleanUp();
- DestroyServerWnd();
-// Named Shared Mem vom BS loeschen lassen, da nicht bekannt ist,
-// wieviele DDEML-Instanzen die App erzeugt hat, und OS/2
-// keinen App-Referenzzaehler fuer shared mem fuehrt.
-// if ( pData )
-// DosFreeMem( pData );
-}
-
-
-BOOL ImpDdeMgr::IsSameInstance( HWND hWnd )
-{
- TID tid; PID pid;
- WinQueryWindowProcess( hWnd, &pid, &tid );
- return (BOOL)(pid == pidThis);
-}
-
-HSZ ImpDdeMgr::GetAppName( HWND hWnd )
-{
- return 0;
-}
-
-// static
-ImpDdeMgr* ImpDdeMgr::GetImpDdeMgrInstance( HWND hWnd )
-{
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if( !pData )
- return 0;
-
- ImpDdeMgr* pResult = 0;
- TID tid; PID pidApp;
- WinQueryWindowProcess( hWnd, &pidApp, &tid );
- HWND* pApp = ImpDdeMgr::GetAppTable( pData );
- USHORT nCurApp = 0;
- while( nCurApp < pData->nMaxAppCount )
- {
- HWND hCurWin = *pApp;
- if( hCurWin )
- {
- PID pidCurApp;
- WinQueryWindowProcess( hCurWin, &pidCurApp, &tid );
- if( pidCurApp == pidApp )
- {
- pResult = (ImpDdeMgr*)WinQueryWindowULong( hCurWin, 0 );
- break;
- }
- }
- pApp++;
- nCurApp++;
- }
- return pResult;
-}
-
-
-
-
-
-void ImpDdeMgr::CleanUp()
-{
- DisconnectAll();
- ImpService* pPtr = pServices;
- if( pPtr )
- {
- for( USHORT nIdx = 0; nIdx < nServiceCount; nIdx++, pPtr++ )
- {
- HSZ hStr = pPtr->hBaseServName;
- if( hStr )
- DdeFreeStringHandle( hStr );
- hStr = pPtr->hInstServName;
- if( hStr )
- DdeFreeStringHandle( hStr );
- }
- nServiceCount = 0;
- delete pServices;
- pServices = 0;
- }
- bServFilterOn = TRUE; // default setting DDEML
- UnregisterDDEMLApp();
-}
-
-void ImpDdeMgr::RegisterDDEMLApp()
-{
- HWND* pPtr = pAppTable;
- HWND hCur;
- USHORT nPos = 0;
- while( nPos < pData->nMaxAppCount )
- {
- hCur = *pPtr;
- if (hCur == (HWND)0 )
- {
- // in Tabelle stellen
- *pPtr = hWndServer;
- break;
- }
- nPos++;
- pPtr++;
- }
-}
-
-void ImpDdeMgr::UnregisterDDEMLApp()
-{
- HWND* pPtr = pAppTable;
- USHORT nPos = 0;
- while( nPos < pData->nMaxAppCount )
- {
- if (*pPtr == hWndServer )
- {
- *pPtr = 0;
- break;
- }
- nPos++;
- pPtr++;
- }
-}
-
-// static
-ImpDdeMgrData* ImpDdeMgr::AccessMgrData()
-{
- ImpDdeMgrData* pData = 0;
- APIRET nRet = DosGetNamedSharedMem((PPVOID)&pData,DDEMLDATA,PAG_READ|PAG_WRITE);
- DBG_ASSERT(!nRet,"DDE:AccessMgrData failed");
- return pData;
-}
-
-USHORT ImpDdeMgr::DdeGetLastError()
-{
- USHORT nErr;
- if ( !pData )
- nErr = DMLERR_DLL_NOT_INITIALIZED;
- else if ( nLastErrInstance )
- nErr = nLastErrInstance;
- else
- nErr = pData->nLastErr;
-
- nLastErrInstance = 0;
- pData->nLastErr = 0;
- return nErr;
-}
-
-
-
-USHORT ImpDdeMgr::DdeInitialize( PFNCALLBACK pCallbackProc, ULONG nTransactionFilter )
-{
- if ( !nLastErrInstance )
- {
- if ( !pCallbackProc )
- {
- nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return nLastErrInstance;
- }
- pCallback = pCallbackProc;
- nTransactFilter = nTransactionFilter;
- nTransactFilter |= CBF_FAIL_SELFCONNECTIONS;
- }
- return nLastErrInstance;
-}
-
-
-// static
-HWND ImpDdeMgr::NextFrameWin( HENUM hEnum )
-{
- char aBuf[ 10 ];
-
- HWND hWnd = WinGetNextWindow( hEnum );
- while( hWnd )
- {
- WinQueryClassName( hWnd, sizeof(aBuf)-1, (PCH)aBuf );
- // Frame-Window ?
- if( !strcmp( aBuf, "#1" ) ) // #define WC_FRAME ((PSZ)0xffff0001L)
- break;
- hWnd = WinGetNextWindow( hEnum );
- }
- return hWnd;
-}
-
-
-HCONV ImpDdeMgr::DdeConnectImp( HSZ hszService,HSZ hszTopic,CONVCONTEXT* pCC)
-{
- hCurConv = 0;
- if( !pCC )
- pCC = &aDefaultContext;
-
- ULONG nBufLen;
- PSZ pService = AllocAtomName( (ATOM)hszService, nBufLen );
- PSZ pTopic = AllocAtomName( (ATOM)hszTopic, nBufLen );
-#if 0 && defined(OV_DEBUG)
- String aStr("DdeConnectImp Service:");
- aStr += pService;
- aStr += " Topic:";
- aStr += pTopic;
- WRITELOG((char*)(const char*)aStr)
-#endif
-
-#if defined(OV_DEBUG)
- if( !strcmp(pService,"oliver voeltz") )
- {
- WRITESTATUS("Table of connections");
- MyDosFreeMem( pTopic,"DdeConnectImp" );
- MyDosFreeMem( pService,"DdeConnectImp" );
- return 0;
- }
-#endif
-
-#if 0
- // original pm-fkt benutzen
- HWND hWndCurClient = CreateConversationWnd();
- WinDdeInitiate( hWndCurClient, pService, pTopic, pCC );
- if( GetConversationWndRefCount(hWndCurClient) == 0)
- DestroyConversationWnd( hWndCurClient );
-#else
- // eigener Verbindungsaufbau
- HENUM hEnum = WinBeginEnumWindows( HWND_DESKTOP );
- HWND hWndCurSrv = NextFrameWin( hEnum );
- HWND hWndCurClient = CreateConversationWnd();
- while( hWndCurSrv && !hCurConv )
- {
- if( hWndCurSrv != hWndServer ||
- ((nTransactFilter & CBF_FAIL_SELFCONNECTIONS)==0 ))
- {
- // pro DDE-Server ein Conversation-Window erzeugen
- if( GetConversationWndRefCount(hWndCurClient) >= 2)
- {
- DestroyConversationWnd( hWndCurClient );
- hWndCurClient = CreateConversationWnd();
- }
- MyInitiateDde(hWndCurSrv,hWndCurClient,hszService,hszTopic,pCC);
- if( !bListConnect && hCurConv )
- break;
- }
- hWndCurSrv = NextFrameWin( hEnum );
- }
-
- if( GetConversationWndRefCount(hWndCurClient) == 0)
- DestroyConversationWnd( hWndCurClient );
- WinEndEnumWindows( hEnum );
-#endif
-
- if( !hCurConv )
- nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED;
-
-#if 0 && defined(OV_DEBUG)
- String aCStr( "DdeConnectImp:End ");
- if( nLastErrInstance != DMLERR_NO_CONV_ESTABLISHED )
- aCStr += "(Success)";
- else
- aCStr += "(Failed)";
- WRITELOG((char*)aCStr.GetStr())
-#endif
-
- MyDosFreeMem( pTopic,"DdeConnectImp" );
- MyDosFreeMem( pService,"DdeConnectImp" );
- return hCurConv;
-}
-
-HCONV ImpDdeMgr::DdeConnect( HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC)
-{
- ////WRITELOG("DdeConnect:Start")
- bListConnect = FALSE;
- HCONV hResult = DdeConnectImp( hszService, hszTopic, pCC );
- ////WRITELOG("DdeConnect:End")
- ////WRITESTATUS("DdeConnect:End")
- return hResult;
-}
-
-
-HCONVLIST ImpDdeMgr::DdeConnectList( HSZ hszService, HSZ hszTopic,
- HCONVLIST hConvList, CONVCONTEXT* pCC )
-{
- nPrevConv = 0;
- ////WRITESTATUS("Before DdeConnectList")
- if( hConvList )
- {
- HCONV hLastConvInList;
-
- hCurListId = hConvList;
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConvList;
- if( (USHORT)hConvList >= pData->nMaxConvCount ||pConv->hWndThis==0 )
- {
- nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return 0;
- }
- GetLastServer(pData, hConvList, hLastConvInList);
- nPrevConv = (USHORT)hLastConvInList;
- }
- else
- hCurListId = (HCONVLIST)WinCreateWindow( HWND_OBJECT, WC_FRAME,
- CONVLISTNAME, 0,0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0,0,0);
-
- bListConnect = TRUE;
- DdeConnectImp( hszService, hszTopic, pCC );
-#if 0 && defined(OV_DEBUG)
- WRITELOG("DdeConnectList:ConnectionList:")
- HCONV hDebug = 0;
- do
- {
- hDebug = DdeQueryNextServer( hCurListId, hDebug);
- String aStr( (ULONG)hDebug );
- WRITELOG((char*)(const char*)aStr)
- } while( hDebug );
-#endif
- ////WRITESTATUS("After DdeConnectList")
- return (HCONVLIST)hCurListId;
-}
-
-DDEINIT* ImpDdeMgr::CreateDDEInitData( HWND hWndDestination, HSZ hszService,
- HSZ hszTopic, CONVCONTEXT* pCC )
-{
- ULONG nLen1 = 0, nLen2 = 0;
- HATOMTBL hAtomTable = WinQuerySystemAtomTable();
-
- if( hszService )
- nLen1 = WinQueryAtomLength( hAtomTable, hszService );
- if( hszTopic )
- nLen2 = WinQueryAtomLength( hAtomTable, hszTopic );
- nLen1++; nLen2++;
-
- DDEINIT* pBuf = 0;
-
- ULONG nLen = sizeof(DDEINIT) + nLen1+ nLen2 + sizeof(CONVCONTEXT);
- if( !(MyDosAllocSharedMem((PPVOID)&pBuf, NULL, nLen,
- PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE | OBJ_ANY,
- "CreateDDEInitData")))
- {
- memset( pBuf, 0, nLen );
-
- /*
- PID pid; TID tid;
- WinQueryWindowProcess( hWndDestination, &pid, &tid );
- APIRET nRet = DosGiveSharedMem( pBuf, pid, PAG_READ | PAG_WRITE );
- */
-
- pBuf->cb = nLen;
- pBuf->offConvContext = sizeof( DDEINIT );
- char* pBase = (char*)pBuf;
- pBase += sizeof(DDEINIT);
- if( pCC )
- memcpy( pBase, pCC, sizeof(CONVCONTEXT) );
- pBase += sizeof(CONVCONTEXT);
- pBuf->pszAppName = pBase;
- if( hszService )
- WinQueryAtomName( hAtomTable, hszService, pBase, nLen1 );
- pBase += nLen1;
- pBuf->pszTopic = pBase;
- if( hszTopic )
- WinQueryAtomName( hAtomTable, hszTopic, pBase, nLen2 );
- }
- return pBuf;
-}
-
-
-
-void ImpDdeMgr::MyInitiateDde( HWND hWndSrv, HWND hWndClient,
- HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC )
-{
- DDEINIT* pBuf = CreateDDEInitData( hWndSrv, hszService, hszTopic, pCC );
- if( pBuf )
- {
- PID pid; TID tid;
- WinQueryWindowProcess( hWndSrv, &pid, &tid );
- APIRET nRet = DosGiveSharedMem( pBuf, pid, PAG_READ | PAG_WRITE );
- WinSendMsg( hWndSrv,WM_DDE_INITIATE,(MPARAM)hWndClient,(MPARAM)pBuf);
- MyDosFreeMem( pBuf,"MyInitiateDde" );
- }
-}
-
-// static
-ImpHCONV* ImpDdeMgr::GetFirstServer(ImpDdeMgrData* pData, HCONVLIST hConvList,
- HCONV& rhConv )
-{
- ImpHCONV* pPtr = GetConvTable( pData );
- HCONV hConv;
- if( !rhConv )
- {
- pPtr++;
- hConv = 1;
- }
- else
- {
- // Startposition
- pPtr += (USHORT)rhConv;
- hConv = rhConv;
- pPtr++; hConv++; // auf den naechsten
- }
- while( hConv < pData->nMaxConvCount )
- {
- if( pPtr->hConvList == hConvList )
- {
- rhConv = hConv;
- return pPtr;
- }
- pPtr++;
- hConv++;
- }
- rhConv = 0;
- return 0;
-}
-
-// static
-ImpHCONV* ImpDdeMgr::GetLastServer(ImpDdeMgrData* pData, HCONVLIST hConvList,
- HCONV& rhConv )
-{
- ImpHCONV* pPtr = GetConvTable( pData );
- pPtr += pData->nMaxConvCount;
- pPtr--;
- HCONV hConv = pData->nMaxConvCount;
- hConv--;
- while( hConv > 0 )
- {
- if( pPtr->hConvList == hConvList )
- {
- rhConv = hConv;
- return pPtr;
- }
- pPtr--;
- hConv--;
- }
- rhConv = 0;
- return 0;
-}
-
-// static
-BOOL ImpDdeMgr::CheckConvListId( HCONVLIST hConvListId )
-{
- HAB hAB = WinQueryAnchorBlock( (HWND)hConvListId );
- if( hAB )
- return WinIsWindow( hAB, (HWND)hConvListId );
- return FALSE;
- /*
- HAB hAB = WinQueryAnchorBlock( (HWND)hConvListId );
- if( hAB )
- {
- char aBuf[ 16 ];
- WinQueryWindowText( (HWND)hConvListId, sizeof(aBuf), aBuf );
- if( strcmp(aBuf, CONVLISTNAME ) == 0 )
- return TRUE;
- }
- return FALSE;
- */
-}
-
-// static
-HCONV ImpDdeMgr::DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev)
-{
- if( !CheckConvListId( hConvList ) )
- return (HCONV)0;
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- GetFirstServer( pData, hConvList, hConvPrev );
- return hConvPrev;
-}
-
-// static
-
-// Idee: DisconnectAll uebergibt das ServerWindow. Zu jedem HCONV
-// wird das Creator-Server-Wnd gespeichert. Disconnect braucht
-// dann nur noch die Window-Handles zu vergleichen
-BOOL ImpDdeMgr::DdeDisconnect( HCONV hConv )
-{
- WRITELOG("DdeDisconnect:Start")
- ////WRITESTATUS("DdeDisconnect:Start")
-
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if ( !pData )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return FALSE;
- }
- ImpHCONV* pConv = GetConvTable(pData) + (USHORT)hConv;
-
- if( (USHORT)hConv >= pData->nMaxConvCount || pConv->hWndThis==0 )
- {
- nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED;
- return FALSE;
- }
-
- PID pidApp; TID tid;
- HWND hWndDummy = WinCreateWindow( HWND_OBJECT, WC_FRAME,
- "Bla", 0, 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 );
- WinQueryWindowProcess( hWndDummy, &pidApp, &tid );
- WinDestroyWindow( hWndDummy );
- PID pidThis; PID pidPartner;
-
- HWND hWndThis = pConv->hWndThis;
- HWND hWndPartner = pConv->hWndPartner;
-
- WinQueryWindowProcess( hWndThis, &pidThis, &tid );
- WinQueryWindowProcess( hWndPartner, &pidPartner, &tid );
- if( pidApp != pidThis && pidApp != pidPartner )
- return TRUE; // gehoert nicht der App -> ueberspringen
-
- HCONV hConvPartner = pConv->hConvPartner;
-
- // die App benachrichtigen, dass alle offenen Advise-Loops
- // beendet werden, egal ob sie vom Server oder Client
- // initiiert wurden. Die Dinger aber nicht loeschen, da sie evtl.
- // noch vom Partner gebraucht werden.
- ImpConvWndData* pObj =
- (ImpConvWndData*)WinQueryWindowULong( pConv->hWndThis, 0 );
- ImpDdeMgr* pThis = pObj->pThis;
- pThis->SendUnadvises( hConv, 0, FALSE ); // alle Formate & NICHT loeschen
- pThis->SendUnadvises( hConvPartner, 0, FALSE ); // alle Formate & NICHT loeschen
-
- pConv->nStatus |= ST_TERMINATED;
-
- HAB hAB = WinQueryAnchorBlock( pConv->hWndThis );
- // um die MessageQueue inne Gaenge zu halten
- ULONG nTimerId = WinStartTimer( hAB, 0, 0, 50 );
-
- /*
- Die Partner-App muss ein DDE_TERMINATE posten, auf das
- wir warten muessen, um alle Messages zu bearbeiten, die
- _vor_ dem DdeDisconnect von der Partner-App gepostet
- wurden.
- */
- WRITELOG("DdeDisconnect:Waiting for acknowledge...")
- WinDdePostMsg( hWndPartner, hWndThis, WM_DDE_TERMINATE,
- (PDDESTRUCT)0,DDEPM_RETRY);
-
- QMSG aQueueMsg;
- BOOL bContinue = TRUE;
- while( bContinue )
- {
- if( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 ))
- {
- WinDispatchMsg( hAB, &aQueueMsg );
- if( (!WinIsWindow( hAB, hWndPartner)) ||
- (pConv->nStatus & ST_TERMACKREC) )
- {
- bContinue = FALSE;
- if( pConv->nStatus & ST_TERMACKREC )
- {
- WRITELOG("DdeDisconnect: TermAck received")
- }
- else
- {
- WRITELOG("DdeDisconnect: Partner died")
- }
- }
- }
- else
- bContinue = FALSE;
- }
-
- WinStopTimer( hAB, 0, nTimerId );
-
- // WRITELOG("DdeDisconnect:Freeing data")
- // Transaktionstabelle aufraeumen
- FreeTransactions( pData, hConv );
- if( hConvPartner )
- FreeTransactions( pData, hConvPartner );
-
- FreeConvHandle( pData, hConv );
-
- WRITELOG("DdeDisconnect:End")
- //WRITESTATUS("DdeDisconnect:End")
- return TRUE;
-}
-
-// static
-BOOL ImpDdeMgr::DdeDisconnectList( HCONVLIST hConvList )
-{
- if( !CheckConvListId( hConvList ) )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return FALSE;
- }
-
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if ( !pData )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return FALSE;
- }
- HCONV hConv = 0;
- GetFirstServer( pData, hConvList, hConv );
- while( hConv )
- {
- DdeDisconnect( hConv );
- GetFirstServer( pData, hConvList, hConv );
- }
- WinDestroyWindow( (HWND)hConvList );
- return TRUE;
-}
-
-
-
-// static
-HCONV ImpDdeMgr::DdeReconnect(HCONV hConv)
-{
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if ( !pData )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return 0;
- }
- return 0;
-}
-
-// static
-USHORT ImpDdeMgr::DdeQueryConvInfo(HCONV hConv, ULONG nTransId, CONVINFO* pCI)
-{
- if( !pCI || pCI->nSize == 0)
- return 0;
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if ( !pData )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return 0;
- }
- Transaction* pTrans;
- if( nTransId != QID_SYNC )
- {
- pTrans = ImpDdeMgr::GetTransTable( pData );
- pTrans += nTransId;
- if( nTransId >= pData->nMaxTransCount || pTrans->hConvOwner == 0 )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID;
- return 0;
- }
- }
- else
- pTrans = 0;
-
- ImpHCONV* pConv = ImpDdeMgr::GetConvTable( pData );
- pConv += (ULONG)hConv;
- if( hConv >= pData->nMaxConvCount || pConv->hWndThis == 0 )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED;
- return 0;
- }
-
- USHORT nSize = pCI->nSize;
- if( nSize > sizeof(CONVINFO) )
- nSize = sizeof(CONVINFO);
- CONVINFO aTempInfo;
- memset( &aTempInfo, 0, sizeof(CONVINFO) );
- aTempInfo.nSize = pCI->nSize;
- aTempInfo.hConvPartner = pConv->hConvPartner;
- aTempInfo.hszPartner = pConv->hszPartner;
- aTempInfo.hszServiceReq = pConv->hszServiceReq;
- aTempInfo.hszTopic = pConv->hszTopic;
- aTempInfo.nStatus = pConv->nStatus;
- aTempInfo.hConvList = pConv->hConvList;
- aTempInfo.aConvCtxt = pConv->aConvContext;
- if( pTrans )
- {
- aTempInfo.nUser = pTrans->nUser;
- aTempInfo.hszItem = pTrans->hszItem;
- aTempInfo.nFormat = pTrans->nFormat;
- aTempInfo.nType = pTrans->nType;
- aTempInfo.nConvst = pTrans->nConvst;
- aTempInfo.nLastError= pTrans->nLastError;
- }
- memcpy( pCI, &aTempInfo, nSize );
-
- return nSize;
-}
-
-// static
-BOOL ImpDdeMgr::DdeSetUserHandle(HCONV hConv, ULONG nTransId, ULONG hUser)
-{
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if ( !pData )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return FALSE;
- }
- Transaction* pTrans = GetTransTable( pData );
- pTrans += nTransId;
- if( !nTransId || !hConv || nTransId >= pData->nMaxTransCount ||
- pTrans->hConvOwner != hConv )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return FALSE;
- }
- if( !pTrans->hConvOwner)
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID;
- return FALSE;
- }
- pTrans->nUser = hUser;
- return TRUE;
-}
-
-BOOL ImpDdeMgr::DdeAbandonTransaction( HCONV hConv, ULONG nTransId )
-{
- ////WRITELOG("DdeAbandonTransaction:Start")
- if( !pData )
- {
- nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return FALSE;
- }
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
- if( nTransId < 1 || nTransId >= pData->nMaxTransCount ||
- hConv < 1 || hConv >= pData->nMaxConvCount || !pConv->hWndThis)
- {
- nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return FALSE;
- }
- if( !hConv )
- {
- DBG_ASSERT(0,"DdeAbandonTransaction:NULL-hConv not supported");
- nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return FALSE;
- }
- Transaction* pTrans = pTransTable;
- pTrans += (USHORT)nTransId;
- if( pTrans->hConvOwner != hConv )
- {
- nLastErrInstance = DMLERR_UNFOUND_QUEUE_ID;
- return FALSE;
- }
-
- if( bInSyncTrans && nTransId == nSyncTransId )
- {
- bSyncAbandonTrans = TRUE;
- return TRUE;
- }
- USHORT nTempType = pTrans->nType;
- nTempType &= (~XTYPF_MASK);
- if( nTempType == (XTYP_ADVREQ & ~(XTYPF_NOBLOCK)))
- {
- ////WRITELOG("DdeAbandTrans:Advise Loop")
-
-// ----------------------------------------------------------------------
-// Der von der Deutschen Bank eingesetzte DDE-Server
-// "Invision V2.71 Build 36 Mar 12 1999 V4.8.2" hat einen Bug, der
-// dazu fuehrt, dass auf per WM_DDE_TERMINATE geschlossene Verbindungen
-// nicht mit einem WM_DDE_TERMINATE geantwortet wird, wenn der
-// entsprechende Link vorher per WM_DDE_UNADVISE beendet wurde. Dieser
-// Bug tritt ab zwei parallel laufenden Links auf. Auf Wunsch der DB
-// wurde das folgende Workaround eingebaut.
-// ----------------------------------------------------------------------
-#define DEUTSCHE_BANK
-#ifndef DEUTSCHE_BANK
-
-// Acknowledge ist beim Unadvise nicht ueblich
-//#define SO_DDE_ABANDON_TRANSACTION_WAIT_ACK
-#ifdef SO_DDE_ABANDON_TRANSACTION_WAIT_ACK
- DDESTRUCT* pOutDDEData = MakeDDEObject( pConv->hWndPartner,
- pTrans->hszItem, DDE_FACKREQ, 0 /*pTrans->nFormat*/, 0, 0);
-#else
- DDESTRUCT* pOutDDEData = MakeDDEObject( pConv->hWndPartner,
- pTrans->hszItem, 0, 0 /*pTrans->nFormat*/, 0, 0);
-#endif
- WRITELOG("DdeAbandTrans:Waiting for acknowledge...")
- pTrans->nConvst = XST_UNADVSENT;
- if ( !MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis,
- WM_DDE_UNADVISE, pOutDDEData, DDEPM_RETRY ) )
- {
- WRITELOG("DdeAbandTrans:PostMsg Failed")
- return FALSE;
- }
-#ifdef SO_DDE_ABANDON_TRANSACTION_WAIT_ACK
- WaitTransState( pTrans, nTransId, XST_UNADVACKRCVD, 0 );
-#else
- pTrans->nConvst = XST_UNADVACKRCVD;
-#endif
-
-#endif // DEUTSCHE_BANK
-
- WRITELOG("DdeAbandTrans:Ack received->Freeing transaction")
- FreeTransaction( pData, nTransId );
- }
- WRITELOG("DdeAbandonTransaction:End")
- return TRUE;
-}
-
-// wird von einem Server aufgerufen, wenn sich die Daten des
-// Topic/Item-Paars geaendert haben. Diese Funktion fordert
-// dann den Server auf, die Daten zu rendern (bei Hotlinks) und
-// benachrichtigt die Clients
-BOOL ImpDdeMgr::DdePostAdvise( HSZ hszTopic, HSZ hszItem)
-{
- ////WRITELOG("DdePostAdvise:Start")
- ////WRITESTATUS("DdePostAdvise:Start")
-
-#if 0 && defined( OV_DEBUG )
- String aDebStr("DdePostAdvise:Item ");
- aDebStr += (ULONG)hszItem;
- WRITELOG((char*)(const char*)aDebStr)
-#endif
-
- Transaction* pTrans = pTransTable;
- pTrans++;
- USHORT nCurTrans = 1;
- USHORT nUsedTransactions = pData->nCurTransCount;
- while( nUsedTransactions && nCurTrans < pData->nMaxTransCount )
- {
- HCONV hOwner = pTrans->hConvOwner;
- if( hOwner )
- {
- nUsedTransactions--;
- USHORT nTempType = pTrans->nType;
- nTempType &= (~XTYPF_MASK);
- if( nTempType == (XTYP_ADVREQ & (~XTYPF_NOBLOCK) ) )
- {
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hOwner;
- if(hszItem == pTrans->hszItem && pConv->hszTopic == hszTopic)
- {
- if( pConv->hConvPartner )
- {
- // Transaktionen werden immer vom Client erzeugt
- // -> auf Server-HCONV umschalten
- hOwner = pConv->hConvPartner;
- pConv = pConvTable;
- pConv += (USHORT)hOwner;
- }
- HWND hWndClient = pConv->hWndPartner;
- HWND hWndServer = pConv->hWndThis;
-#if 0 && defined( OV_DEBUG )
- String aDebStr("DdePostAdvise: Server:");
- aDebStr += (ULONG)hWndServer;
- aDebStr += " Client:";
- aDebStr += (ULONG)hWndClient;
- WRITELOG((char*)(const char*)aDebStr)
-#endif
- DDESTRUCT* pOutDDEData;
- if ( pTrans->nType & XTYPF_NODATA )
- {
- // Warm link
- ////WRITELOG("DdePostAdvise:Warm link found")
- pOutDDEData = MakeDDEObject( hWndClient, hszItem,
- DDE_FNODATA, pTrans->nFormat, 0, 0 );
- }
- else
- {
- // Hot link
- ////WRITELOG("DdePostAdvise:Hot link found")
- pOutDDEData = Callback( XTYP_ADVREQ,
- pTrans->nFormat, hOwner, hszTopic,
- hszItem, (HDDEDATA)0, 1, 0 );
- }
- if( pOutDDEData )
- {
- // todo: FACK_REQ in Out-Data setzen, wenn pTrans->nType & XTYPF_ACKREQ
- ////WRITELOG("DdePostAdvise:Sending data/notification")
- BOOL bSuccess = MyWinDdePostMsg( hWndClient,
- hWndServer,WM_DDE_DATA, pOutDDEData, DDEPM_RETRY);
- if( bSuccess )
- {
- // auf Acknowledge des Partners warten ?
- if( pTrans->nType & XTYPF_ACKREQ )
- {
- pTrans->nConvst = XST_ADVDATASENT;
- // Impl. ist falsch! => korrekt: XST_ADVDATAACKRCVD
- WaitTransState(pTrans, nCurTrans,
- XST_UNADVACKRCVD, 0);
- }
- }
- else
- {
- ////WRITELOG("DdePostAdvise:PostMsg failed")
- nLastErrInstance = DMLERR_POSTMSG_FAILED;
- }
- }
- else
- {
- ////WRITELOG("DdePostAdvise:No data to send")
- }
- }
- }
- }
- nCurTrans++;
- pTrans++;
- }
- ////WRITELOG("DdePostAdvise:End")
- return TRUE;
-}
-
-BOOL ImpDdeMgr::DdeEnableCallback( HCONV hConv, USHORT wCmd)
-{
- return FALSE;
-}
-
-// Rueckgabe: 0==Service nicht registriert; sonst Pointer auf Service-Eintrag
-ImpService* ImpDdeMgr::GetService( HSZ hszService )
-{
- ImpService* pPtr = pServices;
- if( !pPtr || !hszService )
- return 0;
- for( ULONG nIdx = 0; nIdx < nServiceCount; nIdx++, pPtr++ )
- {
- if(( hszService == pPtr->hBaseServName ) ||
- ( hszService == pPtr->hInstServName ) )
- return pPtr;
- }
- return 0;
-}
-
-
-// legt Service in Service-Tabelle ab. Tabelle wird ggf. expandiert
-ImpService* ImpDdeMgr::PutService( HSZ hszService )
-{
- if( !pServices )
- {
- DBG_ASSERT(nServiceCount==0,"DDE:Bad ServiceCount");
- pServices = new ImpService[ DDEMLSERVICETABLE_INISIZE ];
- memset( pServices, 0, DDEMLSERVICETABLE_INISIZE* sizeof(ImpService));
- nServiceCount = DDEMLSERVICETABLE_INISIZE;
- }
- ImpService* pPtr = pServices;
- USHORT nCurPos = 0;
- while( pPtr )
- {
- if( pPtr->hBaseServName == 0 )
- break;
- nCurPos++;
- if( nCurPos < nServiceCount )
- pPtr++;
- else
- pPtr = 0;
- }
- if( !pPtr )
- {
- // Tabelle vergroessern
- pPtr = new ImpService[ nServiceCount + DDEMLSERVICETABLE_INISIZE ];
- memset( pPtr, 0, DDEMLSERVICETABLE_INISIZE* sizeof(ImpService));
- memcpy( pPtr, pServices, nServiceCount * sizeof(ImpService) );
-#ifdef DBG_UTIL
- memset( pServices, 0, nServiceCount * sizeof(ImpService) );
-#endif
- delete pServices;
- pServices = pPtr;
- pPtr += nServiceCount; // zeigt auf erste neue Position
- nServiceCount += DDEMLSERVICETABLE_INISIZE;
- }
- DBG_ASSERT(pPtr->hBaseServName==0,"DDE:Service not empty");
- DBG_ASSERT(pPtr->hInstServName==0,"DDE:Service not empty");
-
- DdeKeepStringHandle( hszService );
-
- USHORT nStrLen = (USHORT)DdeQueryString( hszService, 0, 0, 0);
- char* pBuf = new char[ nStrLen + 1 ];
- DdeQueryString(hszService, pBuf, nStrLen, 850 /* CodePage*/ );
- pBuf[ nStrLen ] = 0;
- String aStr( (ULONG)hWndServer );
- aStr += pBuf;
- HSZ hszInstServ = DdeCreateStringHandle( (PSZ)(const char*)pBuf, 850 );
- delete pBuf;
-
- pPtr->hBaseServName = hszService;
- pPtr->hInstServName = hszInstServ;
- return pPtr;
-}
-
-void ImpDdeMgr::BroadcastService( ImpService* pService, BOOL bRegistered )
-{
- DBG_ASSERT(pService,"DDE:No Service");
- if( !pService )
- return;
- MPARAM aMp1 = (MPARAM)(pService->hBaseServName);
- MPARAM aMp2 = (MPARAM)(pService->hInstServName);
- ULONG nMsg;
- if( bRegistered )
- nMsg = WM_DDEML_REGISTER;
- else
- nMsg = WM_DDEML_UNREGISTER;
-
- HWND* pPtr = pAppTable;
- for( USHORT nPos = 0; nPos < pData->nMaxAppCount; nPos++, pPtr++ )
- {
- HWND hWndCurWin = *pPtr;
- if ( hWndCurWin && hWndCurWin != hWndServer )
- WinSendMsg( hWndCurWin, nMsg, aMp1, aMp2 );
- }
-}
-
-HDDEDATA ImpDdeMgr::DdeNameService( HSZ hszService, USHORT afCmd )
-{
- HDDEDATA hRet = (HDDEDATA)1;
-
- if( afCmd & DNS_FILTERON )
- bServFilterOn = TRUE;
- else if( afCmd & DNS_FILTEROFF )
- bServFilterOn = FALSE;
- ImpService* pService = GetService( hszService );
- BOOL bRegister = (BOOL)(afCmd & DNS_REGISTER);
- if( bRegister )
- {
- if( !pService )
- {
- pService = PutService( hszService );
- BroadcastService( pService, TRUE );
- }
- }
- else
- {
- if( pService )
- {
- BroadcastService( pService, FALSE );
- DdeFreeStringHandle( pService->hBaseServName );
- pService->hBaseServName = 0;
- DdeFreeStringHandle( pService->hInstServName );
- pService->hInstServName = 0;
- }
- hRet = (HDDEDATA)0; // Service nicht gefunden
- }
- return hRet;
-}
-
-
-// static
-HDDEDATA ImpDdeMgr::DdeClientTransaction(void* pDdeData, ULONG cbData,
- HCONV hConv, HSZ hszItem, USHORT nFormat, USHORT nType,
- ULONG nTimeout, ULONG* pResult)
-{
- //WRITELOG("DdeClientTransaction:Start")
-
-#if 0 && defined(OV_DEBUG)
- if( nType == XTYP_REQUEST )
- {
- WRITELOG("Start XTYP_REQUEST");
- WinMessageBox(HWND_DESKTOP,HWND_DESKTOP,
- "Start XTYP_REQUEST","DdeClientTransaction",
- HWND_DESKTOP,MB_OK);
- }
-#endif
-
- if( pResult )
- *pResult = 0;
-
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if ( !pData )
- {
- ImpDdeMgr::nLastErrInstance = DMLERR_DLL_NOT_INITIALIZED;
- return (HDDEDATA)0;
- }
-
- BOOL bIsDdeHandle = (BOOL)(pDdeData && cbData==0xffffffff);
- BOOL bAppOwnsHandle = (BOOL)( bIsDdeHandle &&
- (((DDESTRUCT*)pDdeData)->fsStatus & IMP_HDATAAPPOWNED) );
-
- BOOL bNoData = (BOOL)(nType & XTYPF_NODATA)!=0;
- BOOL bAckReq = (BOOL)(nType & XTYPF_ACKREQ)!=0;
- USHORT nTypeFlags = nType & XTYPF_MASK;
- nType &= (~XTYPF_MASK);
-
- BOOL bSync = (BOOL)( nTimeout != TIMEOUT_ASYNC ) != 0;
- if( nType == XTYP_ADVSTART )
- bSync = TRUE;
-
- // Mapping transaction -> OS/2-Message
- USHORT nTimeoutErr, nMsg;
- switch ( nType )
- {
- case XTYP_ADVSTART:
- nMsg = WM_DDE_ADVISE;
- nTimeoutErr = DMLERR_ADVACKTIMEOUT;
-{
- nTimeout = 60000;
-#if 0 && defined(OV_DEBUG)
- char aBuf[ 128 ];
- ImpDdeMgr::DdeQueryString( hszItem,aBuf,127,850);
- String aXXStr("Establishing hotlink ");
- aXXStr += aBuf;
- WRITELOG((char*)aXXStr.GetStr());
-#endif
-
-}
- break;
-
- case XTYP_ADVSTOP:
- nMsg = WM_DDE_UNADVISE;
- nTimeoutErr = DMLERR_UNADVACKTIMEOUT;
- break;
-
- case XTYP_REQUEST:
- nMsg = WM_DDE_REQUEST;
- nTimeoutErr = DMLERR_DATAACKTIMEOUT;
- break;
-
- case XTYP_POKE:
- nMsg = WM_DDE_POKE;
- nTimeoutErr = DMLERR_POKEACKTIMEOUT;
- break;
-
- case XTYP_EXECUTE:
- nMsg = WM_DDE_EXECUTE;
- nTimeoutErr = DMLERR_EXECACKTIMEOUT;
- break;
-
- default:
- nMsg = 0;
- }
- if(!hConv || (USHORT)hConv>= pData->nMaxConvCount || !nType || !nMsg ||
- (nType != XTYP_EXECUTE && (!hszItem || !nFormat)) )
- {
- WRITELOG("DdeClientTransaction:Invalid parameter")
- ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER;
- if( bIsDdeHandle && !bAppOwnsHandle )
- DdeFreeDataHandle( (HDDEDATA)pDdeData );
- return (HDDEDATA)0;
- }
-
- // ueber den Conversation handle das ImpDdeMgr-Objekt holen
- ImpHCONV* pConv = GetConvTable( pData );
- pConv += (USHORT)hConv;
- ImpConvWndData* pObj =
- (ImpConvWndData*)WinQueryWindowULong( pConv->hWndThis, 0 );
- ImpDdeMgr* pThis = pObj->pThis;
-
- if( bSync && pThis->bInSyncTrans )
- {
- WRITELOG("DdeClientTransaction:Already in sync. transaction")
- ImpDdeMgr::nLastErrInstance = DMLERR_REENTRANCY;
- if( bIsDdeHandle && !bAppOwnsHandle )
- DdeFreeDataHandle( (HDDEDATA)pDdeData );
- return (HDDEDATA)0;
- }
-
- Transaction* pTrans;
-
- BOOL bReqOnAdvLoop = FALSE;
- ULONG nTransId = GetTransaction( pData, hConv, hszItem, nFormat );
- if( nTransId )
- {
- // WRITELOG("DdeClientTransaction:Transaction found")
- pTrans = GetTransTable( pData );
- pTrans += (USHORT)nTransId;
- USHORT nTransType = pTrans->nType;
- nTransType &= (~XTYPF_MASK);
- if( (nType != XTYP_REQUEST && nTransType == nType) ||
- // wird Advise-Loop schon zum requesten missbraucht ?
- (nType == XTYP_REQUEST &&
- nTransType == XTYP_ADVREQ &&
- pTrans->nConvst == XST_WAITING_REQDATA))
- {
- // dieser Kanal ist dicht!
- WRITELOG("DdeClientTransaction:Transaction already used")
- ImpDdeMgr::nLastErrInstance = DMLERR_REENTRANCY;
- if( bIsDdeHandle && !bAppOwnsHandle )
- DdeFreeDataHandle( (HDDEDATA)pDdeData );
- return (HDDEDATA)0;
- }
- else if( nTransType == XTYP_ADVREQ )
- {
- switch( nType )
- {
- case XTYP_ADVSTOP:
- //WRITELOG("DdeClientTransaction:Stopping advise trans")
- pTrans->nType = XTYP_ADVSTOP;
- break;
-
- case XTYP_ADVSTART:
- //WRITELOG("DdeClientTransaction:Adj. Advise-Params")
- pTrans->nType = XTYP_ADVREQ;
- if( bNoData )
- pTrans->nType |= XTYPF_NODATA;
- if( bAckReq )
- pTrans->nType |= XTYPF_ACKREQ;
- if( pResult )
- *pResult = nTransId;
- return (HDDEDATA)TRUE;
-
- case XTYP_REQUEST:
- // WRITELOG("DdeClientTransaction:Using adv trans for req")
- // nConvst wird unten auf XST_WAITING_REQDATA gesetzt
- bReqOnAdvLoop = TRUE;
- break;
-
- default:
- WRITELOG("DdeClientTransaction:Invalid parameter")
- ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER;
- if( bIsDdeHandle && !bAppOwnsHandle )
- DdeFreeDataHandle( (HDDEDATA)pDdeData );
- return (HDDEDATA)FALSE;
- }
- }
- }
- else
- {
- // WRITELOG("DdeClientTransaction:Creating transaction")
- nTransId = CreateTransaction(pData, hConv, hszItem, nFormat, nType);
- }
-
- pTrans = GetTransTable( pData );
- pTrans += (USHORT)nTransId;
- pTrans->nConvst = XST_WAITING_ACK;
- if( nType == XTYP_REQUEST )
- pTrans->nConvst = XST_WAITING_REQDATA;
-
- HWND hWndServer = pConv->hWndPartner;
- HWND hWndClient = pConv->hWndThis;
-
- HDDEDATA pOutDDEData;
- if( bIsDdeHandle )
- {
- if( bAppOwnsHandle )
- {
- // wir muessen leider leider duplizieren, da uns OS/2
- // keine Chance laesst, diesen Status im Datenobjekt
- // zu versenken.
- ////WRITELOG("DdeClientTransaction:Copying handle")
- HDDEDATA pNew;
- HDDEDATA pData = (HDDEDATA)pDdeData;
- if( !(MyDosAllocSharedMem((PPVOID)&pNew, NULL, pData->cbData,
- PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GIVEABLE | OBJ_ANY,
- "MakeDDEObject")))
- {
- memcpy( pNew, pData, pData->cbData );
- pOutDDEData = pNew;
- }
- else
- {
- WRITELOG("DdeClientTransaction:No Memory")
- ImpDdeMgr::nLastErrInstance = DMLERR_LOW_MEMORY;
- return (HDDEDATA)0;
- }
- }
- else
- pOutDDEData = (HDDEDATA)pDdeData;
- }
- else
- pOutDDEData=MakeDDEObject(hWndServer,hszItem,0,nFormat,pDdeData,cbData);
-
- pOutDDEData->fsStatus |= nTypeFlags;
-
- HDDEDATA pDDEInData = 0;
- if( bSync )
- {
- if( nType != XTYP_REQUEST )
- pOutDDEData->fsStatus |= DDE_FACKREQ;
-
- // WRITELOG("DdeClientTransaction:Starting sync. trans.")
- pThis->hSyncResponseData = (HDDEDATA)0;
- pThis->nSyncResponseMsg = 0;
- pThis->bInSyncTrans = TRUE;
- pThis->nSyncTransId = nTransId;
- pThis->bSyncAbandonTrans = FALSE;
-
- if ( !MyWinDdePostMsg( hWndServer, hWndClient, nMsg, pOutDDEData,
- DDEPM_RETRY) )
- {
- WRITELOG("DdeClientTransaction:PostMsg failed")
- nLastErrInstance = DMLERR_POSTMSG_FAILED;
- if( !bReqOnAdvLoop )
- FreeTransaction( pData, nTransId );
- else
- {
- DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Error!")
- pTrans->nConvst = 0;
- }
- return FALSE;
- }
- HAB hAB = WinQueryAnchorBlock( hWndClient );
- ULONG nDummyTimer = WinStartTimer( hAB, 0, 0, 50 );
- ULONG nTimeoutId = TID_USERMAX - nTransId;
- WinStartTimer( hAB, hWndClient, nTimeoutId, nTimeout );
- QMSG aQueueMsg;
- BOOL bLoop = TRUE;
- while( bLoop )
- {
- if( pThis->nSyncResponseMsg )
- bLoop = FALSE;
- else
- {
- if( WinGetMsg(hAB,&aQueueMsg,0,0,0 ))
- {
- WinDispatchMsg( hAB, &aQueueMsg );
- }
- else
- bLoop = FALSE;
- }
- }
-
- WinStopTimer( hAB, hWndClient, nTimeoutId );
- WinStopTimer( hAB, 0, nDummyTimer );
-
- //
- // Der Speicherblock pOutDDEData muss vom Server geloescht worden sein!
- // Ueberlegen: Nochmal loeschen, falls Server buggy ist, ansonsten
- // platzt uns bald der Adressraum!
- //
- if( !pThis->nSyncResponseMsg )
- {
- // unsere App wurde beendet
- ////WRITELOG("DdeClientTransaction:App terminated")
- return 0;
- }
- pDDEInData = pThis->hSyncResponseData;
- nMsg = pThis->nSyncResponseMsg;
- pThis->hSyncResponseData= 0;
- pThis->nSyncResponseMsg = 0;
- pThis->bInSyncTrans = FALSE;
- pThis->nSyncTransId = 0;
- if( !pDDEInData && nMsg != WM_TIMER )
- {
- DBG_ASSERT(0,"Dde:No data!");
- WRITELOG("DdeClientTransaction: No Data!")
- return (HDDEDATA)0;
- }
- switch( nMsg )
- {
- case WM_TIMER:
- WRITELOG("DdeClientTransaction:Timeout!")
- nLastErrInstance = nTimeoutErr;
- if( bReqOnAdvLoop )
- // auf normalen Loop-Betrieb zurueckschalten
- pTrans->nConvst = XST_WAITING_ADVDATA;
- break;
-
- case WM_DDE_ACK:
- {
- // WRITELOG("DdeClientTransaction:Ack received")
- BOOL bPositive = (BOOL)(pDDEInData->fsStatus & DDE_FACK);
- MyDosFreeMem( pDDEInData,"DdeClientTransaction" );
- pDDEInData = (HDDEDATA)bPositive;
- if( nType == XTYP_ADVSTART && pDDEInData )
- {
-
-#if 0 && defined(OV_DEBUG)
- char aBuf[ 128 ];
- ImpDdeMgr::DdeQueryString( pTrans->hszItem,aBuf,128,850);
- String aXXStr("Hotlink ");
-#endif
-
- if( bPositive )
- {
- pTrans->nType = XTYP_ADVREQ;
- // Hot/Warmlink, Ack
- pTrans->nType |= nTypeFlags;
- // XST_WAITING_ACK ==> XST_WAITING_ADVDATA
- pTrans->nConvst = XST_WAITING_ADVDATA;
-
-#if 0 && defined(OV_DEBUG)
- aXXStr += "established ";
- aXXStr += aBuf;
-#endif
-
- }
-
-#if 0 && defined(OV_DEBUG)
- else
- {
- aXXStr += "failed ";
- aXXStr += aBuf;
- }
- WRITELOG((char*)aXXStr.GetStr());
-#endif
-
- }
- }
- break;
-
- case WM_DDE_DATA:
- // WRITELOG("DdeClientTransaction:Data received")
- // WRITEDATA(pDDEInData)
- if( bReqOnAdvLoop )
- {
- DBG_ASSERT(pTrans->nConvst==XST_WAITING_REQDATA,"DDE:Bad state");
- DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Bad state");
- // auf Loop-Betrieb umschalten
- pTrans->nConvst = XST_WAITING_ADVDATA;
- }
- break;
-
- default:
- WRITELOG("DdeClientTransaction:Unexpected msg")
- MyDosFreeMem( pDDEInData,"DdeClientTransaction" );
- pDDEInData = 0;
- }
- pThis->bSyncAbandonTrans = FALSE;
- pThis->bInSyncTrans = FALSE;
- if( pThis->bSyncAbandonTrans && bReqOnAdvLoop )
- pThis->DdeAbandonTransaction( hConv, nTransId );
- }
- else
- {
- // WRITELOG("DdeClientTransaction:Starting async. trans.")
- pDDEInData = (HDDEDATA)MyWinDdePostMsg( hWndServer, hWndClient, nMsg,
- pOutDDEData, DDEPM_RETRY);
- if( !pDDEInData )
- {
- WRITELOG("DdeClientTransaction:PostMsg failed")
- nLastErrInstance = DMLERR_POSTMSG_FAILED;
- if( !bReqOnAdvLoop )
- FreeTransaction( pData, nTransId );
- else
- {
- DBG_ASSERT(pTrans->nType==XTYP_ADVREQ,"DDE:Error!")
- pTrans->nConvst = 0;
- }
- }
- else
- {
- // WRITELOG("DdeClientTransaction:Async trans. success")
- if( pResult )
- *pResult = nTransId;
- }
- }
-#if 0 && defined( OV_DEBUG )
- if( nType == XTYP_REQUEST )
- {
- WRITELOG("End XTYP_REQUEST");
- WinMessageBox(HWND_DESKTOP,HWND_DESKTOP,
- "End XTYP_REQUEST","DdeClientTransaction",
- HWND_DESKTOP,MB_OK);
- }
-#endif
- //WRITELOG("DdeClientTransaction:End")
- //WRITESTATUS("DdeClientTransaction:End")
- return pDDEInData;
-}
-
-MRESULT ImpDdeMgr::DdeRegister( ImpWndProcParams* pParams )
-{
- MRESULT nRet = (MRESULT)0;
- if ( !(nTransactFilter & CBF_SKIP_REGISTRATIONS) )
- {
- HSZ hSBaseName = (HSZ)pParams->nPar1;
- HSZ hIBaseName = (HSZ)pParams->nPar2;
- nRet=(MRESULT)Callback(XTYP_REGISTER,0,0,hSBaseName,hIBaseName,0,0,0);
- }
- return nRet;
-}
-
-MRESULT ImpDdeMgr::DdeUnregister( ImpWndProcParams* pParams )
-{
- MRESULT nRet = (MRESULT)0;
- if ( !(nTransactFilter & CBF_SKIP_UNREGISTRATIONS) )
- {
- HSZ hSBaseName = (HSZ)pParams->nPar1;
- HSZ hIBaseName = (HSZ)pParams->nPar2;
- nRet=(MRESULT)Callback(XTYP_UNREGISTER,0,0,hSBaseName,hIBaseName,0,0,0);
- }
- return nRet;
-}
-
-MRESULT ImpDdeMgr::DdeTimeout( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeTimeout:Received")
- if( nSyncResponseMsg )
- {
- ////WRITELOG("DdeTimeout:Trans already processed->ignoring timeout")
- return (MRESULT)1;
- }
- ULONG nTimerId = (ULONG)pParams->nPar1;
- ULONG nTransId = TID_USERMAX - nTimerId;
- Transaction* pTrans = pTransTable;
- pTrans += (USHORT)nTransId;
- if( nTransId < 1 || nTransId >= pData->nMaxTransCount ||
- pTrans->hConvOwner == 0 )
- {
- DBG_ASSERT(0,"DdeTimeout:Invalid TransactionId");
- return (MRESULT)1;
- }
- if( bInSyncTrans && nTransId == nSyncTransId )
- {
- USHORT nTempType = pTrans->nType;
- nTempType &= (~XTYPF_MASK);
- // advise-loops koennen nur innerhalb synchroner
- // requests timeouts bekommen. die transaktion wird
- // in diesem fall nicht geloescht.
- if( nTempType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK) ))
- {
- ////WRITELOG("DdeTimeout:Freeing transaction")
- FreeTransaction( pData, nTransId );
- }
- nSyncResponseMsg = WM_TIMER;
-#if 0 && defined( OV_DEBUG )
- String aMsg("DdeTimeout:Transaction=");
- aMsg += nTransId;
- WRITELOG((char*)(const char*)aMsg)
-#endif
- }
- else
- {
- ////WRITELOG("DdeTimeout:Async transaction timed out")
- pTrans->nConvst = XST_TIMEOUT;
- }
- return (MRESULT)1;
-}
-
-
-
-MRESULT ImpDdeMgr::DdeTerminate( ImpWndProcParams* pParams )
-{
- WRITELOG("DdeTerminate:Received")
- HWND hWndThis = pParams->hWndReceiver;
- HWND hWndPartner = (HWND)(pParams->nPar1);
-
- HCONV hConv = GetConvHandle( pData, hWndThis, hWndPartner );
-#if 0 && defined( OV_DEBUG )
- String strDebug("DdeTerminate:ConvHandle=");
- strDebug += (USHORT)hConv;
- WRITELOG((char*)(const char*)strDebug)
-#endif
- ImpHCONV* pConv = pConvTable + (USHORT)hConv;
- if( hConv )
- {
- // warten wir auf ein DDE_TERMINATE Acknowledge ?
- if( pConv->nStatus & ST_TERMINATED )
- {
- ////WRITELOG("DdeTerminate:TERMINATE-Ack received")
- pConv->nStatus |= ST_TERMACKREC;
- return (MRESULT)0; // DdeDisconnect raeumt jetzt auf
- }
-
- // sind wir Server?, wenn ja: die App benachrichtigen,
- // dass die Advise loops gestoppt wurden und die
- // Transaktionen loeschen
-
- // OV 26.07.96: Die das TERMINATE empfangende App muss
- // die Transaction-Tabelle abraeumen, egal ob Server oder Client!!
- // Es muessen alle Trans geloescht werden, die als Owner den
- // Client oder den Server haben!
- // if( !(pConv->nStatus & ST_CLIENT ) )
- SendUnadvises( hConv, 0, FALSE ); // alle Formate & nicht loeschen
- SendUnadvises( pConv->hConvPartner, 0, FALSE );
-
- // wir werden von draussen gekillt
- if ( !(nTransactFilter & CBF_SKIP_DISCONNECTS) )
- {
- Callback( XTYP_DISCONNECT, 0, hConv, 0, 0, 0,
- 0, (ULONG)IsSameInstance(hWndPartner));
- }
-
- // kann unsere Partner-App DDEML ?
- if( !(pConv->hConvPartner) )
- {
- // nein, deshalb Transaktionstabelle selbst loeschen
- ////WRITELOG("DdeTerminate:Freeing transactions")
- FreeTransactions( pData, hConv );
- }
- }
- else
- nLastErrInstance = DMLERR_NO_CONV_ESTABLISHED;
-
-#if 0 && defined(OV_DEBUG)
- if( !WinIsWindow(0,hWndPartner))
- {
- WRITELOG("DdeTerminate:hWndPartner not valid")
- }
- if(!WinIsWindow(0,hWndThis))
- {
- WRITELOG("DdeTerminate:hWndThis not valid")
- }
-#endif
-
- if( hConv )
- {
- // hWndThis nicht loeschen, da wir den Handle noch fuer
- // das Acknowledge brauchen
- ////WRITELOG("DdeTerminate:Freeing conversation")
- FreeConvHandle( pData, hConv, FALSE );
- }
-
- ////WRITELOG("DdeTerminate:Acknowledging DDE_TERMINATE")
-
-#ifdef OV_DEBUG
- DBG_ASSERT(WinIsWindow( 0, hWndThis ),"hWndThis not valid");
-#endif
-
- if( !WinDdePostMsg( hWndPartner, hWndThis, WM_DDE_TERMINATE, 0, DDEPM_RETRY ))
- {
- ////WRITELOG("DdeTerminate:Acknowledging DDE_TERMINATE failed")
- }
- // jetzt hWndThis loeschen
- DestroyConversationWnd( hWndThis );
-
- return (MRESULT)0;
-}
-
-
-/*
- Zuordnung des Conversationhandles:
-
- Verbindungsaufbau:
- Client: DdeInitiate( HWNDClient )
- Server: Post( WM_DDE_INITIATEACK( HWNDServer ))
- Client: CreateConvHandle( HWNDClient, HWNDServer )
-
- Datenaustausch:
- Server: Post(WM_DDE_ACK( HWNDSender ))
- Client: GetConvHandle( HWNDClient, HWNDSender )
-*/
-
-MRESULT ImpDdeMgr::ConvWndProc( HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2 )
-{
- ImpWndProcParams aParams;
-
- MRESULT nRet = (MRESULT)0;
- aParams.hWndReceiver= hWnd;
- aParams.nPar1 = nPar1;
- aParams.nPar2 = nPar2;
-
- switch( nMsg )
- {
-
-#ifdef DBG_UTIL
- case WM_DDE_INITIATE :
- DBG_ASSERT(0,"dde:unexpected msg");
- nRet = (MRESULT)TRUE;
- break;
-#endif
-
- case WM_DDE_INITIATEACK : nRet = DdeInitiateAck(&aParams); break;
- case WM_DDE_ACK : nRet = DdeAck( &aParams ); break;
- case WM_DDE_ADVISE : nRet = DdeAdvise( &aParams ); break;
- case WM_DDE_DATA : nRet = DdeData( &aParams ); break;
- case WM_DDE_EXECUTE : nRet = DdeExecute( &aParams ); break;
- case WM_DDE_POKE : nRet = DdePoke( &aParams ); break;
- case WM_DDE_REQUEST : nRet = DdeRequest( &aParams ); break;
- case WM_DDE_TERMINATE : nRet = DdeTerminate( &aParams ); break;
- case WM_DDE_UNADVISE : nRet = DdeUnadvise( &aParams ); break;
- case WM_TIMER : nRet = DdeTimeout( &aParams ); break;
- }
- return nRet;
-}
-
-MRESULT ImpDdeMgr::SrvWndProc( HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2 )
-{
- MRESULT nRet = (MRESULT)0;
-
- ImpWndProcParams aParams;
- aParams.hWndReceiver= hWnd;
- aParams.nPar1 = nPar1;
- aParams.nPar2 = nPar2;
-
- switch( nMsg )
- {
-#ifdef DBG_UTIL
- case WM_DDE_ACK :
- case WM_DDE_ADVISE :
- case WM_DDE_EXECUTE :
- case WM_DDE_POKE :
- case WM_DDE_REQUEST :
- case WM_DDE_UNADVISE :
- case WM_DDE_DATA :
- case WM_DDE_INITIATEACK :
- DBG_ASSERT(0,"dde:unexpected msg");
- nRet = (MRESULT)TRUE;
- break;
-#endif
-
- case WM_DDE_TERMINATE :
- break; // DDE_INITIATE wurde im DDE_INITIATEACK terminiert
-
- // ein Client will was von uns
- case WM_DDE_INITIATE :
- nRet = DdeInitiate( &aParams );
- break;
-
- // eine ddeml-faehige App. hat einen Service (typ. AppName) [de]reg.
- case WM_DDEML_REGISTER :
- nRet = DdeRegister( &aParams );
- break;
-
- case WM_DDEML_UNREGISTER :
- nRet = DdeUnregister( &aParams );
- break;
- };
- return nRet;
-}
-
-
-MRESULT ImpDdeMgr::DdeAck( ImpWndProcParams* pParams )
-{
- //WRITELOG("DdeAck:Start")
- HSZ hszItem;
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- if( pInDDEData )
- {
- BOOL bPositive = (BOOL)(pInDDEData->fsStatus & DDE_FACK ) != 0;
- BOOL bBusy = bPositive ? FALSE : (BOOL)(pInDDEData->fsStatus & DDE_FBUSY ) != 0;
- BOOL bNotProcessed = (BOOL)(pInDDEData->fsStatus & DDE_NOTPROCESSED ) != 0;
-#if 0 && defined( OV_DEBUG )
- String aDebStr("DdeAck:Received ");
- if( bPositive )
- aDebStr += "(positive)";
- else
- aDebStr += "(negative)";
- if( bBusy )
- aDebStr += "(busy)";
- if( bNotProcessed )
- aDebStr += "(not processed)";
- WRITELOG((char*)(const char*)aDebStr)
-#endif
- // ein DDE_ACK niemals bestaetigen (um endlosschleifen zu vermeiden)
- pInDDEData->fsStatus &= (~DDE_FACKREQ);
- }
- else
- {
- //WRITELOG("DdeAck:Received (no data!)")
- return (MRESULT)0;
- }
-
- HCONV hConv = CheckIncoming(pParams, 0, hszItem);
-#ifdef OV_DEBUG
- if( !hConv )
- {
- WRITELOG("DdeAck:HCONV not found")
- }
-#endif
- ULONG nTransId=GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat);
- if( !nTransId )
- {
- WRITELOG("DdeAck:Transaction not found")
- MyDosFreeMem( pInDDEData,"DdeAck" );
- return (MRESULT)0;
- }
-
- BOOL bThisIsSync = (BOOL)( bInSyncTrans && nTransId == nSyncTransId );
-#if 0 && defined( OV_DEBUG )
- if( bThisIsSync)
- WRITELOG("DdeAck: sync transaction")
- else
- WRITELOG("DdeAck: async transaction")
-#endif
- // pruefen, ob die Transaktion abgeschlossen ist.
- Transaction* pTrans = pTransTable;
- pTrans += (USHORT)nTransId;
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
-
- if( pTrans->nConvst == XST_UNADVSENT )
- {
- //WRITELOG("DdeAck:Unadvise-Ack received")
- pTrans->nConvst = XST_UNADVACKRCVD;
- MyDosFreeMem( pInDDEData,"DdeAck" );
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
- }
- if( pTrans->nConvst == XST_ADVDATASENT )
- {
- //WRITELOG("DdeAck:AdvData-Ack received")
- pTrans->nConvst = XST_ADVDATAACKRCVD;
- MyDosFreeMem( pInDDEData,"DdeAck" );
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
- }
-
- USHORT nType = pTrans->nType;
- nType &= (~XTYPF_MASK);
- // beginn einer advise-loop oder request auf advise-loop ?
- // wenn ja: transaktion nicht loeschen
- BOOL bFinished = (BOOL)(nType != XTYP_ADVSTART &&
- nType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK)) );
- if( bFinished )
- {
- if( !bThisIsSync )
- {
- ////WRITELOG("DdeAck:Transaction completed")
- Callback( XTYP_XACT_COMPLETE, pInDDEData->usFormat, hConv,
- pConv->hszTopic, hszItem, (HDDEDATA)0, nTransId, 0 );
- }
- ////WRITELOG("DdeAck:Freeing transaction")
- FreeTransaction( pData, nTransId );
- }
-
- if( bThisIsSync )
- {
- hSyncResponseData = pInDDEData;
- nSyncResponseMsg = WM_DDE_ACK;
- }
- else
- {
- MyDosFreeMem( pInDDEData,"DdeAck" );
- }
-
- DdeFreeStringHandle( hszItem );
-
- return (MRESULT)0;
-}
-
-
-USHORT ImpDdeMgr::SendUnadvises(HCONV hConvServer,USHORT nFormat,BOOL bFree)
-{
- USHORT nTransFound = 0;
- BOOL bCallApp = (BOOL)(!(nTransactFilter & CBF_FAIL_ADVISES));
-#if 0 && defined( OV_DEBUG )
- String aStr("Unadvising transactions for HCONV=");
- aStr += (ULONG)hConvServer;
- aStr += " CallApp:"; aStr += (USHORT)bCallApp;
- WRITELOG((char*)aStr.GetStr())
-#endif
-
-
- // wenn wir weder loeschen noch die App benachrichtigen sollen,
- // koennen wir gleich wieder returnen
- if( !hConvServer || ( !bFree && !bCallApp ) )
- return 0;
-
- ImpHCONV* pConvSrv = pConvTable;
- pConvSrv += (USHORT)hConvServer;
- HSZ hszTopic = pConvSrv->hszTopic;
-
- Transaction* pTrans = pTransTable;
- pTrans++;
- USHORT nCurTransId = 1;
- USHORT nCurTransactions = pData->nCurTransCount;
- while( nCurTransactions && nCurTransId < pData->nMaxTransCount )
- {
- if( pTrans->hConvOwner )
- nCurTransactions--;
- if( pTrans->hConvOwner == hConvServer &&
- (pTrans->nType & XTYP_ADVREQ) )
- {
- if( !nFormat || (nFormat == pTrans->nFormat) )
- {
- nTransFound++;
- if( bCallApp )
- {
- //WRITELOG("SendUnadvises:Notifying App")
- Callback( XTYP_ADVSTOP, pTrans->nFormat, hConvServer,
- hszTopic, pTrans->hszItem, 0,0,0 );
- }
- if( bFree )
- FreeTransaction( pData, (ULONG)nCurTransId );
- }
- }
- nCurTransId++;
- pTrans++;
- }
- return nTransFound;
-}
-
-
-
-HCONV ImpDdeMgr::CheckIncoming( ImpWndProcParams* pParams, ULONG nTransMask,
- HSZ& rhszItem )
-{
-// ////WRITELOG("CheckIncoming")
- rhszItem = 0;
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- if( !pInDDEData )
- {
- // ////WRITELOG("CheckIncoming:PDDESTRUCT==0")
- return (HCONV)0;
- }
-
- HWND hWndThis = pParams->hWndReceiver;
- HWND hWndClient = (HWND)pParams->nPar1;
-
- BOOL bReject = (BOOL)(nTransactFilter & nTransMask);
- HCONV hConv;
- if( !bReject )
- hConv = GetConvHandle( pData, hWndThis, hWndClient );
- if ( bReject || !hConv )
- return (HCONV)0;
-
- rhszItem = DdeCreateStringHandle(
- ((char*)(pInDDEData)+pInDDEData->offszItemName), 850 );
-
- // ////WRITELOG("CheckIncoming:OK");
- return hConv;
-}
-
-
-MRESULT ImpDdeMgr::DdeAdvise( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeAdvise:Received")
- HSZ hszItem;
- HCONV hConv = CheckIncoming(pParams, CBF_FAIL_ADVISES, hszItem);
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- HWND hWndThis = pParams->hWndReceiver;
- HWND hWndClient = (HWND)pParams->nPar1;
- if( !hConv )
- {
- ////WRITELOG("DdeAdvise:Conversation not found")
- pInDDEData->fsStatus &= (~DDE_FACK);
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
- }
-
- Transaction* pTrans = pTransTable;
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
-
- // existiert schon ein Link auf Topic/Item/Format-Vektor ?
-
- ULONG nTransId=GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat);
- if( nTransId )
- {
- ////WRITELOG("DdeAdvise:Transaction already exists")
- pTrans += (USHORT)nTransId;
- // ist es eine AdviseLoop ?
- USHORT nTempType = pTrans->nType;
- nTempType &= (~XTYPF_MASK);
- if( nTempType == XTYP_ADVREQ )
- {
- // Flags der laufenden Advise-Loop aktualisieren
- ////WRITELOG("DdeAdvise:Adjusting Advise-Params")
- pTrans->nType = XTYP_ADVREQ;
- if( pInDDEData->fsStatus & DDE_FNODATA )
- pTrans->nType |= XTYPF_NODATA;
- if( pInDDEData->fsStatus & DDE_FACKREQ )
- pTrans->nType |= XTYPF_ACKREQ;
- pInDDEData->fsStatus |= DDE_FACK;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
- }
- else if( nTempType != XTYP_ADVSTART )
- {
- ////WRITELOG("DdeAdvise:Not a advise transaction")
- pInDDEData->fsStatus &= (~DDE_FACK);
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
- }
- }
-
- if( !nTransId )
- {
- ////WRITELOG("DdeAdvise:Creating Transaction")
- ////WRITESTATUS("DdeAdvise:Creating Transaction")
- nTransId = CreateTransaction( pData, hConv, hszItem,
- pInDDEData->usFormat, XTYP_ADVREQ );
- ////WRITESTATUS("DdeAdvise:Created Transaction")
- }
- if( nTransId )
- {
- pTrans = pTransTable;
- pTrans += (USHORT)nTransId;
- if( pInDDEData->fsStatus & DDE_FNODATA )
- pTrans->nType |= XTYPF_NODATA;
- if( pInDDEData->fsStatus & DDE_FACKREQ )
- pTrans->nType |= XTYPF_ACKREQ;
- }
- else
- {
- ////WRITELOG("DdeAdvise:Cannot create Transaction")
- pInDDEData->fsStatus &= (~DDE_FACK);
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
- }
-
- ////WRITELOG("DdeAdvise:Calling Server")
-
- if ( Callback( XTYP_ADVSTART, pInDDEData->usFormat,
- hConv, pConv->hszTopic, hszItem, (HDDEDATA)0, 0, 0 ) )
- {
- //
- // ServerApp erlaubt AdviseLoop
- //
- ////WRITELOG("DdeAdvise:Advise loop established")
- pInDDEData->fsStatus |= DDE_FACK;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
- else
- {
- ////WRITELOG("DdeAdvise:Advise loop not established")
- FreeTransaction( pData, nTransId );
- pInDDEData->fsStatus &= (~DDE_FACK); // DDE_FNOTPROCESSED;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
- ////WRITESTATUS("DdeAdvise:End")
- ////WRITELOG("DdeAdvise:End")
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
-}
-
-MRESULT ImpDdeMgr::DdeData( ImpWndProcParams* pParams )
-{
- WRITELOG("DdeData:Received")
- HSZ hszItem;
- HCONV hConv = CheckIncoming(pParams, 0, hszItem);
- HWND hWndThis = pParams->hWndReceiver;
- HWND hWndClient = (HWND)pParams->nPar1;
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
-#if 0 && defined( OV_DEBUG )
- {
- String aStr("DdeData Address:");
- aStr += (ULONG)pInDDEData;
- WRITELOG((char*)aStr.GetStr())
- }
-#endif
-
- BOOL bSendAck;
- if( pInDDEData && (pInDDEData->fsStatus & DDE_FACKREQ ))
- {
- WRITELOG("DdeData: Ackn requested")
- bSendAck = TRUE;
- }
- else
- {
- WRITELOG("DdeData: Ackn not requested")
- bSendAck = FALSE;
- }
-
- ULONG nTransId = GetTransaction(pData,hConv,hszItem,pInDDEData->usFormat);
- if( !nTransId )
- {
- WRITELOG("DdeData:Transaction not found")
- WRITEDATA(pInDDEData)
- if( bSendAck )
- {
- WRITELOG("DdeData: Posting Ackn")
- pInDDEData->fsStatus &= (~DDE_FACK); // NOTPROCESSED;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
- else
- {
- MyDosFreeMem( pInDDEData,"DdeData" );
- }
- return (MRESULT)0;
- }
-
-#if 0 && defined( OV_DEBUG )
- if( pInDDEData )
- {
- WRITEDATA(pInDDEData)
- }
-#endif
-
- BOOL bThisIsSync = (BOOL)( bInSyncTrans && nTransId == nSyncTransId );
-
- // pruefen, ob die Transaktion abgeschlossen ist.
- Transaction* pTrans = pTransTable;
- pTrans += (USHORT)nTransId;
-
- if( pTrans->nConvst == XST_WAITING_ACK )
- {
- // dieser Fall kann eintreten, wenn ein Server innerhalb
- // einer WM_DDE_ADVISE-Msg. oder bevor beim Client das
- // Ack eintrifft, Advise-Daten sendet.
- WRITELOG("DdeData:Ignoring unexpected data")
- if( bSendAck )
- {
- WRITELOG("DdeData: Posting Ackn")
- pInDDEData->fsStatus &= (~DDE_FACK); // NOTPROCESSED;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
- else
- {
- MyDosFreeMem( pInDDEData,"DdeData" );
- }
- return (MRESULT)0;
- }
-
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
-
- USHORT nType = pTrans->nType;
- nType &= (~XTYPF_MASK);
- BOOL bNotAdviseLoop = (BOOL)(nType != (XTYP_ADVREQ & (~XTYPF_NOBLOCK)));
- if( !bThisIsSync )
- {
- // WRITELOG("DdeData:Is async transaction")
- if( bNotAdviseLoop )
- {
- // WRITELOG("DdeData:Transaction completed -> calling client")
- Callback( XTYP_XACT_COMPLETE, pInDDEData->usFormat, hConv,
- pConv->hszTopic, hszItem, pInDDEData, nTransId, 0 );
- // WRITELOG("DdeData:Freeing transaction")
- FreeTransaction( pData, nTransId );
- }
- else
- {
- WRITELOG("DdeData:Advise-Loop -> calling client")
- HDDEDATA pToSend = pInDDEData;
- if( pTrans->nType & XTYPF_NODATA )
- {
- pToSend = 0;
- // WRITELOG("DdeData:Is warm link")
- }
- Callback( XTYP_ADVDATA, pInDDEData->usFormat, hConv,
- pConv->hszTopic, hszItem, pToSend, nTransId, 0 );
- }
- if( bSendAck )
- {
- WRITELOG("DdeData: Posting Ackn")
- pInDDEData->fsStatus = DDE_FACK;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
- else
- MyDosFreeMem( pInDDEData,"DdeData" );
- }
- else // synchrone Transaktion (Datenhandle nicht freigeben!)
- {
- // WRITELOG("DdeData:Is sync transaction")
- hSyncResponseData = pInDDEData;
- nSyncResponseMsg = WM_DDE_DATA;
- if( bSendAck )
- {
- pInDDEData->fsStatus |= DDE_FACK;
- WRITELOG("DdeData: Posting Ackn")
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,
- DDEPM_RETRY | DDEPM_NOFREE );
- }
- }
-
- DdeFreeStringHandle( hszItem );
- // WRITELOG("DdeData:End")
- return (MRESULT)0;
-}
-
-MRESULT ImpDdeMgr::DdeExecute( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeExecute:Received")
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- HSZ hszItem;
- HCONV hConv = CheckIncoming(pParams, 0, hszItem);
- BOOL bSuccess = FALSE;
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
- if ( hConv && !(nTransactFilter & CBF_FAIL_EXECUTES) && pInDDEData )
- {
- if ( Callback( XTYP_EXECUTE, pInDDEData->usFormat, hConv,
- pConv->hszTopic, hszItem, pInDDEData, 0, 0 )
- == (DDESTRUCT*)DDE_FACK )
- bSuccess = TRUE;
- }
- else
- {
- ////WRITELOG("DdeExecute:Not processed")
- }
- if( pInDDEData )
- {
- if( bSuccess )
- pInDDEData->fsStatus |= DDE_FACK;
- else
- pInDDEData->fsStatus &= (~DDE_FACK);
- MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, WM_DDE_ACK,
- pInDDEData, DDEPM_RETRY );
- }
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
-}
-
-HCONV ImpDdeMgr::ConnectWithClient( HWND hWndClient,
- HSZ hszPartner, HSZ hszService, HSZ hszTopic, BOOL bSameInst,
- DDEINIT* pDDEData, CONVCONTEXT* pCC )
-{
- ////WRITELOG("ConnectWithClient:Start")
- HWND hWndSrv = CreateConversationWnd();
- IncConversationWndRefCount( hWndSrv );
- HCONV hConv = CreateConvHandle( pData, pidThis, hWndSrv, hWndClient,
- hszPartner, hszService, hszTopic );
- if(!hConv )
- return 0;
- BOOL bFreeDdeData = FALSE;
- if( !pDDEData )
- {
- bFreeDdeData = TRUE;
- pDDEData = CreateDDEInitData( hWndClient,hszService,hszTopic, pCC );
- PID pid; TID tid;
- WinQueryWindowProcess( hWndClient, &pid, &tid );
- DosGiveSharedMem( pDDEData, pid, PAG_READ | PAG_WRITE);
- }
- HAB hAB = WinQueryAnchorBlock( hWndSrv );
- WinGetLastError( hAB ); // fehlercode zuruecksetzen
- WinSendMsg(hWndClient,WM_DDE_INITIATEACK,(MPARAM)hWndSrv,(MPARAM)pDDEData);
- if( WinGetLastError( hAB ) )
- {
- // ////WRITELOG("DdeConnectWithClient:Client died")
- if( bFreeDdeData )
- {
- MyDosFreeMem( pDDEData,"ConnectWithClient" );
- }
- FreeConvHandle( pData, hConv );
- return (HCONV)0;
- }
-
- if( !(nTransactFilter & CBF_SKIP_CONNECT_CONFIRMS) )
- {
- Callback( XTYP_CONNECT_CONFIRM, 0, hConv, hszTopic, hszService,
- 0, 0, (ULONG)bSameInst );
- }
-
- if( bFreeDdeData )
- {
- MyDosFreeMem( pDDEData,"ConnectWithClient" );
- }
- // HCONV der PartnerApp suchen & bei uns eintragen
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
- pConv->hConvPartner = GetConvHandle( pData, hWndClient, hWndSrv );
-#if 0 && defined(OV_DEBUG)
- if( !pConv->hConvPartner )
- {
- WRITELOG("DdeConnectWithClient:Partner not found")
- }
-#endif
- pConv->nStatus = ST_CONNECTED;
- //WRITESTATUS("Server:Connected with client")
- //WRITELOG("ConnectWithClient:End")
- return hConv;
-}
-
-MRESULT ImpDdeMgr::DdeInitiate( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeInitiate:Received")
- HWND hWndClient = (HWND)(pParams->nPar1);
-// BOOL bSameInst = IsSameInstance( hWndClient );
- BOOL bSameInst = (BOOL)(hWndClient==hWndServer);
- DDEINIT* pDDEData = (DDEINIT*)pParams->nPar2;
-
- if ( ( nTransactFilter & (CBF_FAIL_CONNECTIONS | APPCMD_CLIENTONLY)) ||
- (( nTransactFilter & CBF_FAIL_SELFCONNECTIONS) && bSameInst )
- )
- {
- MyDosFreeMem( pDDEData,"DdeInitiate" );
- return (MRESULT)FALSE; // narda
- }
-
- HSZ hszService = (HSZ)0;
- if( *(pDDEData->pszAppName) != '\0' )
- {
- hszService = DdeCreateStringHandle( pDDEData->pszAppName, 850 );
- ////WRITELOG(pDDEData->pszAppName);
- }
- HSZ hszTopic = (HSZ)0;
- if( *(pDDEData->pszTopic) != '\0' )
- {
- hszTopic = DdeCreateStringHandle( pDDEData->pszTopic, 850 );
- ////WRITELOG(pDDEData->pszTopic);
- }
- HSZ hszPartner = GetAppName( hWndClient );
-
- // nur weitermachen, wenn Service registriert oder
- // Service-Name-Filtering ausgeschaltet.
- if( !bServFilterOn || GetService(hszService) )
- {
- // XTYP_CONNECT-Transaktionen erfolgen nur mit
- // Services & Topics ungleich 0!
- if( hszService && hszTopic )
- {
- if( IsConvHandleAvailable(pData) && Callback( XTYP_CONNECT,
- 0, 0, hszTopic,hszService, 0, 0, (ULONG)bSameInst))
- {
- // App erlaubt Verbindung mit Client
- ConnectWithClient( hWndClient, hszPartner,
- hszService, hszTopic, bSameInst, pDDEData );
- }
- }
- else
- {
- // ** Wildcard-Connect **
- ////WRITELOG("DdeInitiate:Wildconnect")
- // vom Server eine Liste aller Service/Topic-Paare anfordern
- CONVCONTEXT* pCC=(CONVCONTEXT*)(pDDEData+pDDEData->offConvContext);
- DDESTRUCT* hList = Callback( XTYP_WILDCONNECT, 0, (HCONV)0,
- hszTopic,hszService, (HDDEDATA)0, (ULONG)pCC, (ULONG)bSameInst );
- if( hList )
- {
- HSZPAIR* pPairs = (HSZPAIR*)((char*)hList+hList->offabData);
- while( pPairs->hszSvc )
- {
- ////WRITELOG("DdeInitiate:Wildconnect.Connecting")
- ConnectWithClient( hWndClient, hszPartner,
- pPairs->hszSvc, pPairs->hszTopic, bSameInst, 0, pCC);
- // Stringhandles gehoeren der App! (nicht free-en)
- pPairs++;
- }
- DdeFreeDataHandle( hList );
- }
- }
- }
-#if 0 && defined(OV_DEBUG)
- else
- {
- WRITELOG("DdeInitiate:Service filtered")
- }
-#endif
- DdeFreeStringHandle( hszTopic );
- DdeFreeStringHandle( hszService );
- DdeFreeStringHandle( hszPartner );
- MyDosFreeMem( pDDEData,"DdeInitiate" );
- ////WRITELOG("DdeInitiate:End")
- return (MRESULT)TRUE;
-}
-
-MRESULT ImpDdeMgr::DdeInitiateAck( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeInitiateAck:Received")
- DDEINIT* pDDEData = (DDEINIT*)(pParams->nPar2);
-
- if( !bListConnect && hCurConv )
- {
- ////WRITELOG("DdeInitiateAck:Already connected")
- MyDosFreeMem( pDDEData,"DdeInitiateAck" );
- WinPostMsg( hWndServer, WM_DDE_TERMINATE, (MPARAM)hWndServer, 0 );
- return (MRESULT)FALSE;
- }
-
- HWND hWndThis = pParams->hWndReceiver;
- // Referenz-Count unseres Client-Windows inkrementieren
- IncConversationWndRefCount( hWndThis );
-
- HWND hWndSrv = (HWND)(pParams->nPar1);
- HSZ hszService = DdeCreateStringHandle( pDDEData->pszAppName, 850 );
- HSZ hszTopic = DdeCreateStringHandle( pDDEData->pszTopic, 850 );
- HSZ hszPartnerApp = GetAppName( hWndSrv );
-
- hCurConv = CreateConvHandle( pData, pidThis, hWndThis, hWndSrv,
- hszPartnerApp, hszService, hszTopic, 0 );
-
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hCurConv;
-
- // HCONV der PartnerApp suchen & bei uns eintragen
- pConv->hConvPartner = GetConvHandle( pData, hWndSrv, hWndThis );
- // nicht asserten, da ja non-ddeml-Partner moeglich
- // DBG_ASSERT(pConv->hConvPartner,"DDE:Partner not found");
- pConv->nStatus = ST_CONNECTED | ST_CLIENT;
-
- if( bListConnect )
- {
- ////WRITELOG("DdeInitiateAck:ListConnect/Connecting hConvs")
- // Status setzen & verketten
- pConv->hConvList = hCurListId;
- pConv->nPrevHCONV = nPrevConv;
- pConv->nStatus |= ST_INLIST;
- if( nPrevConv )
- {
- pConv = pConvTable;
- pConv += nPrevConv;
- pConv->nNextHCONV = (USHORT)hCurConv;
- }
- nPrevConv = (USHORT)hCurConv;
- }
-
- DdeFreeStringHandle( hszService );
- DdeFreeStringHandle( hszTopic );
- DdeFreeStringHandle( hszPartnerApp );
- MyDosFreeMem( pDDEData,"DdeInitiateAck" );
- ////WRITESTATUS("After DdeInitiateAck")
- ////WRITELOG("DdeInitiateAck:End")
- return (MRESULT)TRUE;
-}
-
-MRESULT ImpDdeMgr::DdePoke( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdePoke:Received")
- HSZ hszItem = 0;
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- HCONV hConv = CheckIncoming( pParams, CBF_FAIL_REQUESTS, hszItem );
- BOOL bSuccess =FALSE;
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
- if ( hConv && !(nTransactFilter & CBF_FAIL_POKES) && pInDDEData )
- {
- if( Callback( XTYP_POKE, pInDDEData->usFormat, hConv,
- pConv->hszTopic, hszItem, pInDDEData, 0, 0 )
- == (DDESTRUCT*)DDE_FACK )
- bSuccess = TRUE;
- }
-#if 0 && defined( OV_DEBUG )
- else
- {
- WRITELOG("DdePoke:Not processed")
- }
-#endif
- if( pInDDEData )
- {
- if( bSuccess )
- pInDDEData->fsStatus |= DDE_FACK;
- else
- pInDDEData->fsStatus &= (~DDE_FACK);
-
- MyWinDdePostMsg( pConv->hWndPartner, pConv->hWndThis, WM_DDE_ACK,
- pInDDEData, DDEPM_RETRY );
- }
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
-}
-
-MRESULT ImpDdeMgr::DdeRequest( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeRequest:Received")
- HSZ hszItem = 0;
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- if( pInDDEData )
- // ist fuer Requests nicht definiert
- pInDDEData->fsStatus = 0;
- HCONV hConv = CheckIncoming( pParams, CBF_FAIL_REQUESTS, hszItem );
- HWND hWndThis = pParams->hWndReceiver;
- HWND hWndClient = (HWND)pParams->nPar1;
- if( hConv )
- {
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
-
- DDESTRUCT* pOutDDEData = Callback( XTYP_REQUEST, pInDDEData->usFormat,
- hConv, pConv->hszTopic, hszItem, (HDDEDATA)0, 0, 0 );
-
- if ( !pOutDDEData )
- {
- ////WRITELOG("DdeRequest:Not processed")
- pInDDEData->fsStatus &= (~DDE_FACK);
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
- else
- {
- ////WRITELOG("DdeRequest:Success")
- MyDosFreeMem( pInDDEData,"DdeRequest" );
- pOutDDEData->fsStatus |= DDE_FRESPONSE;
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_DATA,pOutDDEData,DDEPM_RETRY);
- }
- }
- else
- {
- pInDDEData->fsStatus &= (~DDE_FACK);
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- }
-
- DdeFreeStringHandle( hszItem );
- ////WRITELOG("DdeRequest:End")
- return (MRESULT)0;
-}
-
-
-MRESULT ImpDdeMgr::DdeUnadvise( ImpWndProcParams* pParams )
-{
- ////WRITELOG("DdeUnadvise:Received")
-
- HSZ hszItem;
- HCONV hConv = CheckIncoming( pParams, 0, hszItem );
- DDESTRUCT* pInDDEData = (DDESTRUCT*)(pParams->nPar2);
- HWND hWndThis = pParams->hWndReceiver;
- HWND hWndClient = (HWND)pParams->nPar1;
- USHORT nClosedTransactions = 0;
- if( hConv )
- {
- USHORT nFormat = pInDDEData->usFormat;
- // alle Transaktionen des HCONVs loeschen ?
- if( !hszItem )
- {
- // App benachrichtigen & Transaktionen loeschen
- nClosedTransactions = SendUnadvises( hConv, nFormat, TRUE );
- }
- else
- {
- ULONG nTransId = GetTransaction(pData, hConv, hszItem, nFormat);
- if( nTransId )
- {
- ////WRITELOG("DdeUnadvise:Transaction found")
- Transaction* pTrans = pTransTable;
- pTrans += (USHORT)nTransId;
- ImpHCONV* pConv = pConvTable;
- pConv += (USHORT)hConv;
- nClosedTransactions = 1;
- if( !(nTransactFilter & CBF_FAIL_ADVISES) )
- Callback( XTYP_ADVSTOP, nFormat, hConv,
- pConv->hszTopic, hszItem, 0, 0, 0 );
- if( !pConv->hConvPartner )
- FreeTransaction( pData, nTransId );
- }
-#if defined(OV_DEBUG)
- else
- {
- WRITELOG("DdeUnadvise:Transaction not found")
- }
-#endif
- }
- }
-#if defined(OV_DEBUG)
- else
- {
- WRITELOG("DdeUnadvise:Conversation not found")
- }
-#endif
-
- if( !nClosedTransactions )
- pInDDEData->fsStatus &= (~DDE_FACK);
- else
- pInDDEData->fsStatus |= DDE_FACK;
-
- MyWinDdePostMsg(hWndClient,hWndThis,WM_DDE_ACK,pInDDEData,DDEPM_RETRY);
- DdeFreeStringHandle( hszItem );
- return (MRESULT)0;
-}
-
-BOOL ImpDdeMgr::WaitTransState( Transaction* pTrans, ULONG nTransId,
- USHORT nNewState, ULONG nTimeout )
-{
- ////WRITELOG("WaitTransState:Start")
- ImpHCONV* pConv = pConvTable;
- pConv += pTrans->hConvOwner;
- HAB hAB = WinQueryAnchorBlock( pConv->hWndThis );
- ULONG nTimerId = WinStartTimer( hAB, 0, 0, 50 );
- QMSG aQueueMsg;
-
-// while( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 ) &&
-// WinIsWindow( hAB, pConv->hWndPartner) &&
-// pTrans->nConvst != nNewState )
-// {
-// WinDispatchMsg( hAB, &aQueueMsg );
-// }
-
- BOOL bContinue = TRUE;
- while( bContinue )
- {
- if( WinGetMsg( hAB, &aQueueMsg, 0, 0, 0 ))
- {
- WinDispatchMsg( hAB, &aQueueMsg );
- if( (!WinIsWindow( hAB, pConv->hWndPartner)) ||
- (pTrans->nConvst == nNewState) )
- {
- bContinue = FALSE;
- }
- }
- else
- bContinue = FALSE;
- }
-
- WinStopTimer( hAB, 0, nTimerId );
- ////WRITELOG("WaitTransState:End")
- return TRUE;
-}
-
-
-
-
diff --git a/svtools/source/svdde/ddeml2.cxx b/svtools/source/svdde/ddeml2.cxx
deleted file mode 100644
index 979897136a46..000000000000
--- a/svtools/source/svdde/ddeml2.cxx
+++ /dev/null
@@ -1,1014 +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: ddeml2.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_svtools.hxx"
-
-#define INCL_DOS
-#include <stdlib.h>
-
-#include "ddemlimp.hxx"
-#define LOGFILE
-#define STATUSFILE
-#define DDEDATAFILE
-#include "ddemldeb.hxx"
-
-#if defined (OS2) && defined (__BORLANDC__)
-#pragma option -w-par
-#endif
-
-
-// ************************************************************************
-// Hilfsfunktionen Speicherverwaltung
-// ************************************************************************
-
-//
-// AllocAtomName
-//
-
-PSZ ImpDdeMgr::AllocAtomName( ATOM hString, ULONG& rBufLen )
-{
- HATOMTBL hAtomTable = WinQuerySystemAtomTable();
- ULONG nLen = WinQueryAtomLength( hAtomTable, hString );
- nLen++;
- PSZ pBuf = 0;
- if ( !MyDosAllocMem( (PPVOID)&pBuf, nLen, PAG_READ|PAG_WRITE|PAG_COMMIT | OBJ_ANY,"Atom" ) )
- {
- WinQueryAtomName( hAtomTable, hString, pBuf, nLen );
- rBufLen = nLen;
- }
- return pBuf;
-}
-
-
-//
-// MakeDDEObject
-//
-
-PDDESTRUCT ImpDdeMgr::MakeDDEObject( HWND hwnd, ATOM hItemName,
- USHORT fsStatus, USHORT usFormat, PVOID pabData, ULONG usDataLen )
-{
- PDDESTRUCT pddes = 0;
- ULONG usItemLen;
- PULONG pulSharedObj;
- //WRITELOG("MakeDDEObject: Start")
-
- PSZ pItemName = 0;
- if( hItemName != NULL )
- pItemName = AllocAtomName( hItemName, usItemLen );
- else
- usItemLen = 1;
-
- ULONG nTotalSize = sizeof(DDESTRUCT) + usItemLen + usDataLen;
-
- if( !(MyDosAllocSharedMem((PPVOID)&pulSharedObj, NULL,
- nTotalSize,
- PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_GIVEABLE | OBJ_ANY,
- "MakeDDEObject")))
- {
- pddes = (PDDESTRUCT) pulSharedObj;
- // siehe "Glenn Puchtel, DDE for OS/2" p.60
- pddes->cbData = (ULONG)usDataLen;
- pddes->fsStatus = fsStatus;
- pddes->usFormat = usFormat;
- pddes->offszItemName = sizeof( DDESTRUCT );
- if( (usDataLen) && (pabData != NULL ) )
- pddes->offabData = sizeof(DDESTRUCT) + usItemLen;
- else
- pddes->offabData = 0;
-
- if( pItemName != NULL )
- memcpy(DDES_PSZITEMNAME(pddes), pItemName, usItemLen );
- else
- *(DDES_PSZITEMNAME(pddes)) = '\0';
-
- if( pabData != NULL )
- memcpy( DDES_PABDATA(pddes), pabData, usDataLen );
- }
-
- if ( pItemName )
- {
- MyDosFreeMem( pItemName,"MakeDDEObject" );
- }
- return pddes;
-}
-
-//
-// AllocNamedSharedMem
-//
-
-APIRET ImpDdeMgr::AllocNamedSharedMem( PPVOID ppBaseAddress, PSZ pName,
- ULONG nElementSize, ULONG nElementCount )
-{
- ULONG nObjSize = (ULONG)(nElementSize * nElementCount );
- nObjSize += sizeof( ULONG ); // fuer ElementCount am Anfang des Blocks
-
- *ppBaseAddress = 0;
- APIRET nRet = MyDosAllocSharedMem( ppBaseAddress, pName, nObjSize,
- PAG_READ | PAG_WRITE | PAG_COMMIT | OBJ_ANY,
- "AllocNamedSharedMem" );
- if ( !nRet )
- {
- memset( *ppBaseAddress, 0, nObjSize );
- ULONG* pULONG = (ULONG*)*ppBaseAddress;
- *pULONG = nObjSize;
- }
- return nRet;
-}
-
-void ImpDdeMgr::CreateServerWnd()
-{
- hWndServer = WinCreateWindow( HWND_DESKTOP, WC_FRAME, "DDEServer", 0,
- 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 );
- WinSetWindowULong( hWndServer, 0, (ULONG)this );
- WinSubclassWindow( hWndServer, ::ServerWndProc );
- TID tidDummy;
- WinQueryWindowProcess( hWndServer, &pidThis, &tidDummy );
-}
-
-void ImpDdeMgr::DestroyServerWnd()
-{
- WinDestroyWindow( hWndServer );
- hWndServer = NULLHANDLE;
-}
-
-HWND ImpDdeMgr::CreateConversationWnd()
-{
- HWND hWnd = WinCreateWindow( HWND_OBJECT, WC_FRAME, "DDEConvWnd", 0,
- 0,0,0,0, HWND_DESKTOP, HWND_BOTTOM, 0, 0, 0 );
- if ( hWnd )
- {
- ImpConvWndData* pWndData = new ImpConvWndData;
- pWndData->pThis = this;
- pWndData->nRefCount = 0;
- WinSetWindowULong( hWnd, 0, (ULONG)pWndData );
- WinSubclassWindow( hWnd, ::ConvWndProc );
-#if 0 && defined( OV_DEBUG )
- String aStr("ConvWnd created:");
- aStr += (ULONG)hWnd;
- WRITELOG((char*)aStr.GetStr())
-#endif
- }
- else
- nLastErrInstance = DMLERR_SYS_ERROR;
-
- return hWnd;
-}
-
-// static
-void ImpDdeMgr::DestroyConversationWnd( HWND hWnd )
-{
- ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 );
- if( pObj )
- {
- pObj->nRefCount--;
- if( pObj->nRefCount == 0
- // auch Windows mit Refcount vonm loeschen, da dieser in initial
- // auf 0 gesetzt wird
- || pObj->nRefCount == (USHORT)-1 )
- {
- delete pObj;
- WinDestroyWindow( hWnd );
-#if 0 && defined( OV_DEBUG )
- String aStr("ConvWnd destroyed:");
- aStr += (ULONG)hWnd;
- WRITELOG((char*)aStr.GetStr())
-#endif
- }
- else
- {
-#if 0 && defined( OV_DEBUG )
- String aStr("ConvWnd not destroyed (Refcount=");
- aStr += pObj->nRefCount;
- aStr += ") "; aStr += (ULONG)hWnd;
- WRITELOG((char*)aStr.GetStr())
-#endif
- }
- }
-#if defined( OV_DEBUG )
- else
- {
- WRITELOG("DestroyCnvWnd:Already destroyed/No win data/Partner died")
- }
-#endif
-}
-
-// static
-USHORT ImpDdeMgr::GetConversationWndRefCount( HWND hWnd )
-{
- ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 );
- DBG_ASSERT(pObj,"Dde:ConvWnd has no data");
- if( pObj )
- return pObj->nRefCount;
- return 0;
-}
-
-// static
-USHORT ImpDdeMgr::IncConversationWndRefCount( HWND hWnd )
-{
-#if 0 && defined( OV_DEBUG )
- String aStr("IncConversationWndRefCount ");
- aStr += (ULONG)hWnd;
- WRITELOG((char*)aStr.GetStr())
-#endif
- ImpConvWndData* pObj = (ImpConvWndData*)WinQueryWindowULong( hWnd, 0 );
- DBG_ASSERT(pObj,"Dde:ConvWnd has no data");
- if( pObj )
- {
- pObj->nRefCount++;
- return pObj->nRefCount;
- }
- return 0;
-}
-
-ImpDdeMgrData* ImpDdeMgr::InitAll()
-{
- ImpDdeMgrData* pBase = 0;
- // nur dann neu anlegen, wenn die Tabelle nicht existiert
- APIRET nRet=DosGetNamedSharedMem((PPVOID)&pBase,DDEMLDATA,PAG_READ| PAG_WRITE);
- if ( nRet )
- {
- if ( nRet == 2 ) // ERROR_FILE_NOT_FOUND )
- {
- // DDECONVERSATIONCOUNT=4096
- USHORT nConvTransCount = 128;
- PSZ pResult;
- nRet = DosScanEnv( "SOMAXDDECONN", (const char**)&pResult );
- if( !nRet )
- {
- int nTemp = 0;
- nTemp = atoi( pResult );
- nTemp++; // der nullte Eintrag wird nicht benutzt
- if( nTemp > 128 )
- nConvTransCount = (USHORT)nTemp;
- }
- ULONG nSize = sizeof(ImpDdeMgrData);
- nSize += sizeof(ImpHCONV) * nConvTransCount;
- nSize += sizeof(Transaction) * nConvTransCount;
- nSize += sizeof(HWND) * DDEMLAPPCOUNT;
-
- nRet = ImpDdeMgr::AllocNamedSharedMem( (PPVOID)&pBase,
- DDEMLDATA, nSize, 1 );
- if ( !nRet )
- {
- pBase->nTotalSize = nSize;
- ULONG nAppTable = (ULONG)&(pBase->aAppTable);
- ULONG nCharBase = (ULONG)pBase;
- pBase->nOffsAppTable = nAppTable - nCharBase;
- pBase->nOffsConvTable = pBase->nOffsAppTable;
- pBase->nOffsConvTable += sizeof(HWND) * DDEMLAPPCOUNT;
- pBase->nOffsTransTable = pBase->nOffsConvTable;
- pBase->nOffsTransTable += sizeof(ImpHCONV) * nConvTransCount;
-
- pBase->nMaxAppCount = DDEMLAPPCOUNT;
- pBase->nMaxConvCount = nConvTransCount;
- pBase->nMaxTransCount = nConvTransCount;
- }
- }
- }
-
- if( pBase )
- {
- pConvTable = ImpDdeMgr::GetConvTable( pBase );
- pTransTable = ImpDdeMgr::GetTransTable( pBase );
- pAppTable = ImpDdeMgr::GetAppTable( pBase );
- }
-
- memset( &aDefaultContext, 0, sizeof(CONVCONTEXT) );
- aDefaultContext.cb = sizeof(CONVCONTEXT);
- aDefaultContext.idCountry = 49; // ??
- aDefaultContext.usCodepage = 850; // ??
-
- return pBase;
-}
-
-// static
-HCONV ImpDdeMgr::CreateConvHandle( ImpDdeMgrData* pData,
- PID pidOwner,
- HWND hWndMe, HWND hWndPartner,
- HSZ hszPartner, HSZ hszServiceReq, HSZ hszTopic,
- HCONV hPrevHCONV )
-{
- DBG_ASSERT(pData,"DDE:Invalid data");
- if( !pData )
- return (HCONV)0;
-
- ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pData );
- USHORT nCount = pData->nMaxConvCount;
- pPtr++;
- nCount--; // ersten Handle (NULLHANDLE) ueberspringen
- USHORT nIdx = 1;
- DBG_ASSERT(pPtr,"No ConvTable");
- if( !pPtr )
- return (HCONV)0;
-
- while( nCount && pPtr->hWndThis != (HWND)NULL )
- {
- nCount--;
- pPtr++;
- nIdx++;
- }
- if( !nCount )
- return (HCONV)0;
-
- DdeKeepStringHandle( hszPartner );
- DdeKeepStringHandle( hszServiceReq );
- DdeKeepStringHandle( hszTopic );
- pPtr->hszPartner = hszPartner;
- pPtr->hszServiceReq = hszServiceReq;
- pPtr->hszTopic = hszTopic;
-
- pPtr->hWndThis = hWndMe;
- pPtr->hWndPartner = hWndPartner;
- pPtr->pidOwner = pidOwner;
- pPtr->hConvPartner = (HCONV)0;
- pPtr->nPrevHCONV = (USHORT)hPrevHCONV;
- pPtr->nNextHCONV = 0;
- pPtr->nStatus = ST_CONNECTED;
-
- pData->nCurConvCount++;
-
- return (HCONV)nIdx;
-}
-
-// static
-void ImpDdeMgr::FreeConvHandle( ImpDdeMgrData* pBase, HCONV hConv,
- BOOL bDestroyHWndThis )
-{
- DBG_ASSERT(pBase,"DDE:No data");
-#if 0 && defined( OV_DEBUG )
- String aStr("FreeConvHandle: Start ");
- aStr += (ULONG)hConv;
- aStr += " Destroy: "; aStr += (USHORT)bDestroyHWndThis;
- WRITELOG((char*)aStr.GetStr());
- WRITESTATUS("FreeConvHandle: Start");
-#endif
- if( !pBase )
- {
- WRITELOG("FreeConvHandle: FAIL");
- return;
- }
- DBG_ASSERT(hConv&&hConv<pBase->nMaxConvCount,"DDE:Invalid Conv-Handle");
- if( hConv && hConv < pBase->nMaxConvCount )
- {
- ImpHCONV* pTable = ImpDdeMgr::GetConvTable( pBase );
- ImpHCONV* pPtr = pTable + (USHORT)hConv;
- if( pPtr->nStatus & ST_INLIST )
- {
- // Verkettung umsetzen
- USHORT nPrev = pPtr->nPrevHCONV;
- USHORT nNext = pPtr->nNextHCONV;
- if( nPrev )
- {
- pPtr = pTable + nPrev;
- pPtr->nNextHCONV = nNext;
- }
- if( nNext )
- {
- pPtr = pTable + nNext;
- pPtr->nPrevHCONV = nPrev;
- }
- pPtr = pTable + (USHORT)hConv;
- }
-
- DdeFreeStringHandle( pPtr->hszPartner );
- DdeFreeStringHandle( pPtr->hszServiceReq );
- DdeFreeStringHandle( pPtr->hszTopic );
- if( bDestroyHWndThis )
- DestroyConversationWnd( pPtr->hWndThis );
- memset( pPtr, 0, sizeof(ImpHCONV) );
- DBG_ASSERT(pBase->nCurConvCount,"Dde:Invalid Trans. count");
- pBase->nCurConvCount--;
- }
-#if defined(OV_DEBUG)
- else
- {
- WRITELOG("FreeConvHandle: FAIL");
- }
-#endif
- //WRITELOG("FreeConvHandle: END");
- //WRITESTATUS("FreeConvHandle: End");
-}
-
-// static
-HCONV ImpDdeMgr::IsConvHandleAvailable( ImpDdeMgrData* pBase )
-{
- DBG_ASSERT(pBase,"DDE:No data");
- if( !pBase )
- return 0;
-
- ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pBase );
- USHORT nCurPos = pBase->nMaxConvCount - 1;
- pPtr += nCurPos; // von hinten aufrollen
- while( nCurPos >= 1 )
- {
- if( pPtr->hWndThis == 0 )
- return TRUE;
- pPtr--;
- nCurPos--;
- }
- return FALSE;
-}
-
-// static
-HCONV ImpDdeMgr::GetConvHandle( ImpDdeMgrData* pBase, HWND hWndThis,
- HWND hWndPartner )
-{
- DBG_ASSERT(pBase,"DDE:No data");
- if( !pBase )
- return 0;
- ImpHCONV* pPtr = ImpDdeMgr::GetConvTable( pBase );
- USHORT nCurPos = 1;
- pPtr++; // ersten Handle ueberspringen
- USHORT nCurConvCount = pBase->nCurConvCount;
- while( nCurConvCount && nCurPos < pBase->nMaxConvCount )
- {
- if( pPtr->hWndThis )
- {
- if(pPtr->hWndThis == hWndThis && pPtr->hWndPartner == hWndPartner)
- return (HCONV)nCurPos;
- nCurConvCount--;
- if( !nCurConvCount )
- return (HCONV)0;
- }
- nCurPos++;
- pPtr++;
- }
- return (HCONV)0;
-}
-
-
-
-// static
-ULONG ImpDdeMgr::CreateTransaction( ImpDdeMgrData* pBase, HCONV hOwner,
- HSZ hszItem, USHORT nFormat, USHORT nTransactionType )
-{
- DBG_ASSERT(pBase,"DDE:No Data");
- DBG_ASSERT(hOwner!=0,"DDE:No Owner");
-
- if( pBase && hOwner )
- {
- Transaction* pPtr = ImpDdeMgr::GetTransTable( pBase );
- DBG_ASSERT(pPtr->hConvOwner==0,"DDE:Data corrupted");
- USHORT nId = 1;
- pPtr++;
- while( nId < pBase->nMaxTransCount )
- {
- if( pPtr->hConvOwner == (HCONV)0 )
- {
- pPtr->hConvOwner = hOwner;
- DdeKeepStringHandle( hszItem );
- pPtr->hszItem = hszItem;
- pPtr->nType = nTransactionType;
- pPtr->nConvst = XST_CONNECTED;
- pPtr->nFormat = nFormat;
- pBase->nCurTransCount++;
- return (ULONG)nId;
- }
- nId++;
- pPtr++;
- }
- }
- return 0;
-}
-
-// static
-void ImpDdeMgr::FreeTransaction( ImpDdeMgrData* pBase, ULONG nTransId )
-{
- DBG_ASSERT(pBase,"DDE:No Data");
- if( !pBase )
- return;
-
- DBG_ASSERT(nTransId<pBase->nMaxTransCount,"DDE:Invalid TransactionId");
- if( nTransId >= pBase->nMaxTransCount )
- return;
-
- Transaction* pPtr = ImpDdeMgr::GetTransTable( pBase );
- pPtr += nTransId;
- DBG_ASSERT(pPtr->hConvOwner!=0,"DDE:TransId has no owner");
- if( pPtr->hConvOwner )
- {
- //WRITELOG("Freeing transaction");
- DdeFreeStringHandle( pPtr->hszItem );
- memset( pPtr, 0, sizeof(Transaction) );
- DBG_ASSERT(pBase->nCurTransCount,"Dde:Invalid Trans. count");
- pBase->nCurTransCount--;
- }
-}
-
-// static
-ULONG ImpDdeMgr::GetTransaction( ImpDdeMgrData* pBase,
- HCONV hOwner, HSZ hszItem, USHORT nFormat )
-{
- DBG_ASSERT(pBase,"DDE:No Data");
- if( !pBase || !hOwner )
- return 0;
-
- Transaction* pTrans = ImpDdeMgr::GetTransTable( pBase );
- DBG_ASSERT(pTrans,"DDE:No TransactionTable");
- if( !pTrans )
- return 0;
- pTrans++; // NULLHANDLE ueberspringen
-
- ImpHCONV* pConv = ImpDdeMgr::GetConvTable( pBase );
- pConv += (USHORT)hOwner;
- HCONV hConvPartner = pConv->hConvPartner;
-
- USHORT nCurTransCount = pBase->nCurTransCount;
- for( USHORT nTrans=1; nTrans< pBase->nMaxTransCount; nTrans++, pTrans++ )
- {
- if( pTrans->hConvOwner )
- {
- if(( pTrans->hConvOwner == hOwner ||
- pTrans->hConvOwner == hConvPartner) &&
- pTrans->nFormat == nFormat &&
- pTrans->hszItem == hszItem )
- {
- // gefunden!
- return (ULONG)nTrans;
- }
- nCurTransCount--;
- if( !nCurTransCount )
- return 0;
- }
- }
- return 0; // narda
-}
-
-// static
-HSZ ImpDdeMgr::DdeCreateStringHandle( PSZ pszString, int iCodePage)
-{
- if( !pszString || *pszString == '\0' )
- return (HSZ)0;
- // Atom-Table beachtet Gross/Kleinschreibung, DDEML aber nicht
-
- // OV 12.4.96: Services,Topics,Items case-sensitiv!!!
- // (Grosskundenanforderung (Reuter-DDE))
- //strlwr( pszString );
- //*pszString = (char)toupper(*pszString);
-
- HATOMTBL hAtomTable = WinQuerySystemAtomTable();
- ATOM aAtom = WinAddAtom( hAtomTable, pszString );
- return (HSZ)aAtom;
-}
-
-// static
-ULONG ImpDdeMgr::DdeQueryString( HSZ hszStr, PSZ pszStr, ULONG cchMax, int iCodePage)
-{
- HATOMTBL hAtomTable = WinQuerySystemAtomTable();
- if ( !pszStr )
- return WinQueryAtomLength( hAtomTable, (ATOM)hszStr);
- else
- {
- *pszStr = 0;
- return WinQueryAtomName( hAtomTable, (ATOM)hszStr, pszStr, cchMax );
- }
-}
-
-// static
-BOOL ImpDdeMgr::DdeFreeStringHandle( HSZ hsz )
-{
- if( !hsz )
- return FALSE;
- ATOM aResult = WinDeleteAtom( WinQuerySystemAtomTable(),(ATOM)hsz );
- return (BOOL)(aResult==0);
-}
-
-// static
-BOOL ImpDdeMgr::DdeKeepStringHandle( HSZ hsz )
-{
- if( !hsz )
- return TRUE;
- HATOMTBL hAtomTable = WinQuerySystemAtomTable();
-#ifdef DBG_UTIL
- ULONG nUsageCount=WinQueryAtomUsage(hAtomTable,(ATOM)hsz);
-#endif
- ULONG nAtom = 0xFFFF0000;
- ULONG nPar = (ULONG)hsz;
- nAtom |= nPar;
- ATOM aAtom = WinAddAtom( hAtomTable, (PSZ)nAtom );
-#ifdef DBG_UTIL
- if ( aAtom )
- DBG_ASSERT(WinQueryAtomUsage(hAtomTable,(ATOM)hsz)==nUsageCount+1,"Keep failed");
-#endif
- return (BOOL)(aAtom!=0);
-}
-
-
-// static
-int ImpDdeMgr::DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
-{
- if ( hsz1 == hsz2 )
- return 0;
- if ( hsz1 < hsz2 )
- return -1;
- return 1;
-}
-
-HDDEDATA ImpDdeMgr::DdeCreateDataHandle( void* pSrc, ULONG cb,
- ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd)
-{
- char* pData = (char*)pSrc;
- pData += cbOff;
- USHORT nStatus;
- if( afCmd & HDATA_APPOWNED )
- nStatus = IMP_HDATAAPPOWNED;
- else
- nStatus = 0;
- PDDESTRUCT hData=MakeDDEObject(0,(ATOM)hszItem,nStatus,wFmt,pData,cb);
-// WRITEDATA(hData)
- if ( !hData )
- ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return (HDDEDATA)hData;
-}
-
-// static
-BYTE* ImpDdeMgr::DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize)
-{
- BYTE* pRet = 0;
- *pcbDataSize = 0;
- if ( hData )
- {
- pRet = (BYTE*)hData;
- pRet += hData->offabData;
- ULONG nLen = hData->cbData;
- // nLen -= hData->offabData;
- *pcbDataSize = nLen;
- }
- else
- ImpDdeMgr::nLastErrInstance = DMLERR_INVALIDPARAMETER;
- return pRet;
-}
-
-// static
-BOOL ImpDdeMgr::DdeUnaccessData(HDDEDATA hData)
-{
- return TRUE; // nothing to do for us
-}
-
-// static
-BOOL ImpDdeMgr::DdeFreeDataHandle(HDDEDATA hData)
-{
- DdeUnaccessData( hData );
- MyDosFreeMem( (PSZ)hData, "DdeFreeDataHandle" );
- return TRUE;
-}
-
-// static
-HDDEDATA ImpDdeMgr::DdeAddData(HDDEDATA hData,void* pSrc,ULONG cb,ULONG cbOff)
-{
- return (HDDEDATA)0;
-}
-
-// static
-ULONG ImpDdeMgr::DdeGetData(HDDEDATA hData,void* pDst,ULONG cbMax,ULONG cbOff)
-{
- return 0;
-}
-
-BOOL ImpDdeMgr::DisconnectAll()
-{
- //WRITESTATUS("Before DisconnectAll()")
- USHORT nCurConvCount = pData->nCurConvCount;
- if( !nCurConvCount )
- return TRUE;
-
- BOOL bRet = TRUE;
- ImpHCONV* pPtr = pConvTable;
- pPtr++;
-
- for( USHORT nPos=1; nPos < pData->nMaxConvCount; nPos++, pPtr++ )
- {
- if( pPtr->hWndThis )
- {
- if( !DdeDisconnect( (HCONV)nPos ) )
- bRet = FALSE;
- nCurConvCount--;
- if( !nCurConvCount )
- break;
- }
- }
- //WRITESTATUS("After DisconnectAll()")
- return bRet;
-}
-
-// static
-void ImpDdeMgr::FreeTransactions( ImpDdeMgrData* pData,HWND hWndThis,
- HWND hWndPartner )
-{
- USHORT nCurTransCount = pData->nCurTransCount;
- if( !nCurTransCount )
- return;
-
- Transaction* pTrans = GetTransTable( pData );
- ImpHCONV* pConvTable = GetConvTable( pData );
- pTrans++;
- for( USHORT nPos=1; nPos < pData->nMaxTransCount; nPos++, pTrans++ )
- {
- if( pTrans->hConvOwner )
- {
- ImpHCONV* pConv = pConvTable + (USHORT)(pTrans->hConvOwner);
- if((pConv->hWndThis==hWndThis&& pConv->hWndPartner==hWndPartner)||
- (pConv->hWndThis==hWndPartner && pConv->hWndPartner==hWndThis))
- {
- FreeTransaction( pData, (ULONG)nPos );
- }
- nCurTransCount--;
- if( !nCurTransCount )
- return;
- }
- }
-}
-
-// static
-void ImpDdeMgr::FreeTransactions( ImpDdeMgrData* pData, HCONV hConvOwner )
-{
- USHORT nCurTransCount = pData->nCurTransCount;
- if( !nCurTransCount )
- return;
-
- Transaction* pTrans = GetTransTable( pData );
-// ImpHCONV* pConvTable = GetConvTable( pData );
- pTrans++;
- for( USHORT nPos=1; nPos < pData->nMaxTransCount; nPos++, pTrans++ )
- {
- if( pTrans->hConvOwner == hConvOwner )
- {
- FreeTransaction( pData, (ULONG)nPos );
- nCurTransCount--;
- if( !nCurTransCount )
- return;
- }
- }
-}
-
-// static
-void ImpDdeMgr::FreeConversations( ImpDdeMgrData* pData, HWND hWndThis,
- HWND hWndPartner )
-{
- USHORT nCurCount = pData->nCurConvCount;
- if( !nCurCount )
- return;
-
- ImpHCONV* pPtr = GetConvTable( pData );
- pPtr++;
- for( USHORT nPos=1; nPos < pData->nMaxConvCount; nPos++, pPtr++ )
- {
- if( pPtr->hWndThis )
- {
- if( hWndThis && pPtr->hWndPartner==hWndPartner )
- FreeConvHandle( pData, (HCONV)nPos );
- nCurCount--;
- if( !nCurCount )
- return;
- }
- }
-}
-
-
-BOOL ImpDdeMgr::OwnsConversationHandles()
-{
- //WRITESTATUS("OwnsConversationHandles()");
-#if 0 && defined( OV_DEBUG )
- String aStr("OwnsConversationHandles Server:");
- aStr += (ULONG)hWndServer;
- WRITELOG((char*)aStr.GetStr())
-#endif
- ImpHCONV* pPtr = GetConvTable( pData );
- for( USHORT nCur = 1; nCur < pData->nMaxConvCount; nCur++, pPtr++ )
- {
- if( pPtr->hWndThis && pPtr->pidOwner == pidThis )
- {
- //WRITELOG("OwnsConversationHandles: TRUE");
- return TRUE;
- }
- }
- // WRITELOG("OwnsConversationHandles: FALSE");
- return FALSE;
-}
-
-
-
-// *********************************************************************
-// *********************************************************************
-// *********************************************************************
-
-USHORT DdeInitialize(ULONG* pidInst, PFNCALLBACK pfnCallback,
- ULONG afCmd, ULONG ulRes)
-{
- if( (*pidInst)!=0 )
- {
- // Reinitialize wird noch nicht unterstuetzt
- DBG_ASSERT(0,"DDEML:Reinitialize not supported");
- return DMLERR_INVALIDPARAMETER;
- }
-
- ImpDdeMgr* pMgr = new ImpDdeMgr;
- *pidInst = (ULONG)pMgr;
- return pMgr->DdeInitialize( pfnCallback, afCmd );
-}
-
-BOOL DdeUninitialize(ULONG idInst)
-{
- if( !idInst )
- return FALSE;
- ImpDdeMgr* pMgr = (ImpDdeMgr*)idInst;
- // nur loeschen, wenn wir nicht mehr benutzt werden!
- if( !pMgr->OwnsConversationHandles() )
- {
- WRITELOG("DdeUninitialize: TRUE");
- delete pMgr;
- return TRUE;
- }
- WRITELOG("DdeUninitialize: FALSE");
- return FALSE;
-}
-
-
-HCONVLIST DdeConnectList(ULONG idInst, HSZ hszService, HSZ hszTopic,
- HCONVLIST hConvList, CONVCONTEXT* pCC)
-{
- if( !idInst )
- return 0;
- return ((ImpDdeMgr*)idInst)->DdeConnectList(hszService,hszTopic,
- hConvList, pCC );
-}
-
-HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev)
-{
- return ImpDdeMgr::DdeQueryNextServer( hConvList, hConvPrev );
-}
-
-BOOL DdeDisconnectList(HCONVLIST hConvList)
-{
- return ImpDdeMgr::DdeDisconnectList( hConvList );
-}
-
-HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic,
- CONVCONTEXT* pCC)
-{
- if( !idInst )
- return 0;
- return ((ImpDdeMgr*)idInst)->DdeConnect( hszService, hszTopic, pCC );
-}
-
-BOOL DdeDisconnect(HCONV hConv)
-{
- return ImpDdeMgr::DdeDisconnect( hConv );
-}
-
-HCONV DdeReconnect(HCONV hConv)
-{
- return ImpDdeMgr::DdeReconnect( hConv );
-}
-
-
-USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransact, CONVINFO* pCI )
-{
- return ImpDdeMgr::DdeQueryConvInfo( hConv, idTransact, pCI );
-}
-
-BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser)
-{
- return ImpDdeMgr::DdeSetUserHandle( hConv, id, hUser );
-}
-
-BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction)
-{
- if( !idInst )
- return FALSE;
- return ((ImpDdeMgr*)idInst)->DdeAbandonTransaction(hConv,idTransaction);
-}
-
-BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem)
-{
- if( !idInst )
- return FALSE;
- return ((ImpDdeMgr*)idInst)->DdePostAdvise( hszTopic, hszItem );
-}
-
-BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd)
-{
- if( !idInst )
- return FALSE;
- return ((ImpDdeMgr*)idInst)->DdeEnableCallback( hConv, wCmd );
-}
-
-HDDEDATA DdeClientTransaction(void* pData, ULONG cbData,
- HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType,
- ULONG dwTimeout, ULONG* pdwResult)
-{
- return ImpDdeMgr::DdeClientTransaction( pData, cbData,
- hConv, hszItem, wFmt, wType, dwTimeout, pdwResult );
-}
-
-HDDEDATA DdeCreateDataHandle(ULONG idInst, void* pSrc, ULONG cb,
- ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd)
-{
- if( !idInst )
- return 0;
- return ((ImpDdeMgr*)idInst)->DdeCreateDataHandle( pSrc, cb,
- cbOff, hszItem, wFmt, afCmd );
-}
-
-HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff)
-{
- return ImpDdeMgr::DdeAddData( hData, pSrc, cb, cbOff );
-}
-
-ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff)
-{
- return ImpDdeMgr::DdeGetData( hData, pDst, cbMax, cbOff );
-}
-
-BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize)
-{
- return ImpDdeMgr::DdeAccessData( hData, pcbDataSize );
-}
-
-BOOL DdeUnaccessData(HDDEDATA hData)
-{
- return ImpDdeMgr::DdeUnaccessData( hData );
-}
-
-BOOL DdeFreeDataHandle(HDDEDATA hData)
-{
- return ImpDdeMgr::DdeFreeDataHandle( hData );
-}
-
-USHORT DdeGetLastError(ULONG idInst)
-{
- if( !idInst )
- return DMLERR_DLL_NOT_INITIALIZED;
- return ((ImpDdeMgr*)idInst)->DdeGetLastError();
-}
-
-HSZ DdeCreateStringHandle(ULONG idInst, PSZ pszString,int iCodePage )
-{
- if( !idInst )
- return 0;
- return ((ImpDdeMgr*)idInst)->DdeCreateStringHandle(pszString,iCodePage);
-}
-
-ULONG DdeQueryString( ULONG idInst, HSZ hsz, PSZ pBuf,
- ULONG cchMax, int iCodePage )
-{
- if( !idInst )
- return 0;
- return ((ImpDdeMgr*)idInst)->DdeQueryString( hsz,pBuf,cchMax,iCodePage);
-}
-
-BOOL DdeFreeStringHandle( ULONG idInst, HSZ hsz)
-{
- if( !idInst )
- return FALSE;
- return ((ImpDdeMgr*)idInst)->DdeFreeStringHandle( hsz );
-}
-
-BOOL DdeKeepStringHandle( ULONG idInst, HSZ hsz )
-{
- if( !idInst )
- return FALSE;
- return ((ImpDdeMgr*)idInst)->DdeKeepStringHandle( hsz );
-}
-
-int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2)
-{
- return ImpDdeMgr::DdeCmpStringHandles( hsz1, hsz2 );
-}
-
-HDDEDATA DdeNameService( ULONG idInst, HSZ hsz1, HSZ hszRes, USHORT afCmd )
-{
- if( !idInst )
- return 0;
- return ((ImpDdeMgr*)idInst)->DdeNameService( hsz1, afCmd );
-}
-
-
diff --git a/svtools/source/svdde/ddemldeb.cxx b/svtools/source/svdde/ddemldeb.cxx
deleted file mode 100644
index bb53743a2915..000000000000
--- a/svtools/source/svdde/ddemldeb.cxx
+++ /dev/null
@@ -1,283 +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: ddemldeb.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-
-#include "ddemlimp.hxx"
-
-#ifdef OV_DEBUG
-#include <svgen.hxx>
-#endif
-
-#if defined(OV_DEBUG)
-
-void ImpAddHSZ( HSZ hszString, String& rStr )
-{
- char aBuf[ 128 ];
- ImpDdeMgr::DdeQueryString( hszString,aBuf,sizeof(aBuf),850);
- rStr += " (\""; rStr += aBuf; rStr += "\",";
- HATOMTBL hAtomTable = WinQuerySystemAtomTable();
- ULONG nRefCount = 0;
- if( hszString )
- nRefCount = WinQueryAtomUsage(hAtomTable, (ATOM)hszString );
- rStr += nRefCount; rStr += ')';
-}
-
-
-void ImpWriteDdeStatus(char* aFilename, char* pAppContext)
-{
- char aBuf[ 128 ];
- USHORT nCtr;
- HWND* pAppPtr;
- ImpHCONV* pConvPtr;
- Transaction* pTransPtr;
-
- ImpDdeMgrData* pData = ImpDdeMgr::AccessMgrData();
- if( !pData )
- return;
- SvFileStream aStrm(aFilename, STREAM_READWRITE );
- String aLine;
- aStrm.Seek( STREAM_SEEK_TO_END );
- aStrm << endl;
- aStrm.WriteLine("********************** DDEML-Log ***********************");
- aStrm << endl;
- if( pAppContext )
- {
- aLine = Application::GetAppName();
- aLine += ':';
- aLine += "App-Context:"; aLine += pAppContext;
- aStrm.WriteLine( aLine ); aStrm << endl;
- }
- aStrm.WriteLine("----------------- ImpDdeMgrData -------------------");
- aStrm << endl;
- aLine= "TotalSize :"; aLine+= pData->nTotalSize; aStrm.WriteLine(aLine);
- aLine= "nOffsAppTable :"; aLine+= pData->nOffsAppTable; aStrm.WriteLine(aLine);
- aLine= "nOffsConvTable :"; aLine+= pData->nOffsConvTable; aStrm.WriteLine(aLine);
- aLine= "nOffsTransTable:"; aLine+= pData->nOffsTransTable; aStrm.WriteLine(aLine);
- aLine= "nMaxAppCount :"; aLine+= pData->nMaxAppCount; aStrm.WriteLine(aLine);
- aLine= "nMaxConvCount :"; aLine+= pData->nMaxConvCount; aStrm.WriteLine(aLine);
- aLine= "nMaxTransCount :"; aLine+= pData->nMaxTransCount; aStrm.WriteLine(aLine);
- aLine= "nLastErr :"; aLine+= pData->nLastErr; aStrm.WriteLine(aLine);
- aLine= "nCurConvCount :"; aLine+= pData->nCurConvCount; aStrm.WriteLine(aLine);
- aLine= "nCurTransCount :"; aLine+= pData->nCurTransCount; aStrm.WriteLine(aLine);
- aStrm << endl;
- aStrm.WriteLine("---------- Registered DDEML-Applications -----------");
- aStrm << endl;
- pAppPtr = ImpDdeMgr::GetAppTable( pData );
- for( nCtr = 0; nCtr < pData->nMaxAppCount; nCtr++, pAppPtr++ )
- {
- if( *pAppPtr )
- {
- aLine = "App."; aLine += nCtr; aLine += " HWND:";
- aLine += (ULONG)*pAppPtr; aStrm.WriteLine(aLine);
- }
- }
-
- aStrm << endl;
- aStrm.WriteLine("-------------- Conversation handles ----------------");
- aStrm << endl;
-
- USHORT nCurCount = pData->nCurConvCount;
-
- if( nCurCount )
- {
- pConvPtr = ImpDdeMgr::GetConvTable( pData );
- for( nCtr = 0; nCtr < pData->nMaxConvCount; nCtr++, pConvPtr++ )
- {
- if( pConvPtr->hWndThis )
- {
- aLine = "HCONV:"; aLine += nCtr;
- aLine += " HCONVpartner: "; aLine += (USHORT)pConvPtr->hConvPartner;
- if( !pConvPtr->hConvPartner ) aLine += "(Non-DDEML-App)";
- aLine += " hszPartner: "; aLine += (USHORT)pConvPtr->hszPartner;
- ImpAddHSZ( pConvPtr->hszPartner, aLine );
- aStrm.WriteLine( aLine );
-
- aLine = "hszService: "; aLine += (USHORT)pConvPtr->hszServiceReq;
- ImpAddHSZ( pConvPtr->hszServiceReq, aLine );
- aLine += " hszTopic: "; aLine += (USHORT)pConvPtr->hszTopic;
- ImpAddHSZ( pConvPtr->hszTopic, aLine );
- aStrm.WriteLine( aLine );
-
- aLine= "Status: "; aLine+= pConvPtr->nStatus;
- if( pConvPtr->nStatus & ST_CLIENT ) aLine += " (Client)";
- if( pConvPtr->nStatus & ST_INLIST ) aLine += " (Inlist)";
- aStrm.WriteLine(aLine);
-
- aLine = "pidOwner: "; aLine += (ULONG)pConvPtr->pidOwner;
- aStrm.WriteLine( aLine );
- aLine = "hWndThis: "; aLine += (ULONG)pConvPtr->hWndThis;
- aStrm.WriteLine( aLine );
- aLine = "hWndPartner: "; aLine += (ULONG)pConvPtr->hWndPartner;
- aStrm.WriteLine( aLine );
-
- aLine = "hConvList: "; aLine += (ULONG)pConvPtr->hConvList;
- aLine += " Prev: "; aLine += pConvPtr->nPrevHCONV;
- aLine += " Next: "; aLine += pConvPtr->nNextHCONV;
- aStrm.WriteLine( aLine );
- aStrm.WriteLine("----------------------------------------------------");
-
- nCurCount--;
- if( !nCurCount )
- break;
- }
- }
- }
-
- aStrm.WriteLine("----------------- Transaction Ids ------------------");
-
- nCurCount = pData->nCurTransCount;
- if( nCurCount )
- {
- pTransPtr = ImpDdeMgr::GetTransTable( pData );
- for( nCtr = 0; nCtr < pData->nMaxTransCount; nCtr++, pTransPtr++ )
- {
-
- if( pTransPtr->hConvOwner )
- {
- aLine = "TransactionId:"; aLine += nCtr;
- aLine += " hConvOwner: "; aLine += (USHORT)pTransPtr->hConvOwner;
- aStrm.WriteLine( aLine );
- aLine = "Item: "; aLine += (USHORT)pTransPtr->hszItem;
- ImpAddHSZ( pTransPtr->hszItem, aLine );
- aLine += " Format: "; aLine += pTransPtr->nFormat;
- aStrm.WriteLine( aLine );
- aLine = "TransactionType: "; aLine += pTransPtr->nType;
- aLine += " Convst: "; aLine += pTransPtr->nConvst;
- aLine += " LastErr: "; aLine += pTransPtr->nLastError;
- aLine += " Userhandle: "; aLine += pTransPtr->nUser;
- aStrm.WriteLine( aLine );
- aStrm.WriteLine("--------------------------------------------------");
-
- nCurCount--;
- if( !nCurCount )
- break;
- }
- }
- }
- aStrm << endl;
- aStrm.WriteLine("******************* End of DDEML-Log *******************");
-}
-
-void ImpWriteDdeData(char* aFilename, DDESTRUCT* pData)
-{
- char aBuf[ 128 ];
- USHORT nCtr;
- SvFileStream aStrm(aFilename, STREAM_READWRITE );
- aStrm.Seek( STREAM_SEEK_TO_END );
- String aLine;
- aStrm << endl;
- aLine = "cbData:"; aLine += pData->cbData; aStrm.WriteLine( aLine );
- aLine = "fsStatus:"; aLine += pData->fsStatus; aStrm.WriteLine( aLine );
- aLine = "usFormat:"; aLine += pData->usFormat; aStrm.WriteLine( aLine );
- aLine = "ItemName:"; aLine += (char*)((char*)pData+pData->offszItemName);
- aStrm.WriteLine( aLine );
- aLine = "offabData:"; aLine += pData->offabData; aStrm.WriteLine(aLine);
- char* pBuf = (char*)pData+pData->offabData;
- USHORT nLen = pData->cbData; // - pData->offabData;
- while( nLen )
- {
- aStrm << *pBuf;
- nLen--;
- pBuf++;
- }
- aStrm << endl;
-}
-
-void ImpWriteLogFile(char* pFilename, char* pStr)
-{
- SvFileStream aStrm(pFilename, STREAM_READWRITE );
- aStrm.Seek( STREAM_SEEK_TO_END );
- String aStr( Application::GetAppName() );
- aStr += ':'; aStr += pStr;
- aStrm.WriteLine( (char*)aStr.GetStr() );
-}
-
-#else
-
-void ImpWriteDdeStatus(char*, char* ) {}
-void ImpWriteDdeData(char*, DDESTRUCT*) {}
-void ImpWriteLogFile(char*, char*) {}
-
-#endif
-
-APIRET MyDosAllocSharedMem(void** ppBaseAddress, char* pszName, unsigned long ulObjectSize,
- unsigned long ulFlags, char* pContextStr )
-{
- APIRET nRet = DosAllocSharedMem(ppBaseAddress,pszName,ulObjectSize,ulFlags );
-#if 0 && defined(OV_DEBUG) && defined(LOGFILE)
- String aStr("DosAllocSharedMem:");
- aStr += pContextStr;
- aStr += ": ";
- aStr += ulObjectSize;
- aStr += " (";
- aStr += (ULONG)*((char**)ppBaseAddress);
- aStr += ')';
- ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr() );
-#endif
- return nRet;
-}
-
-APIRET MyDosAllocMem(void** ppBaseAddress, unsigned long ulObjectSize,
- unsigned long ulFlags, char* pContextStr )
-{
- APIRET nRet = DosAllocMem(ppBaseAddress, ulObjectSize,ulFlags );
-#if 0 && defined(OV_DEBUG) && defined(LOGFILE)
- String aStr("DosAllocMem:");
- aStr += pContextStr;
- aStr += ": ";
- aStr += ulObjectSize;
- aStr += " (";
- aStr += (ULONG)*((char**)ppBaseAddress);
- aStr += ')';
- ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr() );
-#endif
- return nRet;
-}
-
-
-APIRET MyDosFreeMem( void* pBaseAddress, char* pContextStr )
-{
- APIRET nRet = DosFreeMem( pBaseAddress );
-#if 0 && defined(OV_DEBUG) && defined(LOGFILE)
- String aStr("DosFreeMem:");
- aStr += pContextStr;
- aStr += ": ";
- aStr += (ULONG)pBaseAddress;
- ImpWriteLogFile("\\ddeml.mem", (char*)aStr.GetStr());
-#endif
- return nRet;
-}
-
-
-
-
-
diff --git a/svtools/source/svdde/ddemldeb.hxx b/svtools/source/svdde/ddemldeb.hxx
deleted file mode 100644
index 39d3d836882a..000000000000
--- a/svtools/source/svdde/ddemldeb.hxx
+++ /dev/null
@@ -1,69 +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: ddemldeb.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#if defined(OV_DEBUG)
-
-void ImpWriteLogFile(char*,char*);
-void ImpAddHSZ( HSZ, String& );
-void ImpWriteDdeStatus(char*, char* );
-void ImpWriteDdeData(char*, DDESTRUCT*);
-
-#ifdef LOGFILE
-#define WRITELOG(aString) ImpWriteLogFile("\\ddeml.log",aString);
-#else
-#define WRITELOG(bla)
-#endif
-#ifdef STATUSFILE
-#define WRITESTATUS(aContext) ImpWriteDdeStatus("\\ddeml.sts",aContext);
-#else
-#define WRITESTATUS(bla)
-#endif
-#ifdef DDEDATAFILE
-#define WRITEDATA(data) ImpWriteDdeData("\\ddeml.dat",data);
-#else
-#define WRITEDATA(bla)
-#endif
-
-#else
-
-#define WRITELOG(bla)
-#define WRITESTATUS(bla)
-#define WRITEDATA(bla)
-
-#endif
-
-APIRET MyDosAllocSharedMem(void** ppBaseAddress, char* pszName, unsigned long ulObjectSize,
- unsigned long ulFlags, char* pContextStr );
-
-APIRET MyDosAllocMem(void** ppBaseAddress, unsigned long ulObjectSize,
- unsigned long ulFlags, char* pContextStr );
-
-APIRET MyDosFreeMem( void* pBaseAddress, char* pContextStr );
-
diff --git a/svtools/source/svdde/ddemlimp.hxx b/svtools/source/svdde/ddemlimp.hxx
deleted file mode 100644
index 47ad53d0b9fe..000000000000
--- a/svtools/source/svdde/ddemlimp.hxx
+++ /dev/null
@@ -1,436 +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: ddemlimp.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _DDEMLIMP_HXX
-#define _DDEMLIMP_HXX
-
-
-#include <string.h>
-#include <ctype.h>
-#include "ddemlos2.h"
-
-#define DDEMLSERVICETABLE_INISIZE 8
-
-// Bezeichner der systemglobalen DDEML-Tabelle
-#define DDEMLDATA "\\SHAREMEM\\OV_DDEML.DAT"
-
-// vorlaeufig konstante Tabellengroessen
-#define CONVTABLECOUNT 2048 /* max count conversations */
-#define TRANSTABLECOUNT 2048 /* transactions */
-#define DDEMLAPPCOUNT 16 /* max count simultaniously running */
- /* ddeml (StarDivision) applications */
-
-#define ST_TERMACKREC 0x8000 /* wird im Conversationhandle gesetzt, */
- /* wenn die Partner-App DDE_TERMINATE */
- /* bestaetigt hat */
-
-#define XST_TIMEOUT 17 /* Trans. hat Timeout ueberschritten */
-#define XST_WAITING_ACK 18 /* Trans. wartet auf Acknowledge */
-#define XST_WAITING_ADVDATA 19 /* Trans. wartet auf Advise-Daten */
-#define XST_WAITING_REQDATA 20 /* Trans. wartet auf angeforderte Daten */
-
-
-/* User-Flags DDESTRUCT */
-#define IMP_HDATAAPPOWNED 0x8000
-
-#define CONVLISTNAME "DdeConvListId"
-
-#define XTYPF_MASK (XTYPF_NOBLOCK | XTYPF_NODATA | XTYPF_ACKREQ)
-
-//
-// DDEML-Messages; werden nur an registrierte DDEML-Apps gesendet
-//
-
-// Msg: WM_DDEML_REGISTER
-// Empfaenger: wird allen DDEML-Applikationen nach Registrierung
-// eines neuen Services gesendet
-// Params: nPar1: hszBaseServName
-// nPar2: hszInstServName
-#define WM_DDEML_REGISTER WM_USER+1
-
-// Msg: WM_DDEML_UNREGISTER
-// Empfaenger: wird allen DDEML-Applikationen nach Deregistrierung
-// eines Services gesendet
-// Params: nPar1: hszBaseServName
-// nPar2: hszInstServName
-#define WM_DDEML_UNREGISTER WM_USER+2
-
-//
-//
-//
-
-struct ImpHCONV
-{
- HCONV hConvPartner;
- HSZ hszPartner; // Name of partner application
- HSZ hszServiceReq; // Service name
- HSZ hszTopic; // Topic name
- USHORT nStatus; // ST_* of conversation
- HCONVLIST hConvList; // ConvListId , wenn in ConvList
- CONVCONTEXT aConvContext; // Conversation context
-
- // private
- HWND hWndThis; // 0 == Handle not used
- HWND hWndPartner;
- PID pidOwner; // PID des DdeManagers, der
- // den Conv-Handle erzeugt hat.
- USHORT nPrevHCONV; // 0 == no previous hConv or not in list
- USHORT nNextHCONV; // 0 == no next hconv or not in list
-};
-
-struct Transaction
-{
- HSZ hszItem; // Item name
- USHORT nFormat; // Data format
- USHORT nType; // Transaction type (XTYP_*)
- // XTYP_ADVREQ [|XTYPF_NODATA] == Advise-Loop
- // [|XTYPF_ACKREQ]
- // XTYP_EXECUTE == laufendes Execute
- // XTYP_REQUEST
- // XTYP_POKE
- // XTYP_ADVSTOP
- // XTYP_ADVSTART
- USHORT nConvst; // Conversation state (XST_*)
- // 0 == idle
- // XST_REQSENT (fuer XTYP_ADVREQ)
- // XST_TIMEOUT (fuer alle Typen!)
- // XST_WAITING (alle ausser XTYP_ADVREQ)
- USHORT nLastError; // last err in transaction
- ULONG nUser; // Userhandle
- // private
- HCONV hConvOwner; // 0 == Transaction not used
-};
-
-
-struct ImpWndProcParams
-{
- HWND hWndReceiver;
- MPARAM nPar1;
- MPARAM nPar2;
-};
-
-struct ImpService
-{
- HSZ hBaseServName; // Basis-Name des Service
- HSZ hInstServName; // Basis-Name + DDEML-Server-HWND der App
-};
-
-class ImpDdeMgr;
-
-// Daten eines Conversation-Windows
-struct ImpConvWndData
-{
- ImpDdeMgr* pThis;
- USHORT nRefCount; // Zahl Conversations auf diesem Window
-};
-
-
-// systemglobale Daten der Library (liegen in named shared memory)
-struct ImpDdeMgrData
-{
- ULONG nTotalSize;
- ULONG nOffsAppTable;
- ULONG nOffsConvTable;
- ULONG nOffsTransTable;
- USHORT nMaxAppCount;
- USHORT nMaxConvCount;
- USHORT nMaxTransCount;
- USHORT nLastErr;
- USHORT nReserved;
- USHORT nCurTransCount;
- USHORT nCurConvCount;
- HWND aAppTable[ 1 ]; // fuer Broadcast-Messages
- ImpHCONV aConvTable[ 1 ];
- Transaction aTransTable[ 1 ];
-};
-
-
-
-class ImpDdeMgr
-{
- friend MRESULT EXPENTRY ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2);
- friend MRESULT EXPENTRY ServerWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2);
- friend void ImpWriteDdeStatus(char*,char*);
- friend void ImpAddHSZ( HSZ, String& );
-
- static PSZ AllocAtomName( ATOM hString, ULONG& rBufLen );
- static PDDESTRUCT MakeDDEObject( HWND hwnd, ATOM hItemName,
- USHORT fsStatus, USHORT usFormat, PVOID pabData, ULONG usDataLen );
- static APIRET AllocNamedSharedMem( PPVOID ppBaseAddress, PSZ pName,
- ULONG nElementSize, ULONG nElementCount );
-
- HWND hWndServer;
- PID pidThis;
- PFNCALLBACK pCallback;
- ULONG nTransactFilter;
- CONVCONTEXT aDefaultContext;
- ImpDdeMgrData* pData;
- ImpService* pServices;
- USHORT nServiceCount;
-
- ImpHCONV* pConvTable; // liegt in pData (nicht deleten!)
- Transaction* pTransTable; // liegt in pData (nicht deleten!)
- HWND* pAppTable; // liegt in pData (nicht deleten!)
-
- static ImpHCONV* GetConvTable( ImpDdeMgrData* );
- static Transaction* GetTransTable( ImpDdeMgrData* );
- static HWND* GetAppTable( ImpDdeMgrData* );
-
-
- static HWND NextFrameWin( HENUM hEnum );
- void CreateServerWnd();
- void DestroyServerWnd();
- HWND CreateConversationWnd();
- // Fktn. duerfen nur fuer HCONVs aufgerufen werden, die
- // in der eigenen Applikation erzeugt wurden
- static void DestroyConversationWnd( HWND hWndConv );
- static USHORT GetConversationWndRefCount( HWND hWndConv );
- static USHORT IncConversationWndRefCount( HWND hWndConv );
-
- MRESULT SrvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2);
- MRESULT ConvWndProc(HWND hWnd,ULONG nMsg,MPARAM nPar1,MPARAM nPar2);
- void RegisterDDEMLApp();
- void UnregisterDDEMLApp();
- void CleanUp();
- ImpDdeMgrData* InitAll();
- static BOOL MyWinDdePostMsg( HWND, HWND, USHORT, PDDESTRUCT, ULONG );
- void MyInitiateDde( HWND hWndServer, HWND hWndClient,
- HSZ hszService, HSZ hszTopic, CONVCONTEXT* pCC );
- DDEINIT* CreateDDEInitData( HWND hWndDest, HSZ hszService,
- HSZ hszTopic, CONVCONTEXT* pCC );
- // wenn pDDEData==0, muss pCC gesetzt sein
- HCONV ConnectWithClient( HWND hWndClient, HSZ hszPartner,
- HSZ hszService, HSZ hszTopic, BOOL bSameInst,
- DDEINIT* pDDEData, CONVCONTEXT* pCC = 0);
-
- HCONV CheckIncoming( ImpWndProcParams*, ULONG nTransMask,
- HSZ& rhszItem );
- // fuer Serverbetrieb. Ruft Callback-Fkt fuer alle offenen Advises
- // auf, deren Owner der uebergebene HCONV ist.
- // bFreeTransactions==TRUE: loescht die Transaktionen
- // gibt Anzahl der getrennten Transaktionen zurueck
- USHORT SendUnadvises( HCONV hConv,
- USHORT nFormat, // 0==alle
- BOOL bFreeTransactions );
-
- BOOL WaitTransState(
- Transaction* pTrans, ULONG nTransId,
- USHORT nNewState,
- ULONG nTimeout );
-
- // DDEML ruft Callback mit XTYP_CONNECT-Transaction nur auf,
- // wenn die App den angeforderten Service registriert hat
- // Standardeinstellung: TRUE
- BOOL bServFilterOn;
-
- // Fehlercode muss noch systemglobal werden (Atom o. ae.)
- static USHORT nLastErrInstance; // wenn 0, dann gilt globaler Fehlercode
-
- static ImpDdeMgrData* AccessMgrData();
-
- static HCONV CreateConvHandle( ImpDdeMgrData* pBase,
- PID pidOwner,
- HWND hWndThis, HWND hWndPartner,
- HSZ hszPartner, HSZ hszServiceReq, HSZ hszTopic,
- HCONV hPrevHCONV = 0 );
-
- static HCONV IsConvHandleAvailable( ImpDdeMgrData* pBase );
- static HCONV GetConvHandle( ImpDdeMgrData* pBase,
- HWND hWndThis, HWND hWndPartner );
- static void FreeConvHandle( ImpDdeMgrData*, HCONV,
- BOOL bDestroyHWndThis = TRUE );
-
- static ULONG CreateTransaction( ImpDdeMgrData* pBase,
- HCONV hOwner, HSZ hszItem, USHORT nFormat,
- USHORT nTransactionType );
- static ULONG GetTransaction( ImpDdeMgrData* pBase,
- HCONV hOwner, HSZ hszItem, USHORT nFormat );
-
- static void FreeTransaction( ImpDdeMgrData*, ULONG nTransId );
-
- BOOL DisconnectAll();
- // Transaktionen muessen _vor_ den Konversationen geloescht werden!
- static void FreeTransactions( ImpDdeMgrData*, HWND hWndThis,
- HWND hWndPartner );
- static void FreeTransactions( ImpDdeMgrData*, HCONV hConvOwner );
-
- static void FreeConversations( ImpDdeMgrData*,HWND hWndThis,
- HWND hWndPartner );
-
- ImpService* GetService( HSZ hszService );
- ImpService* PutService( HSZ hszService );
- void BroadcastService( ImpService*, BOOL bRegistered );
-
- // rh: Startposition(!) & gefundener Handle
- static ImpHCONV* GetFirstServer( ImpDdeMgrData*, HCONVLIST, HCONV& rh);
- static ImpHCONV* GetLastServer( ImpDdeMgrData*, HCONVLIST, HCONV& );
- static BOOL CheckConvListId( HCONVLIST hConvListId );
-
- BOOL IsSameInstance( HWND hWnd );
- HSZ GetAppName( HWND hWnd );
-
-
- // Transactions
- MRESULT DdeAck( ImpWndProcParams* pParams );
- MRESULT DdeAdvise( ImpWndProcParams* pParams );
- MRESULT DdeData( ImpWndProcParams* pParams );
- MRESULT DdeExecute( ImpWndProcParams* pParams );
- MRESULT DdeInitiate( ImpWndProcParams* pParams );
- MRESULT DdeInitiateAck( ImpWndProcParams* pParams );
- MRESULT DdePoke( ImpWndProcParams* pParams );
- MRESULT DdeRequest( ImpWndProcParams* pParams );
- MRESULT DdeTerminate( ImpWndProcParams* pParams );
- MRESULT DdeUnadvise( ImpWndProcParams* pParams );
- MRESULT DdeRegister( ImpWndProcParams* pParams );
- MRESULT DdeUnregister( ImpWndProcParams* pParams );
- MRESULT DdeTimeout( ImpWndProcParams* pParams );
-
- HDDEDATA Callback(
- USHORT nTransactionType,
- USHORT nClipboardFormat,
- HCONV hConversationHandle,
- HSZ hsz1,
- HSZ hsz2,
- HDDEDATA hData,
- ULONG nData1,
- ULONG nData2 );
-
- HCONV DdeConnectImp( HSZ hszService,HSZ hszTopic,CONVCONTEXT* pCC);
-
- // connection data
- HCONV hCurConv; // wird im DdeInitiateAck gesetzt
- HCONVLIST hCurListId; // fuer DdeConnectList
- USHORT nPrevConv; // .... "" ....
- BOOL bListConnect;
-
- // synchr. transaction data
- BOOL bInSyncTrans;
- ULONG nSyncTransId;
- HDDEDATA hSyncResponseData;
- ULONG nSyncResponseMsg; // WM_DDE_ACK, WM_DDE_DATA, WM_TIMER
- // TRUE==nach Ende der synchronen Transaktion eine evtl. benutzte
- // asynchrone Transaktion beenden (typisch synchroner Request auf
- // Advise-Loop)
- BOOL bSyncAbandonTrans;
-
-public:
- ImpDdeMgr();
- ~ImpDdeMgr();
-
- USHORT DdeInitialize( PFNCALLBACK pCallbackProc, ULONG nTransactionFilter );
- USHORT DdeGetLastError();
-
- HCONV DdeConnect( HSZ hszService, HSZ hszTopic, CONVCONTEXT* );
- HCONVLIST DdeConnectList( HSZ hszService, HSZ hszTopic,
- HCONVLIST hConvList, CONVCONTEXT* );
- static BOOL DdeDisconnect( HCONV hConv );
- static BOOL DdeDisconnectList( HCONVLIST hConvList );
- static HCONV DdeReconnect(HCONV hConv);
- static HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
- static USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTrans,CONVINFO* pCI);
- static BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser);
- BOOL DdeAbandonTransaction( HCONV hConv, ULONG idTransaction);
-
- BOOL DdePostAdvise( HSZ hszTopic, HSZ hszItem);
- BOOL DdeEnableCallback( HCONV hConv, USHORT wCmd);
-
- HDDEDATA DdeNameService( HSZ hszService, USHORT afCmd);
-
- static HDDEDATA DdeClientTransaction(void* pData, ULONG cbData,
- HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType,
- ULONG dwTimeout, ULONG* pdwResult);
-
- // Data handles
-
- HDDEDATA DdeCreateDataHandle( void* pSrc, ULONG cb, ULONG cbOff,
- HSZ hszItem, USHORT wFmt, USHORT afCmd);
- static BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize);
- static BOOL DdeUnaccessData(HDDEDATA hData);
- static BOOL DdeFreeDataHandle(HDDEDATA hData);
- static HDDEDATA DdeAddData(HDDEDATA hData,void* pSrc,ULONG cb,ULONG cbOff);
- static ULONG DdeGetData(HDDEDATA hData,void* pDst,ULONG cbMax,ULONG cbOff);
-
- // String handles
-
- static HSZ DdeCreateStringHandle( PSZ pStr, int iCodePage);
- static ULONG DdeQueryString(HSZ hsz,PSZ pStr,ULONG cchMax,int iCPage);
- static BOOL DdeFreeStringHandle( HSZ hsz );
- static BOOL DdeKeepStringHandle( HSZ hsz );
- static int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
-
- // mit dieser Funktion kann geprueft werden, ob eine
- // Applikation schon eine DDEML-Instanz angelegt hat.
- // Die aktuelle Impl. unterstuetzt nur eine DDEML-Instanz
- // pro Applikation (wg. synchroner Transaktionen)
- static ImpDdeMgr* GetImpDdeMgrInstance( HWND hWnd );
-
- // gibt TRUE zurueck, wenn mind. ein lebender HCONV
- // von diesem DdeMgr erzeugt wurde
- BOOL OwnsConversationHandles();
-};
-
-// static
-inline ImpHCONV* ImpDdeMgr::GetConvTable( ImpDdeMgrData* pData )
-{
- ImpHCONV* pRet;
- if( pData )
- pRet = (ImpHCONV*)((ULONG)(pData) + pData->nOffsConvTable);
- else
- pRet = 0;
- return pRet;
-}
-
-// static
-inline Transaction* ImpDdeMgr::GetTransTable( ImpDdeMgrData* pData )
-{
- Transaction* pRet;
- if( pData )
- pRet = (Transaction*)((ULONG)(pData) + pData->nOffsTransTable);
- else
- pRet = 0;
- return pRet;
-}
-
-// static
-inline HWND* ImpDdeMgr::GetAppTable( ImpDdeMgrData* pData )
-{
- HWND* pRet;
- if( pData )
- pRet = (HWND*)((ULONG)(pData) + pData->nOffsAppTable);
- else
- pRet = 0;
- return pRet;
-}
-
-
-
-
-#endif
-
diff --git a/svtools/source/svdde/ddemlos2.h b/svtools/source/svdde/ddemlos2.h
deleted file mode 100644
index fe685e95fecf..000000000000
--- a/svtools/source/svdde/ddemlos2.h
+++ /dev/null
@@ -1,377 +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: ddemlos2.h,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.
- *
- ************************************************************************/
-#ifndef _DDEML_H
-#define _DDEML_H
-
-#define INCL_OS2
-#define INCL_WIN
-
-#include <tools/svpm.h>
-#include <tools/solar.h>
-#include <tools/debug.hxx>
-#include <tools/stream.hxx>
-
-typedef LHANDLE HSTR;
-
-#ifndef CALLBACK
-#define CALLBACK
-#endif
-
-
-typedef ULONG HCONVLIST;
-typedef ULONG HCONV;
-typedef ATOM HSZ;
-typedef DDESTRUCT* HDDEDATA;
-
-struct CONVINFO
-{
- USHORT nSize; // sizeof(CONVINFO)
- ULONG nUser; // Userhandle
- HCONV hConvPartner; //
- HSZ hszPartner; // Name der Partnerapp
- HSZ hszServiceReq; // Name des angeforderten Services
- HSZ hszTopic; // -- " -- Topics
- HSZ hszItem; // -- " -- Items
- USHORT nFormat; // Datenformat der akt. Transaktion
- USHORT nType; // Typ der akt. Transaktion (XTYP_*)
- USHORT nStatus; // ST_* der Konversation
- USHORT nConvst; // XST_* der akt. Transaktion
- USHORT nLastError; // letzter Fehler der Transaktion
- HCONVLIST hConvList; // ConvListId , wenn in ConvList
- CONVCONTEXT aConvCtxt; // conversation context
-};
-
-/* the following structure is for use with XTYP_WILDCONNECT processing. */
-
-struct HSZPAIR
-{
- HSZ hszSvc;
- HSZ hszTopic;
-};
-typedef HSZPAIR *PHSZPAIR;
-
-/***** conversation states (usState) *****/
-
-#define XST_NULL 0 /* quiescent states */
-#define XST_INCOMPLETE 1
-#define XST_CONNECTED 2
-#define XST_INIT1 3 /* mid-initiation states */
-#define XST_INIT2 4
-#define XST_REQSENT 5 /* active conversation states */
-#define XST_DATARCVD 6
-#define XST_POKESENT 7
-#define XST_POKEACKRCVD 8
-#define XST_EXECSENT 9
-#define XST_EXECACKRCVD 10
-#define XST_ADVSENT 11
-#define XST_UNADVSENT 12
-#define XST_ADVACKRCVD 13
-#define XST_UNADVACKRCVD 14
-#define XST_ADVDATASENT 15
-#define XST_ADVDATAACKRCVD 16
-
-/* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
-#define CADV_LATEACK 0xFFFF
-
-/***** conversation status bits (fsStatus) *****/
-
-#define ST_CONNECTED 0x0001
-#define ST_ADVISE 0x0002
-#define ST_ISLOCAL 0x0004
-#define ST_BLOCKED 0x0008
-#define ST_CLIENT 0x0010
-#define ST_TERMINATED 0x0020
-#define ST_INLIST 0x0040
-#define ST_BLOCKNEXT 0x0080
-#define ST_ISSELF 0x0100
-
-
-/* DDE constants for wStatus field */
-
-//#define DDE_FACK 0x8000
-//#define DDE_FBUSY 0x4000
-//#define DDE_FDEFERUPD 0x4000
-//#define DDE_FACKREQ 0x8000
-//#define DDE_FRELEASE 0x2000
-//#define DDE_FREQUESTED 0x1000
-//#define DDE_FACKRESERVED 0x3ff0
-//#define DDE_FADVRESERVED 0x3fff
-//#define DDE_FDATRESERVED 0x4fff
-//#define DDE_FPOKRESERVED 0xdfff
-//#define DDE_FAPPSTATUS 0x00ff
-#define DDE_FNOTPROCESSED 0x0000
-
-/***** message filter hook types *****/
-
-#define MSGF_DDEMGR 0x8001
-
-/***** codepage constants ****/
-
-#define CP_WINANSI 1004 /* default codepage for windows & old DDE convs. */
-
-/***** transaction types *****/
-
-#define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */
-#define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
-#define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
-
-#define XCLASS_MASK 0xFC00
-#define XCLASS_BOOL 0x1000
-#define XCLASS_DATA 0x2000
-#define XCLASS_FLAGS 0x4000
-#define XCLASS_NOTIFICATION 0x8000
-
-#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
-#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS )
-#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
-#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL )
-#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
-#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS )
-#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
-#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
-#define XTYP_POKE (0x0090 | XCLASS_FLAGS )
-#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
-#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
-#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
-
-#define XTYP_MASK 0x00F0
-#define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */
-
-/***** Timeout constants *****/
-
-#define TIMEOUT_ASYNC -1L
-
-/***** Transaction ID constants *****/
-
-#define QID_SYNC -1L
-
-/****** public strings used in DDE ******/
-
-#define SZDDESYS_TOPIC "System"
-#define SZDDESYS_ITEM_TOPICS "Topics"
-#define SZDDESYS_ITEM_SYSITEMS "SysItems"
-#define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
-#define SZDDESYS_ITEM_STATUS "Status"
-#define SZDDESYS_ITEM_FORMATS "Formats"
-#define SZDDESYS_ITEM_HELP "Help"
-#define SZDDE_ITEM_ITEMLIST "TopicItemList"
-
-
-/****** API entry points ******/
-
-typedef HDDEDATA CALLBACK FNCALLBACK(USHORT wType, USHORT wFmt, HCONV hConv,
- HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG dwData1, ULONG dwData2);
-typedef FNCALLBACK* PFNCALLBACK;
-
-#define CBR_BLOCK 0xffffffffL
-
-/* DLL registration functions */
-
-USHORT DdeInitialize(ULONG* pidInst, PFNCALLBACK pfnCallback,
- ULONG afCmd, ULONG ulRes);
-
-/*
- * Callback filter flags for use with standard apps.
- */
-
-#define CBF_FAIL_SELFCONNECTIONS 0x00001000
-#define CBF_FAIL_CONNECTIONS 0x00002000
-#define CBF_FAIL_ADVISES 0x00004000
-#define CBF_FAIL_EXECUTES 0x00008000
-#define CBF_FAIL_POKES 0x00010000
-#define CBF_FAIL_REQUESTS 0x00020000
-#define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
-
-#define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
-#define CBF_SKIP_REGISTRATIONS 0x00080000
-#define CBF_SKIP_UNREGISTRATIONS 0x00100000
-#define CBF_SKIP_DISCONNECTS 0x00200000
-#define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
-
-/*
- * Application command flags
- */
-#define APPCMD_CLIENTONLY 0x00000010L
-#define APPCMD_FILTERINITS 0x00000020L
-#define APPCMD_MASK 0x00000FF0L
-
-/*
- * Application classification flags
- */
-#define APPCLASS_STANDARD 0x00000000L
-#define APPCLASS_MASK 0x0000000FL
-
-
-BOOL DdeUninitialize(ULONG idInst);
-
-/* conversation enumeration functions */
-
-HCONVLIST DdeConnectList(ULONG idInst, HSZ hszService, HSZ hszTopic,
- HCONVLIST hConvList, CONVCONTEXT* pCC);
-HCONV DdeQueryNextServer(HCONVLIST hConvList, HCONV hConvPrev);
-BOOL DdeDisconnectList(HCONVLIST hConvList);
-
-/* conversation control functions */
-
-HCONV DdeConnect(ULONG idInst, HSZ hszService, HSZ hszTopic,
- CONVCONTEXT* pCC);
-BOOL DdeDisconnect(HCONV hConv);
-HCONV DdeReconnect(HCONV hConv);
-
-USHORT DdeQueryConvInfo(HCONV hConv, ULONG idTransaction, CONVINFO* pConvInfo);
-BOOL DdeSetUserHandle(HCONV hConv, ULONG id, ULONG hUser);
-
-BOOL DdeAbandonTransaction(ULONG idInst, HCONV hConv, ULONG idTransaction);
-
-
-/* app server interface functions */
-
-BOOL DdePostAdvise(ULONG idInst, HSZ hszTopic, HSZ hszItem);
-BOOL DdeEnableCallback(ULONG idInst, HCONV hConv, USHORT wCmd);
-
-#define EC_ENABLEALL 0
-#define EC_ENABLEONE ST_BLOCKNEXT
-#define EC_DISABLE ST_BLOCKED
-#define EC_QUERYWAITING 2
-
-HDDEDATA DdeNameService(ULONG idInst, HSZ hsz1, HSZ hsz2, USHORT afCmd);
-
-#define DNS_REGISTER 0x0001
-#define DNS_UNREGISTER 0x0002
-#define DNS_FILTERON 0x0004
-#define DNS_FILTEROFF 0x0008
-
-/* app client interface functions */
-
-HDDEDATA DdeClientTransaction(void* pData, ULONG cbData,
- HCONV hConv, HSZ hszItem, USHORT wFmt, USHORT wType,
- ULONG dwTimeout, ULONG* pdwResult);
-
-/* data transfer functions */
-
-HDDEDATA DdeCreateDataHandle(ULONG idInst, void* pSrc, ULONG cb,
- ULONG cbOff, HSZ hszItem, USHORT wFmt, USHORT afCmd);
-// HDDEDATA DdeAddData(HDDEDATA hData, void* pSrc, ULONG cb, ULONG cbOff);
-ULONG DdeGetData(HDDEDATA hData, void* pDst, ULONG cbMax, ULONG cbOff);
-BYTE* DdeAccessData(HDDEDATA hData, ULONG* pcbDataSize);
-BOOL DdeUnaccessData(HDDEDATA hData);
-BOOL DdeFreeDataHandle(HDDEDATA hData);
-
-#define HDATA_APPOWNED 0x0001
-
-USHORT DdeGetLastError(ULONG idInst);
-
-#define DMLERR_NO_ERROR 0 /* must be 0 */
-
-#define DMLERR_FIRST 0x4000
-
-#define DMLERR_ADVACKTIMEOUT 0x4000
-#define DMLERR_BUSY 0x4001
-#define DMLERR_DATAACKTIMEOUT 0x4002
-#define DMLERR_DLL_NOT_INITIALIZED 0x4003
-#define DMLERR_DLL_USAGE 0x4004
-#define DMLERR_EXECACKTIMEOUT 0x4005
-#define DMLERR_INVALIDPARAMETER 0x4006
-#define DMLERR_LOW_MEMORY 0x4007
-#define DMLERR_MEMORY_ERROR 0x4008
-#define DMLERR_NOTPROCESSED 0x4009
-#define DMLERR_NO_CONV_ESTABLISHED 0x400a
-#define DMLERR_POKEACKTIMEOUT 0x400b
-#define DMLERR_POSTMSG_FAILED 0x400c
-#define DMLERR_REENTRANCY 0x400d
-#define DMLERR_SERVER_DIED 0x400e
-#define DMLERR_SYS_ERROR 0x400f
-#define DMLERR_UNADVACKTIMEOUT 0x4010
-#define DMLERR_UNFOUND_QUEUE_ID 0x4011
-
-#define DMLERR_LAST 0x4011
-
-HSZ DdeCreateStringHandle(ULONG idInst, PSZ pStr, int iCodePage);
-ULONG DdeQueryString(ULONG idInst, HSZ hsz, PSZ pStr, ULONG cchMax,
- int iCodePage);
-BOOL DdeFreeStringHandle(ULONG idInst, HSZ hsz);
-BOOL DdeKeepStringHandle(ULONG idInst, HSZ hsz);
-int DdeCmpStringHandles(HSZ hsz1, HSZ hsz2);
-
-
-
-/* von OS/2 nicht unterstuetzte Win3.1 Clipboard-Formate */
-
-#define CF_NOTSUPPORTED_BASE 0xff00
-
-#ifndef CF_DIB
-#define CF_DIB CF_NOTSUPPORTED_BASE+1
-#endif
-
-#ifndef CF_DIF
-#define CF_DIF CF_NOTSUPPORTED_BASE+2
-#endif
-
-#ifndef CF_DSPMETAFILEPICT
-#define CF_DSPMETAFILEPICT CF_NOTSUPPORTED_BASE+3
-#endif
-
-#ifndef CF_METAFILEPICT
-#define CF_METAFILEPICT CF_NOTSUPPORTED_BASE+4
-#endif
-
-#ifndef CF_OEMTEXT
-#define CF_OEMTEXT CF_NOTSUPPORTED_BASE+5
-#endif
-
-#ifndef CF_OWNERDISPLAY
-#define CF_OWNERDISPLAY CF_NOTSUPPORTED_BASE+6
-#endif
-
-#ifndef CF_PENDATA
-#define CF_PENDATA CF_NOTSUPPORTED_BASE+7
-#endif
-
-#ifndef CF_RIFF
-#define CF_RIFF CF_NOTSUPPORTED_BASE+8
-#endif
-
-#ifndef CF_SYLK
-#define CF_SYLK CF_NOTSUPPORTED_BASE+9
-#endif
-
-#ifndef CF_TIFF
-#define CF_TIFF CF_NOTSUPPORTED_BASE+10
-#endif
-
-#ifndef CF_WAVE
-#define CF_WAVE CF_NOTSUPPORTED_BASE+11
-#endif
-
-
-#endif /* _DDEML_HXX */
diff --git a/svtools/source/svdde/ddestrg.cxx b/svtools/source/svdde/ddestrg.cxx
deleted file mode 100644
index 40af3b1cbc27..000000000000
--- a/svtools/source/svdde/ddestrg.cxx
+++ /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: ddestrg.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#define UNICODE
-
-#include "ddeimp.hxx"
-#include <svtools/svdde.hxx>
-
-#if defined( WIN ) && defined( MSC )
-#pragma code_seg( "SVDDE_MISC_CODE" )
-#endif
-
-// --- DdeString::DdeString() --------------------------------------
-
-DdeString::DdeString( DWORD hDdeInst, const sal_Unicode* p ) :
- String( p )
-{
- hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)p, CP_WINUNICODE );
- hInst = hDdeInst;
-}
-
-// --- DdeString::DdeString() --------------------------------------
-
-DdeString::DdeString( DWORD hDdeInst, const String& r) :
- String( r )
-{
- hString = DdeCreateStringHandle( hDdeInst, (LPTSTR)r.GetBuffer(), CP_WINUNICODE );
- hInst = hDdeInst;
-}
-
-// --- DdeString::~DdeString() -------------------------------------
-
-DdeString::~DdeString()
-{
- if ( hString )
- DdeFreeStringHandle( hInst, hString );
-}
-
-// --- DdeString::operator==() -------------------------------------
-
-int DdeString::operator==( HSZ h )
-{
- return( !DdeCmpStringHandles( hString, h ) );
-}
-
-// --- DdeString::operator HSZ() -----------------------------------
-
-DdeString::operator HSZ()
-{
- return hString;
-}
diff --git a/svtools/source/svdde/ddesvr.cxx b/svtools/source/svdde/ddesvr.cxx
deleted file mode 100644
index a2124548b4c8..000000000000
--- a/svtools/source/svdde/ddesvr.cxx
+++ /dev/null
@@ -1,1107 +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: ddesvr.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#define UNICODE
-#include "ddeimp.hxx"
-#include <svtools/svdde.hxx>
-#include <svtools/svarray.hxx>
-#include <tools/debug.hxx>
-#include <osl/thread.h>
-
-//static long hCurConv = 0;
-//static DWORD hDdeInst = NULL;
-//static short nInstance = 0;
-//static DdeServices* pServices;
-
-enum DdeItemType
-{
- DDEITEM,
- DDEGETPUTITEM
-};
-
-struct DdeItemImpData
-{
- ULONG nHCnv;
- USHORT nCnt;
-
- DdeItemImpData( ULONG nH ) : nHCnv( nH ), nCnt( 1 ) {}
-};
-
-SV_DECL_VARARR( DdeItemImp, DdeItemImpData, 1, 1 )
-SV_IMPL_VARARR( DdeItemImp, DdeItemImpData )
-
-// --- DdeInternat::SvrCallback() ----------------------------------
-
-#ifdef WNT
-HDDEDATA CALLBACK DdeInternal::SvrCallback(
- WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
- HDDEDATA hData, DWORD, DWORD )
-#else
-#if defined ( MTW ) || ( defined ( GCC ) && defined ( OS2 )) || defined( ICC )
-HDDEDATA CALLBACK __EXPORT DdeInternal::SvrCallback(
- WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
- HDDEDATA hData, DWORD, DWORD )
-#else
-HDDEDATA CALLBACK _export DdeInternal::SvrCallback(
- WORD nCode, WORD nCbType, HCONV hConv, HSZ hText1, HSZ hText2,
- HDDEDATA hData, DWORD, DWORD )
-#endif
-#endif
-{
- DdeServices& rAll = DdeService::GetServices();
- DdeService* pService;
- DdeTopic* pTopic;
- DdeItem* pItem;
- DdeData* pData;
- Conversation* pC;
-
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
-
- switch( nCode )
- {
- case XTYP_WILDCONNECT:
- {
- int nTopics = 0;
-
-#if 1
- TCHAR chTopicBuf[250];
- if( hText1 )
- DdeQueryString( pInst->hDdeInstSvr, hText1, chTopicBuf,
- sizeof(chTopicBuf)/sizeof(TCHAR), CP_WINUNICODE );
-
- for( pService = rAll.First();pService;pService = rAll.Next() )
- {
- if ( !hText2 || ( *pService->pName == hText2 ) )
- {
- String sTopics( pService->Topics() );
- if( sTopics.Len() )
- {
- if( hText1 )
- {
- USHORT n = 0;
- while( STRING_NOTFOUND != n )
- {
- String s( sTopics.GetToken( 0, '\t', n ));
- if( s == reinterpret_cast<const sal_Unicode*>(chTopicBuf) )
- ++nTopics;
- }
- }
- else
- nTopics += sTopics.GetTokenCount( '\t' );
- }
- }
- }
-
-#else
- for( pService = rAll.First();pService;pService = rAll.Next() )
- {
- if ( !hText2 || ( *pService->pName == hText2 ) )
- {
- for( pTopic = pService->aTopics.First(); pTopic;
- pTopic = pService->aTopics.Next() )
- {
- if ( !hText1 || (*pTopic->pName == hText1) )
- nTopics++;
- }
- }
- }
-#endif
- if( !nTopics )
- return (HDDEDATA)NULL;
-
- HSZPAIR* pPairs = new HSZPAIR [nTopics + 1];
- if ( !pPairs )
- return (HDDEDATA)NULL;
-
- HSZPAIR* q = pPairs;
- for( pService = rAll.First(); pService; pService = rAll.Next() )
- {
- if ( !hText2 || (*pService->pName == hText2 ) )
- {
-#if 0
- for ( pTopic = pService->aTopics.First(); pTopic;
- pTopic = pService->aTopics.Next() )
- {
- if ( !hText1 || (*pTopic->pName == hText1) )
- {
- q->hszSvc = *pService->pName;
- q->hszTopic = *pTopic->pName;
- q++;
- }
- }
-#else
- String sTopics( pService->Topics() );
- USHORT n = 0;
- while( STRING_NOTFOUND != n )
- {
- String s( sTopics.GetToken( 0, '\t', n ));
- s.EraseAllChars( '\n' ).EraseAllChars( '\r' );
- if( !hText1 || s == reinterpret_cast<const sal_Unicode*>(chTopicBuf) )
- {
- DdeString aDStr( pInst->hDdeInstSvr, s );
- pTopic = FindTopic( *pService, (HSZ)aDStr );
- if( pTopic )
- {
- q->hszSvc = *pService->pName;
- q->hszTopic = *pTopic->pName;
- q++;
- }
- }
- }
-
-#endif
- }
- }
-
- q->hszSvc = NULL;
- q->hszTopic = NULL;
- HDDEDATA h = DdeCreateDataHandle(
- pInst->hDdeInstSvr, (LPBYTE) pPairs,
- sizeof(HSZPAIR) * (nTopics+1),
- 0, NULL, nCbType, 0);
- delete pPairs;
- return h;
- }
-
- case XTYP_CONNECT:
- pService = FindService( hText2 );
- if ( pService)
- pTopic = FindTopic( *pService, hText1 );
- else
- pTopic = NULL;
- if ( pTopic )
- return (HDDEDATA)DDE_FACK;
- else
- return (HDDEDATA) NULL;
-
- case XTYP_CONNECT_CONFIRM:
- pService = FindService( hText2 );
- if ( pService )
- {
- pTopic = FindTopic( *pService, hText1 );
- if ( pTopic )
- {
- pTopic->Connect( (long) hConv );
- pC = new Conversation;
- pC->hConv = hConv;
- pC->pTopic = pTopic;
- pService->pConv->Insert( pC );
- }
- }
- return (HDDEDATA)NULL;
- }
-
- for ( pService = rAll.First(); pService; pService = rAll.Next() )
- {
- for( pC = pService->pConv->First(); pC;
- pC = pService->pConv->Next() )
- {
- if ( pC->hConv == hConv )
- goto found;
- }
- }
-
- return (HDDEDATA) DDE_FNOTPROCESSED;
-
-found:
- if ( nCode == XTYP_DISCONNECT)
- {
- pC->pTopic->_Disconnect( (long) hConv );
- pService->pConv->Remove( pC );
- delete pC;
- return (HDDEDATA)NULL;
- }
-
- BOOL bExec = BOOL(nCode == XTYP_EXECUTE);
- pTopic = pC->pTopic;
- if ( pTopic && !bExec )
- pItem = FindItem( *pTopic, hText2 );
- else
- pItem = NULL;
-
- if ( !bExec && !pService->HasCbFormat( nCbType ) )
- pItem = NULL;
- if ( !pItem && !bExec )
- return (HDDEDATA)DDE_FNOTPROCESSED;
- if ( pItem )
- pTopic->aItem = pItem->GetName();
- else
- pTopic->aItem.Erase();
-
- BOOL bRes = FALSE;
- pInst->hCurConvSvr = (long)hConv;
- switch( nCode )
- {
- case XTYP_REQUEST:
- case XTYP_ADVREQ:
- {
- String aRes; // darf erst am Ende freigegeben werden!!
- if ( pTopic->IsSystemTopic() )
- {
- if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_TOPICS) )
- aRes = pService->Topics();
- else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_SYSITEMS) )
- aRes = pService->SysItems();
- else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_STATUS) )
- aRes = pService->Status();
- else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_FORMATS) )
- aRes = pService->Formats();
- else if ( pTopic->aItem == reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_HELP) )
- aRes = pService->GetHelp();
- else
- aRes = pService->SysTopicGet( pTopic->aItem );
-
- if ( aRes.Len() )
- pData = new DdeData( aRes );
- else
- pData = NULL;
- }
- else if( DDEGETPUTITEM == pItem->nType )
- pData = ((DdeGetPutItem*)pItem)->Get(
- DdeData::GetInternalFormat( nCbType ) );
- else
- pData = pTopic->Get( DdeData::GetInternalFormat( nCbType ));
-
- if ( pData )
- return DdeCreateDataHandle( pInst->hDdeInstSvr,
- (LPBYTE)pData->pImp->pData,
- pData->pImp->nData,
- 0, hText2,
- DdeData::GetExternalFormat(
- pData->pImp->nFmt ),
- 0 );
- }
- break;
-
- case XTYP_POKE:
- if ( !pTopic->IsSystemTopic() )
- {
- DdeData d;
- d.pImp->hData = hData;
- d.pImp->nFmt = DdeData::GetInternalFormat( nCbType );
- d.Lock();
- if( DDEGETPUTITEM == pItem->nType )
- bRes = ((DdeGetPutItem*)pItem)->Put( &d );
- else
- bRes = pTopic->Put( &d );
- }
- pInst->hCurConvSvr = NULL;
- if ( bRes )
- return (HDDEDATA)DDE_FACK;
- else
- return (HDDEDATA) DDE_FNOTPROCESSED;
-
- case XTYP_ADVSTART:
- {
- // wird das Item zum erstenmal ein HotLink ?
- if( !pItem->pImpData && pTopic->StartAdviseLoop() )
- {
- // dann wurde das Item ausgewechselt
- pTopic->aItems.Remove( pItem );
- DdeItem* pTmp;
- for( pTmp = pTopic->aItems.First(); pTmp;
- pTmp = pTopic->aItems.Next() )
- if( *pTmp->pName == hText2 )
- {
- // es wurde tatsaechlich ausgewechselt
- delete pItem;
- pItem = 0;
- break;
- }
- if( pItem )
- // es wurde doch nicht ausgewechselt, also wieder rein
- pTopic->aItems.Insert( pItem );
- else
- pItem = pTmp;
- }
- pItem->IncMonitor( (long)hConv );
- pInst->hCurConvSvr = NULL;
- }
- return (HDDEDATA)TRUE;
-
- case XTYP_ADVSTOP:
- pItem->DecMonitor( (long)hConv );
- if( !pItem->pImpData )
- pTopic->StopAdviseLoop();
- pInst->hCurConvSvr = NULL;
- return (HDDEDATA)TRUE;
-
- case XTYP_EXECUTE:
- {
- DdeData aExec;
- aExec.pImp->hData = hData;
- aExec.pImp->nFmt = DdeData::GetInternalFormat( nCbType );
- aExec.Lock();
- String aName;
-
- aName = (const sal_Unicode *)aExec.pImp->pData;
-
- if( pTopic->IsSystemTopic() )
- bRes = pService->SysTopicExecute( &aName );
- else
- bRes = pTopic->Execute( &aName );
- }
- pInst->hCurConvSvr = NULL;
- if ( bRes )
- return (HDDEDATA)DDE_FACK;
- else
- return (HDDEDATA)DDE_FNOTPROCESSED;
- }
-
- return (HDDEDATA)NULL;
-}
-
-// --- DdeInternat::FindService() ----------------------------------
-
-DdeService* DdeInternal::FindService( HSZ hService )
-{
- DdeService* s;
- DdeServices& rSvc = DdeService::GetServices();
- for ( s = rSvc.First(); s; s = rSvc.Next() )
- {
- if ( *s->pName == hService )
- return s;
- }
-
- return NULL;
-}
-
-// --- DdeInternat::FindTopic() ------------------------------------
-
-DdeTopic* DdeInternal::FindTopic( DdeService& rService, HSZ hTopic )
-{
- DdeTopic* s;
- DdeTopics& rTopics = rService.aTopics;
- int bWeiter = FALSE;
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
-
- do { // middle check loop
- for ( s = rTopics.First(); s; s = rTopics.Next() )
- {
- if ( *s->pName == hTopic )
- return s;
- }
-
- bWeiter = !bWeiter;
- if( !bWeiter )
- break;
-
- // dann befragen wir doch mal unsere Ableitung:
- TCHAR chBuf[250];
- DdeQueryString(pInst->hDdeInstSvr,hTopic,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE );
- bWeiter = rService.MakeTopic( reinterpret_cast<const sal_Unicode*>(chBuf) );
- // dann muessen wir noch mal suchen
- } while( bWeiter );
-
- return 0;
-}
-
-// --- DdeInternal::FindItem() -------------------------------------
-
-DdeItem* DdeInternal::FindItem( DdeTopic& rTopic, HSZ hItem )
-{
- DdeItem* s;
- DdeItems& rItems = rTopic.aItems;
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- int bWeiter = FALSE;
-
- do { // middle check loop
-
- for ( s = rItems.First(); s; s = rItems.Next() )
- if ( *s->pName == hItem )
- return s;
-
- bWeiter = !bWeiter;
- if( !bWeiter )
- break;
-
- // dann befragen wir doch mal unsere Ableitung:
- TCHAR chBuf[250];
- DdeQueryString(pInst->hDdeInstSvr,hItem,chBuf,sizeof(chBuf)/sizeof(TCHAR),CP_WINUNICODE );
- bWeiter = rTopic.MakeItem( reinterpret_cast<const sal_Unicode*>(chBuf) );
- // dann muessen wir noch mal suchen
- } while( bWeiter );
-
- return 0;
-}
-
-// --- DdeService::DdeService() ------------------------------------
-
-DdeService::DdeService( const String& rService )
-{
- DdeInstData* pInst = ImpGetInstData();
- if( !pInst )
- pInst = ImpInitInstData();
- pInst->nRefCount++;
- pInst->nInstanceSvr++;
-
- if ( !pInst->hDdeInstSvr )
- {
- nStatus = sal::static_int_cast< short >(
- DdeInitialize( &pInst->hDdeInstSvr,
- (PFNCALLBACK)DdeInternal::SvrCallback,
- APPCLASS_STANDARD |
- CBF_SKIP_REGISTRATIONS |
- CBF_SKIP_UNREGISTRATIONS, 0L ) );
- pInst->pServicesSvr = new DdeServices;
- }
- else
- nStatus = DMLERR_NO_ERROR;
-
- pConv = new ConvList;
-
- if ( pInst->pServicesSvr )
- pInst->pServicesSvr->Insert( this );
-
- pName = new DdeString( pInst->hDdeInstSvr, rService );
- if ( nStatus == DMLERR_NO_ERROR )
- if ( !DdeNameService( pInst->hDdeInstSvr, *pName, NULL,
- DNS_REGISTER | DNS_FILTEROFF ) )
- nStatus = DMLERR_SYS_ERROR;
-
- AddFormat( FORMAT_STRING );
- pSysTopic = new DdeTopic( reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) );
- pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_TOPICS) ) );
- pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_SYSITEMS) ) );
- pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_STATUS) ) );
- pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_FORMATS) ) );
- pSysTopic->AddItem( DdeItem( reinterpret_cast<const sal_Unicode*>(SZDDESYS_ITEM_HELP) ) );
- AddTopic( *pSysTopic );
-}
-
-// --- DdeService::~DdeService() -----------------------------------
-
-DdeService::~DdeService()
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- if ( pInst->pServicesSvr )
- pInst->pServicesSvr->Remove( this );
-
- // MT: Im Auftrage des Herrn (AM) auskommentiert...
- // Grund:
- // Bei Client/Server werden die Server nicht beendet, wenn mehr
- // als einer gestartet.
- // Weil keine System-Messagequeue ?!
-
- delete pSysTopic;
- delete pName;
-
- pInst->nInstanceSvr--;
- pInst->nRefCount--;
- if ( !pInst->nInstanceSvr && pInst->hDdeInstSvr )
- {
- if( DdeUninitialize( pInst->hDdeInstSvr ) )
- {
- pInst->hDdeInstSvr = NULL;
- delete pInst->pServicesSvr;
- pInst->pServicesSvr = NULL;
- if( pInst->nRefCount == 0)
- ImpDeinitInstData();
- }
- }
- delete pConv;
-}
-
-// --- DdeService::GetName() ---------------------------------------
-
-const String& DdeService::GetName() const
-{
- return *pName;
-}
-
-// --- DdeService::GetServices() -----------------------------------
-
-DdeServices& DdeService::GetServices()
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- return *(pInst->pServicesSvr);
-}
-
-// --- DdeService::AddTopic() --------------------------------------
-
-void DdeService::AddTopic( const DdeTopic& rTopic )
-{
- RemoveTopic( rTopic );
- aTopics.Insert( (DdeTopic*) &rTopic );
-}
-
-// --- DdeService::RemoveTopic() -----------------------------------
-
-void DdeService::RemoveTopic( const DdeTopic& rTopic )
-{
- DdeTopic* t;
- for ( t = aTopics.First(); t; t = aTopics.Next() )
- {
- if ( !DdeCmpStringHandles (*t->pName, *rTopic.pName ) )
- {
- aTopics.Remove( t );
- // JP 27.07.95: und alle Conversions loeschen !!!
- // (sonst wird auf geloeschten Topics gearbeitet!!)
- for( ULONG n = pConv->Count(); n; )
- {
- Conversation* pC = pConv->GetObject( --n );
- if( pC->pTopic == &rTopic )
- {
- pConv->Remove( pC );
- delete pC;
- }
- }
- break;
- }
- }
-}
-
-// --- DdeService::HasCbFormat() -----------------------------------
-
-BOOL DdeService::HasCbFormat( USHORT nFmt )
-{
- return BOOL( aFormats.GetPos( nFmt ) != LIST_ENTRY_NOTFOUND );
-}
-
-// --- DdeService::HasFormat() -------------------------------------
-
-BOOL DdeService::HasFormat( ULONG nFmt )
-{
- return HasCbFormat( (USHORT)DdeData::GetExternalFormat( nFmt ));
-}
-
-// --- DdeService::AddFormat() -------------------------------------
-
-void DdeService::AddFormat( ULONG nFmt )
-{
- nFmt = DdeData::GetExternalFormat( nFmt );
- aFormats.Remove( nFmt );
- aFormats.Insert( nFmt );
-}
-
-// --- DdeService::RemoveFormat() ----------------------------------
-
-void DdeService::RemoveFormat( ULONG nFmt )
-{
- aFormats.Remove( DdeData::GetExternalFormat( nFmt ) );
-}
-
-// --- DdeTopic::DdeTopic() ----------------------------------------
-
-DdeTopic::DdeTopic( const String& rName )
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- pName = new DdeString( pInst->hDdeInstSvr, rName );
-}
-
-// --- DdeTopic::~DdeTopic() ---------------------------------------
-
-DdeTopic::~DdeTopic()
-{
- DdeItem* t;
- while( ( t = aItems.First() ) != NULL )
- {
- aItems.Remove( t );
- t->pMyTopic = 0;
- delete t;
- }
- delete pName;
-}
-
-// --- DdeTopic::GetName() -----------------------------------------
-
-const String& DdeTopic::GetName() const
-{
- return *pName;
-}
-
-// --- DdeTopic::IsSystemTopic() -----------------------------------
-
-BOOL DdeTopic::IsSystemTopic()
-{
- return BOOL (GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC));
-}
-
-// --- DdeTopic::AddItem() -----------------------------------------
-
-DdeItem* DdeTopic::AddItem( const DdeItem& r )
-{
- DdeItem* s;
- if( DDEGETPUTITEM == r.nType )
- s = new DdeGetPutItem( r );
- else
- s = new DdeItem( r );
- if ( s )
- {
- aItems.Insert( s );
- s->pMyTopic = this;
- }
- return s;
-}
-
-// --- DdeTopic::InsertItem() -----------------------------------------
-
-void DdeTopic::InsertItem( DdeItem* pNew )
-{
- if( pNew )
- {
- aItems.Insert( pNew );
- pNew->pMyTopic = this;
- }
-}
-
-// --- DdeTopic::RemoveItem() --------------------------------------
-
-void DdeTopic::RemoveItem( const DdeItem& r )
-{
- DdeItem* s;
- for ( s = aItems.First(); s; s = aItems.Next() )
- {
- if ( !DdeCmpStringHandles (*s->pName, *r.pName ) )
- break;
- }
-
- if ( s )
- {
- aItems.Remove( s );
- s->pMyTopic = 0;
- delete s;
- }
-}
-
-// --- DdeTopic::NotifyClient() ------------------------------------
-
-void DdeTopic::NotifyClient( const String& rItem )
-{
- DdeItem* pItem;
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- for ( pItem = aItems.First(); pItem; pItem = aItems.Next() )
- {
- if ( pItem->GetName() == rItem )
- {
- if ( pItem->pImpData )
- DdePostAdvise( pInst->hDdeInstSvr, *pName, *pItem->pName );
- }
- break;
- }
-}
-
-// --- DdeTopic::Connect() -----------------------------------------
-
-void __EXPORT DdeTopic::Connect( long nId )
-{
- aConnectLink.Call( (void*)nId );
-}
-
-// --- DdeTopic::Disconnect() --------------------------------------
-
-void __EXPORT DdeTopic::Disconnect( long nId )
-{
- aDisconnectLink.Call( (void*)nId );
-}
-
-// --- DdeTopic::_Disconnect() --------------------------------------
-
-void __EXPORT DdeTopic::_Disconnect( long nId )
-{
- for( DdeItem* pItem = aItems.First(); pItem; pItem = aItems.Next() )
- pItem->DecMonitor( nId );
-
- Disconnect( nId );
-}
-
-// --- DdeTopic::Get() ---------------------------------------------
-
-DdeData* __EXPORT DdeTopic::Get( ULONG nFmt )
-{
- if ( aGetLink.IsSet() )
- return (DdeData*)aGetLink.Call( (void*)nFmt );
- else
- return NULL;
-}
-
-// --- DdeTopic::Put() ---------------------------------------------
-
-BOOL __EXPORT DdeTopic::Put( const DdeData* r )
-{
- if ( aPutLink.IsSet() )
- return (BOOL)aPutLink.Call( (void*) r );
- else
- return FALSE;
-}
-
-// --- DdeTopic::Execute() -----------------------------------------
-
-BOOL __EXPORT DdeTopic::Execute( const String* r )
-{
- if ( aExecLink.IsSet() )
- return (BOOL)aExecLink.Call( (void*)r );
- else
- return FALSE;
-}
-
-// --- DdeTopic::GetConvId() ---------------------------------------
-
-long DdeTopic::GetConvId()
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- return pInst->hCurConvSvr;
-}
-
-// --- DdeTopic::StartAdviseLoop() ---------------------------------
-
-BOOL DdeTopic::StartAdviseLoop()
-{
- return FALSE;
-}
-
-// --- DdeTopic::StopAdviseLoop() ----------------------------------
-
-BOOL DdeTopic::StopAdviseLoop()
-{
- return FALSE;
-}
-
-// --- DdeItem::DdeItem() ------------------------------------------
-
-DdeItem::DdeItem( const sal_Unicode* p )
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- pName = new DdeString( pInst->hDdeInstSvr, p );
- nType = DDEITEM;
- pMyTopic = 0;
- pImpData = 0;
-}
-
-// --- DdeItem::DdeItem() ------------------------------------------
-
-DdeItem::DdeItem( const String& r)
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- pName = new DdeString( pInst->hDdeInstSvr, r );
- nType = DDEITEM;
- pMyTopic = 0;
- pImpData = 0;
-}
-
-// --- DdeItem::DdeItem() ------------------------------------------
-
-DdeItem::DdeItem( const DdeItem& r)
-{
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- pName = new DdeString( pInst->hDdeInstSvr, *r.pName );
- nType = DDEITEM;
- pMyTopic = 0;
- pImpData = 0;
-}
-
-// --- DdeItem::~DdeItem() -----------------------------------------
-
-DdeItem::~DdeItem()
-{
- if( pMyTopic )
- pMyTopic->aItems.Remove( this );
- delete pName;
- delete pImpData;
-}
-
-// --- DdeItem::GetName() ------------------------------------------
-
-const String& DdeItem::GetName() const
-{
- return *pName;
-}
-
-// --- DdeItem::NotifyClient() ------------------------------------------
-
-void DdeItem::NotifyClient()
-{
- if( pMyTopic && pImpData )
- {
- DdeInstData* pInst = ImpGetInstData();
- DBG_ASSERT(pInst,"SVDDE:No instance data");
- DdePostAdvise( pInst->hDdeInstSvr, *pMyTopic->pName, *pName );
- }
-}
-
-// --- DdeItem::IncMonitor() ------------------------------------------
-
-void DdeItem::IncMonitor( ULONG nHCnv )
-{
- if( !pImpData )
- {
- pImpData = new DdeItemImp;
- if( DDEGETPUTITEM == nType )
- ((DdeGetPutItem*)this)->AdviseLoop( TRUE );
- }
- else
- {
- for( USHORT n = pImpData->Count(); n; )
- if( (*pImpData)[ --n ].nHCnv == nHCnv )
- {
- ++(*pImpData)[ n ].nHCnv;
- return ;
- }
- }
-
- pImpData->Insert( DdeItemImpData( nHCnv ), pImpData->Count() );
-}
-
-// --- DdeItem::DecMonitor() ------------------------------------------
-
-void DdeItem::DecMonitor( ULONG nHCnv )
-{
- if( pImpData )
- {
- DdeItemImpData* pData = (DdeItemImpData*)pImpData->GetData();
- for( USHORT n = pImpData->Count(); n; --n, ++pData )
- if( pData->nHCnv == nHCnv )
- {
- if( !pData->nCnt || !--pData->nCnt )
- {
- if( 1 < pImpData->Count() )
- pImpData->Remove( pImpData->Count() - n );
- else
- {
- delete pImpData, pImpData = 0;
- if( DDEGETPUTITEM == nType )
- ((DdeGetPutItem*)this)->AdviseLoop( FALSE );
- }
- }
- return ;
- }
- }
-}
-
-// --- DdeItem::GetLinks() ------------------------------------------
-
-short DdeItem::GetLinks()
-{
- short nCnt = 0;
- if( pImpData )
- for( USHORT n = pImpData->Count(); n; )
- nCnt = nCnt + (*pImpData)[ --n ].nCnt;
- return nCnt;
-}
-
-// --- DdeGetPutItem::DdeGetPutItem() ------------------------------
-
-DdeGetPutItem::DdeGetPutItem( const sal_Unicode* p )
- : DdeItem( p )
-{
- nType = DDEGETPUTITEM;
-}
-
-// --- DdeGetPutItem::DdeGetPutItem() ------------------------------
-
-DdeGetPutItem::DdeGetPutItem( const String& rStr )
- : DdeItem( rStr )
-{
- nType = DDEGETPUTITEM;
-}
-
-// --- DdeGetPutItem::DdeGetPutItem() ------------------------------
-
-DdeGetPutItem::DdeGetPutItem( const DdeItem& rItem )
- : DdeItem( rItem )
-{
- nType = DDEGETPUTITEM;
-}
-
-
-// --- DdeGetPutData::Get() ----------------------------------------
-
-DdeData* DdeGetPutItem::Get( ULONG )
-{
- return 0;
-}
-
-// --- DdeGetPutData::Put() ----------------------------------------
-
-BOOL DdeGetPutItem::Put( const DdeData* )
-{
- return FALSE;
-}
-
-// --- DdeGetPutData::AdviseLoop() ---------------------------------
-
-void DdeGetPutItem::AdviseLoop( BOOL )
-{
-}
-
-
-// --- DdeService::SysItems() --------------------------------------
-
-String DdeService::SysItems()
-{
- String s;
- DdeTopic* t;
- for ( t = aTopics.First(); t; t = aTopics.Next() )
- {
- if ( t->GetName() == reinterpret_cast<const sal_Unicode*>(SZDDESYS_TOPIC) )
- {
- short n = 0;
- DdeItem* pi;
- for ( pi = t->aItems.First(); pi; pi = t->aItems.Next(), n++ )
- {
- if ( n )
- s += '\t';
- s += pi->GetName();
- }
- s += String::CreateFromAscii("\r\n");
- }
- }
-
- return s;
-}
-
-// --- DdeService::Topics() ----------------------------------------
-
-String DdeService::Topics()
-{
- String s;
- DdeTopic* t;
- short n = 0;
-
- for ( t = aTopics.First(); t; t = aTopics.Next(), n++ )
- {
- if ( n )
- s += '\t';
- s += t->GetName();
- }
- s += String::CreateFromAscii("\r\n");
-
- return s;
-}
-
-// --- DdeService::Formats() ---------------------------------------
-
-String DdeService::Formats()
-{
- String s;
- long f;
- TCHAR buf[128];
- LPCTSTR p;
- short n = 0;
-
- for ( f = aFormats.First(); f; f = aFormats.Next(), n++ )
- {
- if ( n )
- s += '\t';
- p = buf;
-
- switch( (USHORT)f )
- {
- case CF_TEXT:
- p = reinterpret_cast<LPCTSTR>(String::CreateFromAscii("TEXT").GetBuffer());
- break;
- case CF_BITMAP:
- p = reinterpret_cast<LPCTSTR>(String::CreateFromAscii("BITMAP").GetBuffer());
- break;
-#ifdef OS2
- case CF_DSPTEXT:
- p = String::CreateFromAscii("TEXT").GetBuffer();
- break;
- case CF_DSPBITMAP:
- p = String::CreateFromAscii("BITMAP").GetBuffer();
- break;
- case CF_METAFILE:
- p = String::CreateFromAscii("METAFILE").GetBuffer();
- break;
- case CF_DSPMETAFILE:
- p = String::CreateFromAscii("METAFILE").GetBuffer();
- break;
- case CF_PALETTE:
- p = String::CreateFromAscii("PALETTE").GetBuffer();
- break;
- default:
- p= String::CreateFromAscii("PRIVATE").GetBuffer();
-#else
- default:
- GetClipboardFormatName( (UINT)f, buf, sizeof(buf) / sizeof(TCHAR) );
-#endif
- }
- s += String( reinterpret_cast<const sal_Unicode*>(p) );
- }
- s += String::CreateFromAscii("\r\n");
-
- return s;
-}
-
-// --- DdeService::Status() ----------------------------------------
-
-String DdeService::Status()
-{
- return IsBusy() ? String::CreateFromAscii("Busy\r\n") : String::CreateFromAscii("Ready\r\n");
-}
-
-// --- DdeService::IsBusy() ----------------------------------------
-
-BOOL __EXPORT DdeService::IsBusy()
-{
- return FALSE;
-}
-
-// --- DdeService::GetHelp() ----------------------------------------
-
-String __EXPORT DdeService::GetHelp()
-{
- return String();
-}
-
-BOOL DdeTopic::MakeItem( const String& )
-{
- return FALSE;
-}
-
-BOOL DdeService::MakeTopic( const String& )
-{
- return FALSE;
-}
-
-String DdeService::SysTopicGet( const String& )
-{
- return String();
-}
-
-BOOL DdeService::SysTopicExecute( const String* )
-{
- return FALSE;
-}
-
diff --git a/svtools/source/svdde/ddewrap.cxx b/svtools/source/svdde/ddewrap.cxx
deleted file mode 100644
index b0b023ad3a75..000000000000
--- a/svtools/source/svdde/ddewrap.cxx
+++ /dev/null
@@ -1,103 +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: ddewrap.cxx,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.
- *
- ************************************************************************/
-
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#define _SVTOOLS_SVDDE_DDEWRAP_CXX_
-
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include <windows.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-#include "ddewrap.hxx"
-
-//------------------------------------------------------------------------
-
-HSZ WINAPI DdeCreateStringHandleW_9x( DWORD idInst, LPCWSTR pszString, int )
-{
- HSZ hszResult;
- LPSTR pszANSIString;
- int nSize;
-
- nSize = pszString ? WideCharToMultiByte( CP_ACP, 0, pszString, -1, NULL, 0, NULL, NULL ) : 0;
- pszANSIString = nSize ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, nSize * sizeof(CHAR) ) : NULL;
-
- if ( pszANSIString )
- WideCharToMultiByte( CP_ACP, 0, pszString, -1, pszANSIString, nSize, NULL, NULL );
-
- hszResult = DdeCreateStringHandleA( idInst, pszANSIString, CP_WINANSI );
-
- if ( pszANSIString )
- HeapFree( GetProcessHeap(), 0, pszANSIString );
-
- return hszResult;
-}
-
-//------------------------------------------------------------------------
-
-DWORD WINAPI DdeQueryStringW_9x( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int )
-{
- DWORD dwResult;
- LPSTR pszANSIString;
-
- pszANSIString = cchMax ? (LPSTR)HeapAlloc( GetProcessHeap(), 0, cchMax * sizeof(CHAR) ) : NULL;
-
- dwResult = DdeQueryStringA( idInst, hsz, pszANSIString, cchMax, CP_WINANSI );
-
- if ( dwResult && pszANSIString )
- MultiByteToWideChar( CP_ACP, 0, pszANSIString, -1, pszString, cchMax );
-
- if ( pszANSIString )
- HeapFree( GetProcessHeap(), 0, pszANSIString );
-
- return dwResult;
-}
-
-//------------------------------------------------------------------------
-
-UINT WINAPI DdeInitializeW_9x( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes )
-{
- return DdeInitializeA( pidInst, pfnCallback, afCmd, ulRes );
-}
-
-//------------------------------------------------------------------------
-
-#define DEFINE_WAPI_FUNC(func) \
-func##_PROC lpfn##func = (LONG)GetVersion() >= 0 ? func : func##_9x;
-
-
-DEFINE_WAPI_FUNC( DdeCreateStringHandleW );
-DEFINE_WAPI_FUNC( DdeQueryStringW );
-DEFINE_WAPI_FUNC( DdeInitializeW );
-
diff --git a/svtools/source/svdde/ddewrap.hxx b/svtools/source/svdde/ddewrap.hxx
deleted file mode 100644
index 77d012ccbba5..000000000000
--- a/svtools/source/svdde/ddewrap.hxx
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SVTOOLS_SVDDE_DDEWRAP_HXX_
-#define _SVTOOLS_SVDDE_DDEWRAP_HXX_
-
-#define DECLARE_WAPI_FUNC(func) \
- extern func##_PROC lpfn##func;
-
-typedef HSZ (WINAPI *DdeCreateStringHandleW_PROC)( DWORD idInst, LPCWSTR pszString, int iCodePage );
-typedef DWORD (WINAPI *DdeQueryStringW_PROC)( DWORD idInst, HSZ hsz, LPWSTR pszString, DWORD cchMax, int iCodePage );
-typedef UINT (WINAPI *DdeInitializeW_PROC)( LPDWORD pidInst, PFNCALLBACK pfnCallback, DWORD afCmd, DWORD ulRes );
-
-
-DECLARE_WAPI_FUNC( DdeCreateStringHandleW );
-DECLARE_WAPI_FUNC( DdeQueryStringW );
-DECLARE_WAPI_FUNC( DdeInitializeW );
-
-
-#ifndef _SVTOOLS_SVDDE_DDEWRAP_CXX_
-#define DdeCreateStringHandleW lpfnDdeCreateStringHandleW
-#define DdeQueryStringW lpfnDdeQueryStringW
-#define DdeInitializeW lpfnDdeInitializeW
-#endif
-
-
-#endif
diff --git a/svtools/source/svdde/makefile.mk b/svtools/source/svdde/makefile.mk
deleted file mode 100644
index f4c72aff2094..000000000000
--- a/svtools/source/svdde/makefile.mk
+++ /dev/null
@@ -1,64 +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: makefile.mk,v $
-#
-# $Revision: 1.10 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-
-.IF "$(GUIBASE)"=="WIN"
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=svdde
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svt.pmk
-
-# --- Files --------------------------------------------------------
-
-
-SLOFILES= $(SLO)$/ddecli.obj \
- $(SLO)$/ddesvr.obj \
- $(SLO)$/ddedata.obj \
- $(SLO)$/ddestrg.obj \
- $(SLO)$/ddewrap.obj \
- $(SLO)$/ddeinf.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
-.ELSE
-dummy:
- @echo GUI == "$(GUI)" - nothing to do
-
-.ENDIF
-
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index 5b584a37059d..5bb26367075e 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -32,11 +32,11 @@
#include "precompiled_svtools.hxx"
#include <tools/urlobj.hxx>
-#include <svtools/zformat.hxx>
-#include <svtools/macitem.hxx>
+#include <svl/zformat.hxx>
+#include <svl/macitem.hxx>
#include <tools/cachestr.hxx>
#include <vcl/svapp.hxx>
-#include <svtools/zforlist.hxx>
+#include <svl/zforlist.hxx>
#include <svtools/htmlout.hxx>
#include "htmlkywd.hxx"
@@ -44,7 +44,7 @@
#include <svtools/imaprect.hxx>
#include <svtools/imapcirc.hxx>
#include <svtools/imappoly.hxx>
-#include "urihelper.hxx"
+#include "svl/urihelper.hxx"
#ifndef RTL_CONSTASCII_STRINGPARAM
#define RTL_CONSTASCII_STRINGPARAM( c ) c, sizeof(c)-1
diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx
index 11f48e7fdf5d..9103161afb51 100644
--- a/svtools/source/svhtml/htmlsupp.cxx
+++ b/svtools/source/svhtml/htmlsupp.cxx
@@ -36,7 +36,7 @@
#include <tools/urlobj.hxx>
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_ULONGS
-#include <svtools/svstdarr.hxx>
+#include <svl/svstdarr.hxx>
#endif
#include <svtools/parhtml.hxx>
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 215133c8efb4..b4eb6c05cffd 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -40,12 +40,12 @@
#include <rtl/strbuf.hxx>
#ifndef _SVSTDARR_HXX
#define _SVSTDARR_ULONGS
-#include <svtools/svstdarr.hxx>
+#include <svl/svstdarr.hxx>
#endif
#include <tools/tenccvt.hxx>
#include <tools/datetime.hxx>
-#include <svtools/inettype.hxx>
+#include <svl/inettype.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
diff --git a/svtools/source/svrtf/rtfkeywd.hxx b/svtools/source/svrtf/rtfkeywd.hxx
deleted file mode 100644
index f76399ffd824..000000000000
--- a/svtools/source/svrtf/rtfkeywd.hxx
+++ /dev/null
@@ -1,1144 +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: rtfkeywd.hxx,v $
- * $Revision: 1.13.134.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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 _RTFKEYWD_HXX
-#define _RTFKEYWD_HXX
-
-#include "sal/config.h"
-
-#define OOO_STRING_SVTOOLS_RTF_HEXCHAR "\\'"
-#define OOO_STRING_SVTOOLS_RTF_IGNORE "\\*"
-#define OOO_STRING_SVTOOLS_RTF_OPTHYPH "\\-"
-#define OOO_STRING_SVTOOLS_RTF_SUBENTRY "\\:"
-#define OOO_STRING_SVTOOLS_RTF_ABSH "\\absh"
-#define OOO_STRING_SVTOOLS_RTF_ABSW "\\absw"
-#define OOO_STRING_SVTOOLS_RTF_ALT "\\alt"
-#define OOO_STRING_SVTOOLS_RTF_ANNOTATION "\\annotation"
-#define OOO_STRING_SVTOOLS_RTF_ANSI "\\ansi"
-#define OOO_STRING_SVTOOLS_RTF_ATNID "\\atnid"
-#define OOO_STRING_SVTOOLS_RTF_AUTHOR "\\author"
-#define OOO_STRING_SVTOOLS_RTF_B "\\b"
-#define OOO_STRING_SVTOOLS_RTF_BGBDIAG "\\bgbdiag"
-#define OOO_STRING_SVTOOLS_RTF_BGCROSS "\\bgcross"
-#define OOO_STRING_SVTOOLS_RTF_BGDCROSS "\\bgdcross"
-#define OOO_STRING_SVTOOLS_RTF_BGDKBDIAG "\\bgdkbdiag"
-#define OOO_STRING_SVTOOLS_RTF_BGDKCROSS "\\bgdkcross"
-#define OOO_STRING_SVTOOLS_RTF_BGDKDCROSS "\\bgdkdcross"
-#define OOO_STRING_SVTOOLS_RTF_BGDKFDIAG "\\bgdkfdiag"
-#define OOO_STRING_SVTOOLS_RTF_BGDKHORIZ "\\bgdkhoriz"
-#define OOO_STRING_SVTOOLS_RTF_BGDKVERT "\\bgdkvert"
-#define OOO_STRING_SVTOOLS_RTF_BGFDIAG "\\bgfdiag"
-#define OOO_STRING_SVTOOLS_RTF_BGHORIZ "\\bghoriz"
-#define OOO_STRING_SVTOOLS_RTF_BGVERT "\\bgvert"
-#define OOO_STRING_SVTOOLS_RTF_BIN "\\bin"
-#define OOO_STRING_SVTOOLS_RTF_BINFSXN "\\binfsxn"
-#define OOO_STRING_SVTOOLS_RTF_BINSXN "\\binsxn"
-#define OOO_STRING_SVTOOLS_RTF_BKMKCOLF "\\bkmkcolf"
-#define OOO_STRING_SVTOOLS_RTF_BKMKCOLL "\\bkmkcoll"
-#define OOO_STRING_SVTOOLS_RTF_BKMKEND "\\bkmkend"
-#define OOO_STRING_SVTOOLS_RTF_BKMKSTART "\\bkmkstart"
-#define OOO_STRING_SVTOOLS_RTF_BLUE "\\blue"
-#define OOO_STRING_SVTOOLS_RTF_BOX "\\box"
-#define OOO_STRING_SVTOOLS_RTF_BRDRB "\\brdrb"
-#define OOO_STRING_SVTOOLS_RTF_BRDRBAR "\\brdrbar"
-#define OOO_STRING_SVTOOLS_RTF_BRDRBTW "\\brdrbtw"
-#define OOO_STRING_SVTOOLS_RTF_BRDRCF "\\brdrcf"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDB "\\brdrdb"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDOT "\\brdrdot"
-#define OOO_STRING_SVTOOLS_RTF_BRDRHAIR "\\brdrhair"
-#define OOO_STRING_SVTOOLS_RTF_BRDRL "\\brdrl"
-#define OOO_STRING_SVTOOLS_RTF_BRDRR "\\brdrr"
-#define OOO_STRING_SVTOOLS_RTF_BRDRS "\\brdrs"
-#define OOO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh"
-#define OOO_STRING_SVTOOLS_RTF_BRDRT "\\brdrt"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTH "\\brdrth"
-#define OOO_STRING_SVTOOLS_RTF_BRDRW "\\brdrw"
-#define OOO_STRING_SVTOOLS_RTF_BRSP "\\brsp"
-#define OOO_STRING_SVTOOLS_RTF_BULLET "\\bullet"
-#define OOO_STRING_SVTOOLS_RTF_BUPTIM "\\buptim"
-#define OOO_STRING_SVTOOLS_RTF_BXE "\\bxe"
-#define OOO_STRING_SVTOOLS_RTF_CAPS "\\caps"
-#define OOO_STRING_SVTOOLS_RTF_CB "\\cb"
-#define OOO_STRING_SVTOOLS_RTF_CBPAT "\\cbpat"
-#define OOO_STRING_SVTOOLS_RTF_CELL "\\cell"
-#define OOO_STRING_SVTOOLS_RTF_CELLX "\\cellx"
-#define OOO_STRING_SVTOOLS_RTF_CF "\\cf"
-#define OOO_STRING_SVTOOLS_RTF_CFPAT "\\cfpat"
-#define OOO_STRING_SVTOOLS_RTF_CHATN "\\chatn"
-#define OOO_STRING_SVTOOLS_RTF_CHDATE "\\chdate"
-#define OOO_STRING_SVTOOLS_RTF_CHDPA "\\chdpa"
-#define OOO_STRING_SVTOOLS_RTF_CHDPL "\\chdpl"
-#define OOO_STRING_SVTOOLS_RTF_CHFTN "\\chftn"
-#define OOO_STRING_SVTOOLS_RTF_CHFTNSEP "\\chftnsep"
-#define OOO_STRING_SVTOOLS_RTF_CHFTNSEPC "\\chftnsepc"
-#define OOO_STRING_SVTOOLS_RTF_CHPGN "\\chpgn"
-#define OOO_STRING_SVTOOLS_RTF_CHTIME "\\chtime"
-#define OOO_STRING_SVTOOLS_RTF_CLBGBDIAG "\\clbgbdiag"
-#define OOO_STRING_SVTOOLS_RTF_CLBGCROSS "\\clbgcross"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDCROSS "\\clbgdcross"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDKBDIAG "\\clbgdkbdiag"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDKCROSS "\\clbgdkcross"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDKDCROSS "\\clbgdkdcross"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDKFDIAG "\\clbgdkfdiag"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDKHOR "\\clbgdkhor"
-#define OOO_STRING_SVTOOLS_RTF_CLBGDKVERT "\\clbgdkvert"
-#define OOO_STRING_SVTOOLS_RTF_CLBGFDIAG "\\clbgfdiag"
-#define OOO_STRING_SVTOOLS_RTF_CLBGHORIZ "\\clbghoriz"
-#define OOO_STRING_SVTOOLS_RTF_CLBGVERT "\\clbgvert"
-#define OOO_STRING_SVTOOLS_RTF_CLBRDRB "\\clbrdrb"
-#define OOO_STRING_SVTOOLS_RTF_CLBRDRL "\\clbrdrl"
-#define OOO_STRING_SVTOOLS_RTF_CLBRDRR "\\clbrdrr"
-#define OOO_STRING_SVTOOLS_RTF_CLBRDRT "\\clbrdrt"
-#define OOO_STRING_SVTOOLS_RTF_CLCBPAT "\\clcbpat"
-#define OOO_STRING_SVTOOLS_RTF_CLCFPAT "\\clcfpat"
-#define OOO_STRING_SVTOOLS_RTF_CLMGF "\\clmgf"
-#define OOO_STRING_SVTOOLS_RTF_CLMRG "\\clmrg"
-#define OOO_STRING_SVTOOLS_RTF_CLSHDNG "\\clshdng"
-#define OOO_STRING_SVTOOLS_RTF_COLNO "\\colno"
-#define OOO_STRING_SVTOOLS_RTF_COLORTBL "\\colortbl"
-#define OOO_STRING_SVTOOLS_RTF_COLS "\\cols"
-#define OOO_STRING_SVTOOLS_RTF_COLSR "\\colsr"
-#define OOO_STRING_SVTOOLS_RTF_COLSX "\\colsx"
-#define OOO_STRING_SVTOOLS_RTF_COLUMN "\\column"
-#define OOO_STRING_SVTOOLS_RTF_COLW "\\colw"
-#define OOO_STRING_SVTOOLS_RTF_COMMENT "\\comment"
-#define OOO_STRING_SVTOOLS_RTF_CREATIM "\\creatim"
-#define OOO_STRING_SVTOOLS_RTF_CTRL "\\ctrl"
-#define OOO_STRING_SVTOOLS_RTF_DEFF "\\deff"
-#define OOO_STRING_SVTOOLS_RTF_DEFFORMAT "\\defformat"
-#define OOO_STRING_SVTOOLS_RTF_DEFLANG "\\deflang"
-#define OOO_STRING_SVTOOLS_RTF_DEFTAB "\\deftab"
-#define OOO_STRING_SVTOOLS_RTF_DELETED "\\deleted"
-#define OOO_STRING_SVTOOLS_RTF_DFRMTXTX "\\dfrmtxtx"
-#define OOO_STRING_SVTOOLS_RTF_DFRMTXTY "\\dfrmtxty"
-#define OOO_STRING_SVTOOLS_RTF_DIBITMAP "\\dibitmap"
-#define OOO_STRING_SVTOOLS_RTF_DN "\\dn"
-#define OOO_STRING_SVTOOLS_RTF_DOCCOMM "\\doccomm"
-#define OOO_STRING_SVTOOLS_RTF_DOCTEMP "\\doctemp"
-#define OOO_STRING_SVTOOLS_RTF_DROPCAPLI "\\dropcapli"
-#define OOO_STRING_SVTOOLS_RTF_DROPCAPT "\\dropcapt"
-#define OOO_STRING_SVTOOLS_RTF_ABSNOOVRLP "\\absnoovrlp"
-#define OOO_STRING_SVTOOLS_RTF_DXFRTEXT "\\dxfrtext"
-#define OOO_STRING_SVTOOLS_RTF_DY "\\dy"
-#define OOO_STRING_SVTOOLS_RTF_EDMINS "\\edmins"
-#define OOO_STRING_SVTOOLS_RTF_EMDASH "\\emdash"
-#define OOO_STRING_SVTOOLS_RTF_ENDASH "\\endash"
-#define OOO_STRING_SVTOOLS_RTF_ENDDOC "\\enddoc"
-#define OOO_STRING_SVTOOLS_RTF_ENDNHERE "\\endnhere"
-#define OOO_STRING_SVTOOLS_RTF_ENDNOTES "\\endnotes"
-#define OOO_STRING_SVTOOLS_RTF_EXPND "\\expnd"
-#define OOO_STRING_SVTOOLS_RTF_EXPNDTW "\\expndtw"
-#define OOO_STRING_SVTOOLS_RTF_F "\\f"
-#define OOO_STRING_SVTOOLS_RTF_FACINGP "\\facingp"
-#define OOO_STRING_SVTOOLS_RTF_FACPGSXN "\\facpgsxn"
-#define OOO_STRING_SVTOOLS_RTF_FALT "\\falt"
-#define OOO_STRING_SVTOOLS_RTF_FCHARSET "\\fcharset"
-#define OOO_STRING_SVTOOLS_RTF_FDECOR "\\fdecor"
-#define OOO_STRING_SVTOOLS_RTF_FI "\\fi"
-#define OOO_STRING_SVTOOLS_RTF_FIELD "\\field"
-#define OOO_STRING_SVTOOLS_RTF_FLDDIRTY "\\flddirty"
-#define OOO_STRING_SVTOOLS_RTF_FLDEDIT "\\fldedit"
-#define OOO_STRING_SVTOOLS_RTF_FLDINST "\\fldinst"
-#define OOO_STRING_SVTOOLS_RTF_FLDLOCK "\\fldlock"
-#define OOO_STRING_SVTOOLS_RTF_FLDPRIV "\\fldpriv"
-#define OOO_STRING_SVTOOLS_RTF_FLDRSLT "\\fldrslt"
-#define OOO_STRING_SVTOOLS_RTF_FMODERN "\\fmodern"
-#define OOO_STRING_SVTOOLS_RTF_FN "\\fn"
-#define OOO_STRING_SVTOOLS_RTF_FNIL "\\fnil"
-#define OOO_STRING_SVTOOLS_RTF_FONTTBL "\\fonttbl"
-#define OOO_STRING_SVTOOLS_RTF_FOOTER "\\footer"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERF "\\footerf"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERL "\\footerl"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERR "\\footerr"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERY "\\footery"
-#define OOO_STRING_SVTOOLS_RTF_FOOTNOTE "\\footnote"
-#define OOO_STRING_SVTOOLS_RTF_FPRQ "\\fprq"
-#define OOO_STRING_SVTOOLS_RTF_FRACWIDTH "\\fracwidth"
-#define OOO_STRING_SVTOOLS_RTF_FROMAN "\\froman"
-#define OOO_STRING_SVTOOLS_RTF_FS "\\fs"
-#define OOO_STRING_SVTOOLS_RTF_FSCRIPT "\\fscript"
-#define OOO_STRING_SVTOOLS_RTF_FSWISS "\\fswiss"
-#define OOO_STRING_SVTOOLS_RTF_FTECH "\\ftech"
-#define OOO_STRING_SVTOOLS_RTF_FTNBJ "\\ftnbj"
-#define OOO_STRING_SVTOOLS_RTF_FTNCN "\\ftncn"
-#define OOO_STRING_SVTOOLS_RTF_FTNRESTART "\\ftnrestart"
-#define OOO_STRING_SVTOOLS_RTF_FTNSEP "\\ftnsep"
-#define OOO_STRING_SVTOOLS_RTF_FTNSEPC "\\ftnsepc"
-#define OOO_STRING_SVTOOLS_RTF_FTNSTART "\\ftnstart"
-#define OOO_STRING_SVTOOLS_RTF_FTNTJ "\\ftntj"
-#define OOO_STRING_SVTOOLS_RTF_GREEN "\\green"
-#define OOO_STRING_SVTOOLS_RTF_GUTTER "\\gutter"
-#define OOO_STRING_SVTOOLS_RTF_GUTTERSXN "\\guttersxn"
-#define OOO_STRING_SVTOOLS_RTF_HEADER "\\header"
-#define OOO_STRING_SVTOOLS_RTF_HEADERF "\\headerf"
-#define OOO_STRING_SVTOOLS_RTF_HEADERL "\\headerl"
-#define OOO_STRING_SVTOOLS_RTF_HEADERR "\\headerr"
-#define OOO_STRING_SVTOOLS_RTF_HEADERY "\\headery"
-#define OOO_STRING_SVTOOLS_RTF_HR "\\hr"
-#define OOO_STRING_SVTOOLS_RTF_HYPHHOTZ "\\hyphhotz"
-#define OOO_STRING_SVTOOLS_RTF_I "\\i"
-#define OOO_STRING_SVTOOLS_RTF_ID "\\id"
-#define OOO_STRING_SVTOOLS_RTF_INFO "\\info"
-#define OOO_STRING_SVTOOLS_RTF_INTBL "\\intbl"
-#define OOO_STRING_SVTOOLS_RTF_IXE "\\ixe"
-#define OOO_STRING_SVTOOLS_RTF_KEEP "\\keep"
-#define OOO_STRING_SVTOOLS_RTF_KEEPN "\\keepn"
-#define OOO_STRING_SVTOOLS_RTF_KERNING "\\kerning"
-#define OOO_STRING_SVTOOLS_RTF_KEYCODE "\\keycode"
-#define OOO_STRING_SVTOOLS_RTF_KEYWORDS "\\keywords"
-#define OOO_STRING_SVTOOLS_RTF_LANDSCAPE "\\landscape"
-#define OOO_STRING_SVTOOLS_RTF_LANG "\\lang"
-#define OOO_STRING_SVTOOLS_RTF_LDBLQUOTE "\\ldblquote"
-#define OOO_STRING_SVTOOLS_RTF_LEVEL "\\level"
-#define OOO_STRING_SVTOOLS_RTF_LI "\\li"
-#define OOO_STRING_SVTOOLS_RTF_LIN "\\lin"
-#define OOO_STRING_SVTOOLS_RTF_LINE "\\line"
-#define OOO_STRING_SVTOOLS_RTF_LINEBETCOL "\\linebetcol"
-#define OOO_STRING_SVTOOLS_RTF_LINECONT "\\linecont"
-#define OOO_STRING_SVTOOLS_RTF_LINEMOD "\\linemod"
-#define OOO_STRING_SVTOOLS_RTF_LINEPPAGE "\\lineppage"
-#define OOO_STRING_SVTOOLS_RTF_LINERESTART "\\linerestart"
-#define OOO_STRING_SVTOOLS_RTF_LINESTART "\\linestart"
-#define OOO_STRING_SVTOOLS_RTF_LINESTARTS "\\linestarts"
-#define OOO_STRING_SVTOOLS_RTF_LINEX "\\linex"
-#define OOO_STRING_SVTOOLS_RTF_LNDSCPSXN "\\lndscpsxn"
-#define OOO_STRING_SVTOOLS_RTF_LQUOTE "\\lquote"
-#define OOO_STRING_SVTOOLS_RTF_MAC "\\mac"
-#define OOO_STRING_SVTOOLS_RTF_MACPICT "\\macpict"
-#define OOO_STRING_SVTOOLS_RTF_MAKEBACKUP "\\makebackup"
-#define OOO_STRING_SVTOOLS_RTF_MARGB "\\margb"
-#define OOO_STRING_SVTOOLS_RTF_MARGBSXN "\\margbsxn"
-#define OOO_STRING_SVTOOLS_RTF_MARGL "\\margl"
-#define OOO_STRING_SVTOOLS_RTF_MARGLSXN "\\marglsxn"
-#define OOO_STRING_SVTOOLS_RTF_MARGMIRROR "\\margmirror"
-#define OOO_STRING_SVTOOLS_RTF_MARGR "\\margr"
-#define OOO_STRING_SVTOOLS_RTF_MARGRSXN "\\margrsxn"
-#define OOO_STRING_SVTOOLS_RTF_MARGT "\\margt"
-#define OOO_STRING_SVTOOLS_RTF_MARGTSXN "\\margtsxn"
-#define OOO_STRING_SVTOOLS_RTF_MIN "\\min"
-#define OOO_STRING_SVTOOLS_RTF_MO "\\mo"
-#define OOO_STRING_SVTOOLS_RTF_NEXTCSET "\\nextcset"
-#define OOO_STRING_SVTOOLS_RTF_NEXTFILE "\\nextfile"
-#define OOO_STRING_SVTOOLS_RTF_NOFCHARS "\\nofchars"
-#define OOO_STRING_SVTOOLS_RTF_NOFPAGES "\\nofpages"
-#define OOO_STRING_SVTOOLS_RTF_NOFWORDS "\\nofwords"
-#define OOO_STRING_SVTOOLS_RTF_NOLINE "\\noline"
-#define OOO_STRING_SVTOOLS_RTF_NOSUPERSUB "\\nosupersub"
-#define OOO_STRING_SVTOOLS_RTF_NOWRAP "\\nowrap"
-#define OOO_STRING_SVTOOLS_RTF_OPERATOR "\\operator"
-#define OOO_STRING_SVTOOLS_RTF_OUTL "\\outl"
-#define OOO_STRING_SVTOOLS_RTF_PAGE "\\page"
-#define OOO_STRING_SVTOOLS_RTF_PAGEBB "\\pagebb"
-#define OOO_STRING_SVTOOLS_RTF_PAPERH "\\paperh"
-#define OOO_STRING_SVTOOLS_RTF_PAPERW "\\paperw"
-#define OOO_STRING_SVTOOLS_RTF_PAR "\\par"
-#define OOO_STRING_SVTOOLS_RTF_PARD "\\pard"
-#define OOO_STRING_SVTOOLS_RTF_PC "\\pc"
-#define OOO_STRING_SVTOOLS_RTF_PCA "\\pca"
-#define OOO_STRING_SVTOOLS_RTF_PGHSXN "\\pghsxn"
-#define OOO_STRING_SVTOOLS_RTF_PGNCONT "\\pgncont"
-#define OOO_STRING_SVTOOLS_RTF_PGNDEC "\\pgndec"
-#define OOO_STRING_SVTOOLS_RTF_PGNLCLTR "\\pgnlcltr"
-#define OOO_STRING_SVTOOLS_RTF_PGNLCRM "\\pgnlcrm"
-#define OOO_STRING_SVTOOLS_RTF_PGNRESTART "\\pgnrestart"
-#define OOO_STRING_SVTOOLS_RTF_PGNSTART "\\pgnstart"
-#define OOO_STRING_SVTOOLS_RTF_PGNSTARTS "\\pgnstarts"
-#define OOO_STRING_SVTOOLS_RTF_PGNUCLTR "\\pgnucltr"
-#define OOO_STRING_SVTOOLS_RTF_PGNUCRM "\\pgnucrm"
-#define OOO_STRING_SVTOOLS_RTF_PGNX "\\pgnx"
-#define OOO_STRING_SVTOOLS_RTF_PGNY "\\pgny"
-#define OOO_STRING_SVTOOLS_RTF_PGWSXN "\\pgwsxn"
-#define OOO_STRING_SVTOOLS_RTF_PHCOL "\\phcol"
-#define OOO_STRING_SVTOOLS_RTF_PHMRG "\\phmrg"
-#define OOO_STRING_SVTOOLS_RTF_PHPG "\\phpg"
-#define OOO_STRING_SVTOOLS_RTF_PICCROPB "\\piccropb"
-#define OOO_STRING_SVTOOLS_RTF_PICCROPL "\\piccropl"
-#define OOO_STRING_SVTOOLS_RTF_PICCROPR "\\piccropr"
-#define OOO_STRING_SVTOOLS_RTF_PICCROPT "\\piccropt"
-#define OOO_STRING_SVTOOLS_RTF_PICH "\\pich"
-#define OOO_STRING_SVTOOLS_RTF_PICHGOAL "\\pichgoal"
-#define OOO_STRING_SVTOOLS_RTF_PICSCALED "\\picscaled"
-#define OOO_STRING_SVTOOLS_RTF_PICSCALEX "\\picscalex"
-#define OOO_STRING_SVTOOLS_RTF_PICSCALEY "\\picscaley"
-#define OOO_STRING_SVTOOLS_RTF_PICT "\\pict"
-#define OOO_STRING_SVTOOLS_RTF_PICW "\\picw"
-#define OOO_STRING_SVTOOLS_RTF_PICWGOAL "\\picwgoal"
-#define OOO_STRING_SVTOOLS_RTF_PLAIN "\\plain"
-#define OOO_STRING_SVTOOLS_RTF_PMMETAFILE "\\pmmetafile"
-#define OOO_STRING_SVTOOLS_RTF_POSNEGX "\\posnegx"
-#define OOO_STRING_SVTOOLS_RTF_POSNEGY "\\posnegy"
-#define OOO_STRING_SVTOOLS_RTF_POSX "\\posx"
-#define OOO_STRING_SVTOOLS_RTF_POSXC "\\posxc"
-#define OOO_STRING_SVTOOLS_RTF_POSXI "\\posxi"
-#define OOO_STRING_SVTOOLS_RTF_POSXL "\\posxl"
-#define OOO_STRING_SVTOOLS_RTF_POSXO "\\posxo"
-#define OOO_STRING_SVTOOLS_RTF_POSXR "\\posxr"
-#define OOO_STRING_SVTOOLS_RTF_POSY "\\posy"
-#define OOO_STRING_SVTOOLS_RTF_POSYB "\\posyb"
-#define OOO_STRING_SVTOOLS_RTF_POSYC "\\posyc"
-#define OOO_STRING_SVTOOLS_RTF_POSYIL "\\posyil"
-#define OOO_STRING_SVTOOLS_RTF_POSYT "\\posyt"
-#define OOO_STRING_SVTOOLS_RTF_PRINTIM "\\printim"
-#define OOO_STRING_SVTOOLS_RTF_PSOVER "\\psover"
-#define OOO_STRING_SVTOOLS_RTF_PVMRG "\\pvmrg"
-#define OOO_STRING_SVTOOLS_RTF_PVPARA "\\pvpara"
-#define OOO_STRING_SVTOOLS_RTF_PVPG "\\pvpg"
-#define OOO_STRING_SVTOOLS_RTF_QC "\\qc"
-#define OOO_STRING_SVTOOLS_RTF_QJ "\\qj"
-#define OOO_STRING_SVTOOLS_RTF_QL "\\ql"
-#define OOO_STRING_SVTOOLS_RTF_QR "\\qr"
-#define OOO_STRING_SVTOOLS_RTF_RDBLQUOTE "\\rdblquote"
-#define OOO_STRING_SVTOOLS_RTF_RED "\\red"
-#define OOO_STRING_SVTOOLS_RTF_REVBAR "\\revbar"
-#define OOO_STRING_SVTOOLS_RTF_REVISED "\\revised"
-#define OOO_STRING_SVTOOLS_RTF_REVISIONS "\\revisions"
-#define OOO_STRING_SVTOOLS_RTF_REVPROP "\\revprop"
-#define OOO_STRING_SVTOOLS_RTF_REVTIM "\\revtim"
-#define OOO_STRING_SVTOOLS_RTF_RI "\\ri"
-#define OOO_STRING_SVTOOLS_RTF_RIN "\\rin"
-#define OOO_STRING_SVTOOLS_RTF_ROW "\\row"
-#define OOO_STRING_SVTOOLS_RTF_RQUOTE "\\rquote"
-#define OOO_STRING_SVTOOLS_RTF_RTF "\\rtf"
-#define OOO_STRING_SVTOOLS_RTF_RXE "\\rxe"
-#define OOO_STRING_SVTOOLS_RTF_S "\\s"
-#define OOO_STRING_SVTOOLS_RTF_SA "\\sa"
-#define OOO_STRING_SVTOOLS_RTF_SB "\\sb"
-#define OOO_STRING_SVTOOLS_RTF_SBASEDON "\\sbasedon"
-#define OOO_STRING_SVTOOLS_RTF_SBKCOL "\\sbkcol"
-#define OOO_STRING_SVTOOLS_RTF_SBKEVEN "\\sbkeven"
-#define OOO_STRING_SVTOOLS_RTF_SBKNONE "\\sbknone"
-#define OOO_STRING_SVTOOLS_RTF_SBKODD "\\sbkodd"
-#define OOO_STRING_SVTOOLS_RTF_SBKPAGE "\\sbkpage"
-#define OOO_STRING_SVTOOLS_RTF_SBYS "\\sbys"
-#define OOO_STRING_SVTOOLS_RTF_SCAPS "\\scaps"
-#define OOO_STRING_SVTOOLS_RTF_SECT "\\sect"
-#define OOO_STRING_SVTOOLS_RTF_SECTD "\\sectd"
-#define OOO_STRING_SVTOOLS_RTF_SHAD "\\shad"
-#define OOO_STRING_SVTOOLS_RTF_SHADING "\\shading"
-#define OOO_STRING_SVTOOLS_RTF_SHIFT "\\shift"
-#define OOO_STRING_SVTOOLS_RTF_SL "\\sl"
-#define OOO_STRING_SVTOOLS_RTF_SNEXT "\\snext"
-#define OOO_STRING_SVTOOLS_RTF_STRIKE "\\strike"
-#define OOO_STRING_SVTOOLS_RTF_STYLESHEET "\\stylesheet"
-#define OOO_STRING_SVTOOLS_RTF_SUB "\\sub"
-#define OOO_STRING_SVTOOLS_RTF_SUBJECT "\\subject"
-#define OOO_STRING_SVTOOLS_RTF_SUPER "\\super"
-#define OOO_STRING_SVTOOLS_RTF_TAB "\\tab"
-#define OOO_STRING_SVTOOLS_RTF_TB "\\tb"
-#define OOO_STRING_SVTOOLS_RTF_TC "\\tc"
-#define OOO_STRING_SVTOOLS_RTF_TCF "\\tcf"
-#define OOO_STRING_SVTOOLS_RTF_TCL "\\tcl"
-#define OOO_STRING_SVTOOLS_RTF_TEMPLATE "\\template"
-#define OOO_STRING_SVTOOLS_RTF_TITLE "\\title"
-#define OOO_STRING_SVTOOLS_RTF_TITLEPG "\\titlepg"
-#define OOO_STRING_SVTOOLS_RTF_TLDOT "\\tldot"
-#define OOO_STRING_SVTOOLS_RTF_TLEQ "\\tleq"
-#define OOO_STRING_SVTOOLS_RTF_TLHYPH "\\tlhyph"
-#define OOO_STRING_SVTOOLS_RTF_TLTH "\\tlth"
-#define OOO_STRING_SVTOOLS_RTF_TLUL "\\tlul"
-#define OOO_STRING_SVTOOLS_RTF_TQC "\\tqc"
-#define OOO_STRING_SVTOOLS_RTF_TQDEC "\\tqdec"
-#define OOO_STRING_SVTOOLS_RTF_TQR "\\tqr"
-#define OOO_STRING_SVTOOLS_RTF_TQL "\\tql"
-#define OOO_STRING_SVTOOLS_RTF_TRGAPH "\\trgaph"
-#define OOO_STRING_SVTOOLS_RTF_TRLEFT "\\trleft"
-#define OOO_STRING_SVTOOLS_RTF_TROWD "\\trowd"
-#define OOO_STRING_SVTOOLS_RTF_TRQC "\\trqc"
-#define OOO_STRING_SVTOOLS_RTF_TRQL "\\trql"
-#define OOO_STRING_SVTOOLS_RTF_TRQR "\\trqr"
-#define OOO_STRING_SVTOOLS_RTF_TRRH "\\trrh"
-#define OOO_STRING_SVTOOLS_RTF_TX "\\tx"
-#define OOO_STRING_SVTOOLS_RTF_TXE "\\txe"
-#define OOO_STRING_SVTOOLS_RTF_UL "\\ul"
-#define OOO_STRING_SVTOOLS_RTF_ULD "\\uld"
-#define OOO_STRING_SVTOOLS_RTF_ULDB "\\uldb"
-#define OOO_STRING_SVTOOLS_RTF_ULNONE "\\ulnone"
-#define OOO_STRING_SVTOOLS_RTF_ULW "\\ulw"
-#define OOO_STRING_SVTOOLS_RTF_UP "\\up"
-#define OOO_STRING_SVTOOLS_RTF_V "\\v"
-#define OOO_STRING_SVTOOLS_RTF_VERN "\\vern"
-#define OOO_STRING_SVTOOLS_RTF_VERSION "\\version"
-#define OOO_STRING_SVTOOLS_RTF_VERTALB "\\vertalb"
-#define OOO_STRING_SVTOOLS_RTF_VERTALC "\\vertalc"
-#define OOO_STRING_SVTOOLS_RTF_VERTALJ "\\vertalj"
-#define OOO_STRING_SVTOOLS_RTF_VERTALT "\\vertalt"
-#define OOO_STRING_SVTOOLS_RTF_WBITMAP "\\wbitmap"
-#define OOO_STRING_SVTOOLS_RTF_WBMBITSPIXEL "\\wbmbitspixel"
-#define OOO_STRING_SVTOOLS_RTF_WBMPLANES "\\wbmplanes"
-#define OOO_STRING_SVTOOLS_RTF_WBMWIDTHBYTES "\\wbmwidthbytes"
-#define OOO_STRING_SVTOOLS_RTF_WIDOWCTRL "\\widowctrl"
-#define OOO_STRING_SVTOOLS_RTF_WMETAFILE "\\wmetafile"
-#define OOO_STRING_SVTOOLS_RTF_XE "\\xe"
-#define OOO_STRING_SVTOOLS_RTF_YR "\\yr"
-#define OOO_STRING_SVTOOLS_RTF_NOBRKHYPH "\\_"
-#define OOO_STRING_SVTOOLS_RTF_FORMULA "\\|"
-#define OOO_STRING_SVTOOLS_RTF_NOBREAK "\\~"
-#define OOO_STRING_SVTOOLS_RTF_AB "\\ab"
-#define OOO_STRING_SVTOOLS_RTF_ACAPS "\\acaps"
-#define OOO_STRING_SVTOOLS_RTF_ACF "\\acf"
-#define OOO_STRING_SVTOOLS_RTF_ADDITIVE "\\additive"
-#define OOO_STRING_SVTOOLS_RTF_ADN "\\adn"
-#define OOO_STRING_SVTOOLS_RTF_AENDDOC "\\aenddoc"
-#define OOO_STRING_SVTOOLS_RTF_AENDNOTES "\\aendnotes"
-#define OOO_STRING_SVTOOLS_RTF_AEXPND "\\aexpnd"
-#define OOO_STRING_SVTOOLS_RTF_AF "\\af"
-#define OOO_STRING_SVTOOLS_RTF_AFS "\\afs"
-#define OOO_STRING_SVTOOLS_RTF_AFTNBJ "\\aftnbj"
-#define OOO_STRING_SVTOOLS_RTF_AFTNCN "\\aftncn"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNALC "\\aftnnalc"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNAR "\\aftnnar"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNAUC "\\aftnnauc"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNCHI "\\aftnnchi"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNRLC "\\aftnnrlc"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNRUC "\\aftnnruc"
-#define OOO_STRING_SVTOOLS_RTF_AFTNRESTART "\\aftnrestart"
-#define OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT "\\aftnrstcont"
-#define OOO_STRING_SVTOOLS_RTF_AFTNSEP "\\aftnsep"
-#define OOO_STRING_SVTOOLS_RTF_AFTNSEPC "\\aftnsepc"
-#define OOO_STRING_SVTOOLS_RTF_AFTNSTART "\\aftnstart"
-#define OOO_STRING_SVTOOLS_RTF_AFTNTJ "\\aftntj"
-#define OOO_STRING_SVTOOLS_RTF_AI "\\ai"
-#define OOO_STRING_SVTOOLS_RTF_ALANG "\\alang"
-#define OOO_STRING_SVTOOLS_RTF_ALLPROT "\\allprot"
-#define OOO_STRING_SVTOOLS_RTF_ANNOTPROT "\\annotprot"
-#define OOO_STRING_SVTOOLS_RTF_AOUTL "\\aoutl"
-#define OOO_STRING_SVTOOLS_RTF_ASCAPS "\\ascaps"
-#define OOO_STRING_SVTOOLS_RTF_ASHAD "\\ashad"
-#define OOO_STRING_SVTOOLS_RTF_ASTRIKE "\\astrike"
-#define OOO_STRING_SVTOOLS_RTF_ATNAUTHOR "\\atnauthor"
-#define OOO_STRING_SVTOOLS_RTF_ATNICN "\\atnicn"
-#define OOO_STRING_SVTOOLS_RTF_ATNREF "\\atnref"
-#define OOO_STRING_SVTOOLS_RTF_ATNTIME "\\atntime"
-#define OOO_STRING_SVTOOLS_RTF_ATRFEND "\\atrfend"
-#define OOO_STRING_SVTOOLS_RTF_ATRFSTART "\\atrfstart"
-#define OOO_STRING_SVTOOLS_RTF_AUL "\\aul"
-#define OOO_STRING_SVTOOLS_RTF_AULD "\\auld"
-#define OOO_STRING_SVTOOLS_RTF_AULDB "\\auldb"
-#define OOO_STRING_SVTOOLS_RTF_AULNONE "\\aulnone"
-#define OOO_STRING_SVTOOLS_RTF_AULW "\\aulw"
-#define OOO_STRING_SVTOOLS_RTF_AUP "\\aup"
-#define OOO_STRING_SVTOOLS_RTF_BKMKPUB "\\bkmkpub"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDASH "\\brdrdash"
-#define OOO_STRING_SVTOOLS_RTF_BRKFRM "\\brkfrm"
-#define OOO_STRING_SVTOOLS_RTF_CCHS "\\cchs"
-#define OOO_STRING_SVTOOLS_RTF_CPG "\\cpg"
-#define OOO_STRING_SVTOOLS_RTF_CS "\\cs"
-#define OOO_STRING_SVTOOLS_RTF_CVMME "\\cvmme"
-#define OOO_STRING_SVTOOLS_RTF_DATAFIELD "\\datafield"
-#define OOO_STRING_SVTOOLS_RTF_DO "\\do"
-#define OOO_STRING_SVTOOLS_RTF_DOBXCOLUMN "\\dobxcolumn"
-#define OOO_STRING_SVTOOLS_RTF_DOBXMARGIN "\\dobxmargin"
-#define OOO_STRING_SVTOOLS_RTF_DOBXPAGE "\\dobxpage"
-#define OOO_STRING_SVTOOLS_RTF_DOBYMARGIN "\\dobymargin"
-#define OOO_STRING_SVTOOLS_RTF_DOBYPAGE "\\dobypage"
-#define OOO_STRING_SVTOOLS_RTF_DOBYPARA "\\dobypara"
-#define OOO_STRING_SVTOOLS_RTF_DODHGT "\\dodhgt"
-#define OOO_STRING_SVTOOLS_RTF_DOLOCK "\\dolock"
-#define OOO_STRING_SVTOOLS_RTF_DPAENDHOL "\\dpaendhol"
-#define OOO_STRING_SVTOOLS_RTF_DPAENDL "\\dpaendl"
-#define OOO_STRING_SVTOOLS_RTF_DPAENDSOL "\\dpaendsol"
-#define OOO_STRING_SVTOOLS_RTF_DPAENDW "\\dpaendw"
-#define OOO_STRING_SVTOOLS_RTF_DPARC "\\dparc"
-#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPX "\\dparcflipx"
-#define OOO_STRING_SVTOOLS_RTF_DPARCFLIPY "\\dparcflipy"
-#define OOO_STRING_SVTOOLS_RTF_DPASTARTHOL "\\dpastarthol"
-#define OOO_STRING_SVTOOLS_RTF_DPASTARTL "\\dpastartl"
-#define OOO_STRING_SVTOOLS_RTF_DPASTARTSOL "\\dpastartsol"
-#define OOO_STRING_SVTOOLS_RTF_DPASTARTW "\\dpastartw"
-#define OOO_STRING_SVTOOLS_RTF_DPCALLOUT "\\dpcallout"
-#define OOO_STRING_SVTOOLS_RTF_DPCOA "\\dpcoa"
-#define OOO_STRING_SVTOOLS_RTF_DPCOACCENT "\\dpcoaccent"
-#define OOO_STRING_SVTOOLS_RTF_DPCOBESTFIT "\\dpcobestfit"
-#define OOO_STRING_SVTOOLS_RTF_DPCOBORDER "\\dpcoborder"
-#define OOO_STRING_SVTOOLS_RTF_DPCODABS "\\dpcodabs"
-#define OOO_STRING_SVTOOLS_RTF_DPCODBOTTOM "\\dpcodbottom"
-#define OOO_STRING_SVTOOLS_RTF_DPCODCENTER "\\dpcodcenter"
-#define OOO_STRING_SVTOOLS_RTF_DPCODTOP "\\dpcodtop"
-#define OOO_STRING_SVTOOLS_RTF_DPCOLENGTH "\\dpcolength"
-#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSX "\\dpcominusx"
-#define OOO_STRING_SVTOOLS_RTF_DPCOMINUSY "\\dpcominusy"
-#define OOO_STRING_SVTOOLS_RTF_DPCOOFFSET "\\dpcooffset"
-#define OOO_STRING_SVTOOLS_RTF_DPCOSMARTA "\\dpcosmarta"
-#define OOO_STRING_SVTOOLS_RTF_DPCOTDOUBLE "\\dpcotdouble"
-#define OOO_STRING_SVTOOLS_RTF_DPCOTRIGHT "\\dpcotright"
-#define OOO_STRING_SVTOOLS_RTF_DPCOTSINGLE "\\dpcotsingle"
-#define OOO_STRING_SVTOOLS_RTF_DPCOTTRIPLE "\\dpcottriple"
-#define OOO_STRING_SVTOOLS_RTF_DPCOUNT "\\dpcount"
-#define OOO_STRING_SVTOOLS_RTF_DPELLIPSE "\\dpellipse"
-#define OOO_STRING_SVTOOLS_RTF_DPENDGROUP "\\dpendgroup"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCB "\\dpfillbgcb"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCG "\\dpfillbgcg"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLBGCR "\\dpfillbgcr"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLBGGRAY "\\dpfillbggray"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLBGPAL "\\dpfillbgpal"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCB "\\dpfillfgcb"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCG "\\dpfillfgcg"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLFGCR "\\dpfillfgcr"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLFGGRAY "\\dpfillfggray"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLFGPAL "\\dpfillfgpal"
-#define OOO_STRING_SVTOOLS_RTF_DPFILLPAT "\\dpfillpat"
-#define OOO_STRING_SVTOOLS_RTF_DPGROUP "\\dpgroup"
-#define OOO_STRING_SVTOOLS_RTF_DPLINE "\\dpline"
-#define OOO_STRING_SVTOOLS_RTF_DPLINECOB "\\dplinecob"
-#define OOO_STRING_SVTOOLS_RTF_DPLINECOG "\\dplinecog"
-#define OOO_STRING_SVTOOLS_RTF_DPLINECOR "\\dplinecor"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEDADO "\\dplinedado"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEDADODO "\\dplinedadodo"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEDASH "\\dplinedash"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEDOT "\\dplinedot"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEGRAY "\\dplinegray"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEHOLLOW "\\dplinehollow"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEPAL "\\dplinepal"
-#define OOO_STRING_SVTOOLS_RTF_DPLINESOLID "\\dplinesolid"
-#define OOO_STRING_SVTOOLS_RTF_DPLINEW "\\dplinew"
-#define OOO_STRING_SVTOOLS_RTF_DPPOLYCOUNT "\\dppolycount"
-#define OOO_STRING_SVTOOLS_RTF_DPPOLYGON "\\dppolygon"
-#define OOO_STRING_SVTOOLS_RTF_DPPOLYLINE "\\dppolyline"
-#define OOO_STRING_SVTOOLS_RTF_DPPTX "\\dpptx"
-#define OOO_STRING_SVTOOLS_RTF_DPPTY "\\dppty"
-#define OOO_STRING_SVTOOLS_RTF_DPRECT "\\dprect"
-#define OOO_STRING_SVTOOLS_RTF_DPROUNDR "\\dproundr"
-#define OOO_STRING_SVTOOLS_RTF_DPSHADOW "\\dpshadow"
-#define OOO_STRING_SVTOOLS_RTF_DPSHADX "\\dpshadx"
-#define OOO_STRING_SVTOOLS_RTF_DPSHADY "\\dpshady"
-#define OOO_STRING_SVTOOLS_RTF_DPTXBX "\\dptxbx"
-#define OOO_STRING_SVTOOLS_RTF_DPTXBXMAR "\\dptxbxmar"
-#define OOO_STRING_SVTOOLS_RTF_DPTXBXTEXT "\\dptxbxtext"
-#define OOO_STRING_SVTOOLS_RTF_DPX "\\dpx"
-#define OOO_STRING_SVTOOLS_RTF_DPXSIZE "\\dpxsize"
-#define OOO_STRING_SVTOOLS_RTF_DPY "\\dpy"
-#define OOO_STRING_SVTOOLS_RTF_DPYSIZE "\\dpysize"
-#define OOO_STRING_SVTOOLS_RTF_DS "\\ds"
-#define OOO_STRING_SVTOOLS_RTF_EMSPACE "\\emspace"
-#define OOO_STRING_SVTOOLS_RTF_ENSPACE "\\enspace"
-#define OOO_STRING_SVTOOLS_RTF_FBIDI "\\fbidi"
-#define OOO_STRING_SVTOOLS_RTF_FET "\\fet"
-#define OOO_STRING_SVTOOLS_RTF_FID "\\fid"
-#define OOO_STRING_SVTOOLS_RTF_FILE "\\file"
-#define OOO_STRING_SVTOOLS_RTF_FILETBL "\\filetbl"
-#define OOO_STRING_SVTOOLS_RTF_FLDALT "\\fldalt"
-#define OOO_STRING_SVTOOLS_RTF_FNETWORK "\\fnetwork"
-#define OOO_STRING_SVTOOLS_RTF_FONTEMB "\\fontemb"
-#define OOO_STRING_SVTOOLS_RTF_FONTFILE "\\fontfile"
-#define OOO_STRING_SVTOOLS_RTF_FORMDISP "\\formdisp"
-#define OOO_STRING_SVTOOLS_RTF_FORMPROT "\\formprot"
-#define OOO_STRING_SVTOOLS_RTF_FORMSHADE "\\formshade"
-#define OOO_STRING_SVTOOLS_RTF_FOSNUM "\\fosnum"
-#define OOO_STRING_SVTOOLS_RTF_FRELATIVE "\\frelative"
-#define OOO_STRING_SVTOOLS_RTF_FTNALT "\\ftnalt"
-#define OOO_STRING_SVTOOLS_RTF_FTNIL "\\ftnil"
-#define OOO_STRING_SVTOOLS_RTF_FTNNALC "\\ftnnalc"
-#define OOO_STRING_SVTOOLS_RTF_FTNNAR "\\ftnnar"
-#define OOO_STRING_SVTOOLS_RTF_FTNNAUC "\\ftnnauc"
-#define OOO_STRING_SVTOOLS_RTF_FTNNCHI "\\ftnnchi"
-#define OOO_STRING_SVTOOLS_RTF_FTNNRLC "\\ftnnrlc"
-#define OOO_STRING_SVTOOLS_RTF_FTNNRUC "\\ftnnruc"
-#define OOO_STRING_SVTOOLS_RTF_FTNRSTCONT "\\ftnrstcont"
-#define OOO_STRING_SVTOOLS_RTF_FTNRSTPG "\\ftnrstpg"
-#define OOO_STRING_SVTOOLS_RTF_FTTRUETYPE "\\fttruetype"
-#define OOO_STRING_SVTOOLS_RTF_FVALIDDOS "\\fvaliddos"
-#define OOO_STRING_SVTOOLS_RTF_FVALIDHPFS "\\fvalidhpfs"
-#define OOO_STRING_SVTOOLS_RTF_FVALIDMAC "\\fvalidmac"
-#define OOO_STRING_SVTOOLS_RTF_FVALIDNTFS "\\fvalidntfs"
-#define OOO_STRING_SVTOOLS_RTF_HYPHAUTO "\\hyphauto"
-#define OOO_STRING_SVTOOLS_RTF_HYPHCAPS "\\hyphcaps"
-#define OOO_STRING_SVTOOLS_RTF_HYPHCONSEC "\\hyphconsec"
-#define OOO_STRING_SVTOOLS_RTF_HYPHPAR "\\hyphpar"
-#define OOO_STRING_SVTOOLS_RTF_LINKSELF "\\linkself"
-#define OOO_STRING_SVTOOLS_RTF_LINKSTYLES "\\linkstyles"
-#define OOO_STRING_SVTOOLS_RTF_LTRCH "\\ltrch"
-#define OOO_STRING_SVTOOLS_RTF_LTRDOC "\\ltrdoc"
-#define OOO_STRING_SVTOOLS_RTF_LTRMARK "\\ltrmark"
-#define OOO_STRING_SVTOOLS_RTF_LTRPAR "\\ltrpar"
-#define OOO_STRING_SVTOOLS_RTF_LTRROW "\\ltrrow"
-#define OOO_STRING_SVTOOLS_RTF_LTRSECT "\\ltrsect"
-#define OOO_STRING_SVTOOLS_RTF_NOCOLBAL "\\nocolbal"
-#define OOO_STRING_SVTOOLS_RTF_NOEXTRASPRL "\\noextrasprl"
-#define OOO_STRING_SVTOOLS_RTF_NOTABIND "\\notabind"
-#define OOO_STRING_SVTOOLS_RTF_NOWIDCTLPAR "\\nowidctlpar"
-#define OOO_STRING_SVTOOLS_RTF_OBJALIAS "\\objalias"
-#define OOO_STRING_SVTOOLS_RTF_OBJALIGN "\\objalign"
-#define OOO_STRING_SVTOOLS_RTF_OBJAUTLINK "\\objautlink"
-#define OOO_STRING_SVTOOLS_RTF_OBJCLASS "\\objclass"
-#define OOO_STRING_SVTOOLS_RTF_OBJCROPB "\\objcropb"
-#define OOO_STRING_SVTOOLS_RTF_OBJCROPL "\\objcropl"
-#define OOO_STRING_SVTOOLS_RTF_OBJCROPR "\\objcropr"
-#define OOO_STRING_SVTOOLS_RTF_OBJCROPT "\\objcropt"
-#define OOO_STRING_SVTOOLS_RTF_OBJDATA "\\objdata"
-#define OOO_STRING_SVTOOLS_RTF_OBJECT "\\object"
-#define OOO_STRING_SVTOOLS_RTF_OBJEMB "\\objemb"
-#define OOO_STRING_SVTOOLS_RTF_OBJH "\\objh"
-#define OOO_STRING_SVTOOLS_RTF_OBJICEMB "\\objicemb"
-#define OOO_STRING_SVTOOLS_RTF_OBJLINK "\\objlink"
-#define OOO_STRING_SVTOOLS_RTF_OBJLOCK "\\objlock"
-#define OOO_STRING_SVTOOLS_RTF_OBJNAME "\\objname"
-#define OOO_STRING_SVTOOLS_RTF_OBJPUB "\\objpub"
-#define OOO_STRING_SVTOOLS_RTF_OBJSCALEX "\\objscalex"
-#define OOO_STRING_SVTOOLS_RTF_OBJSCALEY "\\objscaley"
-#define OOO_STRING_SVTOOLS_RTF_OBJSECT "\\objsect"
-#define OOO_STRING_SVTOOLS_RTF_OBJSETSIZE "\\objsetsize"
-#define OOO_STRING_SVTOOLS_RTF_OBJSUB "\\objsub"
-#define OOO_STRING_SVTOOLS_RTF_OBJTIME "\\objtime"
-#define OOO_STRING_SVTOOLS_RTF_OBJTRANSY "\\objtransy"
-#define OOO_STRING_SVTOOLS_RTF_OBJUPDATE "\\objupdate"
-#define OOO_STRING_SVTOOLS_RTF_OBJW "\\objw"
-#define OOO_STRING_SVTOOLS_RTF_OTBLRUL "\\otblrul"
-#define OOO_STRING_SVTOOLS_RTF_PGNHN "\\pgnhn"
-#define OOO_STRING_SVTOOLS_RTF_PGNHNSC "\\pgnhnsc"
-#define OOO_STRING_SVTOOLS_RTF_PGNHNSH "\\pgnhnsh"
-#define OOO_STRING_SVTOOLS_RTF_PGNHNSM "\\pgnhnsm"
-#define OOO_STRING_SVTOOLS_RTF_PGNHNSN "\\pgnhnsn"
-#define OOO_STRING_SVTOOLS_RTF_PGNHNSP "\\pgnhnsp"
-#define OOO_STRING_SVTOOLS_RTF_PICBMP "\\picbmp"
-#define OOO_STRING_SVTOOLS_RTF_PICBPP "\\picbpp"
-#define OOO_STRING_SVTOOLS_RTF_PN "\\pn"
-#define OOO_STRING_SVTOOLS_RTF_PNACROSS "\\pnacross"
-#define OOO_STRING_SVTOOLS_RTF_PNB "\\pnb"
-#define OOO_STRING_SVTOOLS_RTF_PNCAPS "\\pncaps"
-#define OOO_STRING_SVTOOLS_RTF_PNCARD "\\pncard"
-#define OOO_STRING_SVTOOLS_RTF_PNCF "\\pncf"
-#define OOO_STRING_SVTOOLS_RTF_PNDEC "\\pndec"
-#define OOO_STRING_SVTOOLS_RTF_PNF "\\pnf"
-#define OOO_STRING_SVTOOLS_RTF_PNFS "\\pnfs"
-#define OOO_STRING_SVTOOLS_RTF_PNHANG "\\pnhang"
-#define OOO_STRING_SVTOOLS_RTF_PNI "\\pni"
-#define OOO_STRING_SVTOOLS_RTF_PNINDENT "\\pnindent"
-#define OOO_STRING_SVTOOLS_RTF_PNLCLTR "\\pnlcltr"
-#define OOO_STRING_SVTOOLS_RTF_PNLCRM "\\pnlcrm"
-#define OOO_STRING_SVTOOLS_RTF_PNLVL "\\pnlvl"
-#define OOO_STRING_SVTOOLS_RTF_PNLVLBLT "\\pnlvlblt"
-#define OOO_STRING_SVTOOLS_RTF_PNLVLBODY "\\pnlvlbody"
-#define OOO_STRING_SVTOOLS_RTF_PNLVLCONT "\\pnlvlcont"
-#define OOO_STRING_SVTOOLS_RTF_PNNUMONCE "\\pnnumonce"
-#define OOO_STRING_SVTOOLS_RTF_PNORD "\\pnord"
-#define OOO_STRING_SVTOOLS_RTF_PNORDT "\\pnordt"
-#define OOO_STRING_SVTOOLS_RTF_PNPREV "\\pnprev"
-#define OOO_STRING_SVTOOLS_RTF_PNQC "\\pnqc"
-#define OOO_STRING_SVTOOLS_RTF_PNQL "\\pnql"
-#define OOO_STRING_SVTOOLS_RTF_PNQR "\\pnqr"
-#define OOO_STRING_SVTOOLS_RTF_PNRESTART "\\pnrestart"
-#define OOO_STRING_SVTOOLS_RTF_PNSCAPS "\\pnscaps"
-#define OOO_STRING_SVTOOLS_RTF_PNSECLVL "\\pnseclvl"
-#define OOO_STRING_SVTOOLS_RTF_PNSP "\\pnsp"
-#define OOO_STRING_SVTOOLS_RTF_PNSTART "\\pnstart"
-#define OOO_STRING_SVTOOLS_RTF_PNSTRIKE "\\pnstrike"
-#define OOO_STRING_SVTOOLS_RTF_PNTEXT "\\pntext"
-#define OOO_STRING_SVTOOLS_RTF_PNTXTA "\\pntxta"
-#define OOO_STRING_SVTOOLS_RTF_PNTXTB "\\pntxtb"
-#define OOO_STRING_SVTOOLS_RTF_PNUCLTR "\\pnucltr"
-#define OOO_STRING_SVTOOLS_RTF_PNUCRM "\\pnucrm"
-#define OOO_STRING_SVTOOLS_RTF_PNUL "\\pnul"
-#define OOO_STRING_SVTOOLS_RTF_PNULD "\\pnuld"
-#define OOO_STRING_SVTOOLS_RTF_PNULDB "\\pnuldb"
-#define OOO_STRING_SVTOOLS_RTF_PNULNONE "\\pnulnone"
-#define OOO_STRING_SVTOOLS_RTF_PNULW "\\pnulw"
-#define OOO_STRING_SVTOOLS_RTF_PRCOLBL "\\prcolbl"
-#define OOO_STRING_SVTOOLS_RTF_PRINTDATA "\\printdata"
-#define OOO_STRING_SVTOOLS_RTF_PSZ "\\psz"
-#define OOO_STRING_SVTOOLS_RTF_PUBAUTO "\\pubauto"
-#define OOO_STRING_SVTOOLS_RTF_RESULT "\\result"
-#define OOO_STRING_SVTOOLS_RTF_REVAUTH "\\revauth"
-#define OOO_STRING_SVTOOLS_RTF_REVDTTM "\\revdttm"
-#define OOO_STRING_SVTOOLS_RTF_REVPROT "\\revprot"
-#define OOO_STRING_SVTOOLS_RTF_REVTBL "\\revtbl"
-#define OOO_STRING_SVTOOLS_RTF_RSLTBMP "\\rsltbmp"
-#define OOO_STRING_SVTOOLS_RTF_RSLTMERGE "\\rsltmerge"
-#define OOO_STRING_SVTOOLS_RTF_RSLTPICT "\\rsltpict"
-#define OOO_STRING_SVTOOLS_RTF_RSLTRTF "\\rsltrtf"
-#define OOO_STRING_SVTOOLS_RTF_RSLTTXT "\\rslttxt"
-#define OOO_STRING_SVTOOLS_RTF_RTLCH "\\rtlch"
-#define OOO_STRING_SVTOOLS_RTF_RTLDOC "\\rtldoc"
-#define OOO_STRING_SVTOOLS_RTF_RTLMARK "\\rtlmark"
-#define OOO_STRING_SVTOOLS_RTF_RTLPAR "\\rtlpar"
-#define OOO_STRING_SVTOOLS_RTF_RTLROW "\\rtlrow"
-#define OOO_STRING_SVTOOLS_RTF_RTLSECT "\\rtlsect"
-#define OOO_STRING_SVTOOLS_RTF_SEC "\\sec"
-#define OOO_STRING_SVTOOLS_RTF_SECTNUM "\\sectnum"
-#define OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED "\\sectunlocked"
-#define OOO_STRING_SVTOOLS_RTF_SLMULT "\\slmult"
-#define OOO_STRING_SVTOOLS_RTF_SOFTCOL "\\softcol"
-#define OOO_STRING_SVTOOLS_RTF_SOFTLHEIGHT "\\softlheight"
-#define OOO_STRING_SVTOOLS_RTF_SOFTLINE "\\softline"
-#define OOO_STRING_SVTOOLS_RTF_SOFTPAGE "\\softpage"
-#define OOO_STRING_SVTOOLS_RTF_SPRSSPBF "\\sprsspbf"
-#define OOO_STRING_SVTOOLS_RTF_SPRSTSP "\\sprstsp"
-#define OOO_STRING_SVTOOLS_RTF_SUBDOCUMENT "\\subdocument"
-#define OOO_STRING_SVTOOLS_RTF_SWPBDR "\\swpbdr"
-#define OOO_STRING_SVTOOLS_RTF_TCN "\\tcn"
-#define OOO_STRING_SVTOOLS_RTF_TRANSMF "\\transmf"
-#define OOO_STRING_SVTOOLS_RTF_TRBRDRB "\\trbrdrb"
-#define OOO_STRING_SVTOOLS_RTF_TRBRDRH "\\trbrdrh"
-#define OOO_STRING_SVTOOLS_RTF_TRBRDRL "\\trbrdrl"
-#define OOO_STRING_SVTOOLS_RTF_TRBRDRR "\\trbrdrr"
-#define OOO_STRING_SVTOOLS_RTF_TRBRDRT "\\trbrdrt"
-#define OOO_STRING_SVTOOLS_RTF_TRBRDRV "\\trbrdrv"
-#define OOO_STRING_SVTOOLS_RTF_TRHDR "\\trhdr"
-#define OOO_STRING_SVTOOLS_RTF_TRKEEP "\\trkeep"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDB "\\trpaddb"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDL "\\trpaddl"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDR "\\trpaddr"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDT "\\trpaddt"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDFB "\\trpaddfb"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDFL "\\trpaddfl"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDFR "\\trpaddfr"
-#define OOO_STRING_SVTOOLS_RTF_TRPADDFT "\\trpaddft"
-#define OOO_STRING_SVTOOLS_RTF_WRAPTRSP "\\wraptrsp"
-#define OOO_STRING_SVTOOLS_RTF_XEF "\\xef"
-#define OOO_STRING_SVTOOLS_RTF_ZWJ "\\zwj"
-#define OOO_STRING_SVTOOLS_RTF_ZWNJ "\\zwnj"
-
-// neue Tokens zur 1.5
-#define OOO_STRING_SVTOOLS_RTF_ABSLOCK "\\abslock"
-#define OOO_STRING_SVTOOLS_RTF_ADJUSTRIGHT "\\adjustright"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNCHOSUNG "\\aftnnchosung"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNCNUM "\\aftnncnum"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNDBAR "\\aftnndbar"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUM "\\aftnndbnum"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMD "\\aftnndbnumd"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMK "\\aftnndbnumk"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNDBNUMT "\\aftnndbnumt"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNGANADA "\\aftnnganada"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUM "\\aftnngbnum"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMD "\\aftnngbnumd"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUMK "\\aftnngbnumk"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNGBNUML "\\aftnngbnuml"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIAC "\\aftnnzodiac"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACD "\\aftnnzodiacd"
-#define OOO_STRING_SVTOOLS_RTF_AFTNNZODIACL "\\aftnnzodiacl"
-#define OOO_STRING_SVTOOLS_RTF_ANIMTEXT "\\animtext"
-#define OOO_STRING_SVTOOLS_RTF_ANSICPG "\\ansicpg"
-#define OOO_STRING_SVTOOLS_RTF_BACKGROUND "\\background"
-#define OOO_STRING_SVTOOLS_RTF_BDBFHDR "\\bdbfhdr"
-#define OOO_STRING_SVTOOLS_RTF_BLIPTAG "\\bliptag"
-#define OOO_STRING_SVTOOLS_RTF_BLIPUID "\\blipuid"
-#define OOO_STRING_SVTOOLS_RTF_BLIPUPI "\\blipupi"
-#define OOO_STRING_SVTOOLS_RTF_BRDRART "\\brdrart"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDASHD "\\brdrdashd"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDD "\\brdrdashdd"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDASHDOTSTR "\\brdrdashdotstr"
-#define OOO_STRING_SVTOOLS_RTF_BRDRDASHSM "\\brdrdashsm"
-#define OOO_STRING_SVTOOLS_RTF_BRDREMBOSS "\\brdremboss"
-#define OOO_STRING_SVTOOLS_RTF_BRDRENGRAVE "\\brdrengrave"
-#define OOO_STRING_SVTOOLS_RTF_BRDRFRAME "\\brdrframe"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNLG "\\brdrthtnlg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNMG "\\brdrthtnmg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG "\\brdrthtnsg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHLG "\\brdrtnthlg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHMG "\\brdrtnthmg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG "\\brdrtnthsg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNLG "\\brdrtnthtnlg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNMG "\\brdrtnthtnmg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTNTHTNSG "\\brdrtnthtnsg"
-#define OOO_STRING_SVTOOLS_RTF_BRDRTRIPLE "\\brdrtriple"
-#define OOO_STRING_SVTOOLS_RTF_BRDRWAVY "\\brdrwavy"
-#define OOO_STRING_SVTOOLS_RTF_BRDRWAVYDB "\\brdrwavydb"
-#define OOO_STRING_SVTOOLS_RTF_CATEGORY "\\category"
-#define OOO_STRING_SVTOOLS_RTF_CGRID "\\cgrid"
-#define OOO_STRING_SVTOOLS_RTF_CHARSCALEX "\\charscalex"
-#define OOO_STRING_SVTOOLS_RTF_CHBGBDIAG "\\chbgbdiag"
-#define OOO_STRING_SVTOOLS_RTF_CHBGCROSS "\\chbgcross"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDCROSS "\\chbgdcross"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDKBDIAG "\\chbgdkbdiag"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDKCROSS "\\chbgdkcross"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDKDCROSS "\\chbgdkdcross"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDKFDIAG "\\chbgdkfdiag"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDKHORIZ "\\chbgdkhoriz"
-#define OOO_STRING_SVTOOLS_RTF_CHBGDKVERT "\\chbgdkvert"
-#define OOO_STRING_SVTOOLS_RTF_CHBGFDIAG "\\chbgfdiag"
-#define OOO_STRING_SVTOOLS_RTF_CHBGHORIZ "\\chbghoriz"
-#define OOO_STRING_SVTOOLS_RTF_CHBGVERT "\\chbgvert"
-#define OOO_STRING_SVTOOLS_RTF_CHBRDR "\\chbrdr"
-#define OOO_STRING_SVTOOLS_RTF_CHCBPAT "\\chcbpat"
-#define OOO_STRING_SVTOOLS_RTF_CHCFPAT "\\chcfpat"
-#define OOO_STRING_SVTOOLS_RTF_CHSHDNG "\\chshdng"
-#define OOO_STRING_SVTOOLS_RTF_CLPADL "\\clpadl"
-#define OOO_STRING_SVTOOLS_RTF_CLPADT "\\clpadt"
-#define OOO_STRING_SVTOOLS_RTF_CLPADB "\\clpadb"
-#define OOO_STRING_SVTOOLS_RTF_CLPADR "\\clpadr"
-#define OOO_STRING_SVTOOLS_RTF_CLPADFL "\\clpadfl"
-#define OOO_STRING_SVTOOLS_RTF_CLPADFT "\\clpadft"
-#define OOO_STRING_SVTOOLS_RTF_CLPADFB "\\clpadfb"
-#define OOO_STRING_SVTOOLS_RTF_CLPADFR "\\clpadfr"
-#define OOO_STRING_SVTOOLS_RTF_CLTXLRTB "\\cltxlrtb"
-#define OOO_STRING_SVTOOLS_RTF_CLTXTBRL "\\cltxtbrl"
-#define OOO_STRING_SVTOOLS_RTF_CLVERTALB "\\clvertalb"
-#define OOO_STRING_SVTOOLS_RTF_CLVERTALC "\\clvertalc"
-#define OOO_STRING_SVTOOLS_RTF_CLVERTALT "\\clvertalt"
-#define OOO_STRING_SVTOOLS_RTF_CLVMGF "\\clvmgf"
-#define OOO_STRING_SVTOOLS_RTF_CLVMRG "\\clvmrg"
-#define OOO_STRING_SVTOOLS_RTF_CLTXTBRLV "\\cltxtbrlv"
-#define OOO_STRING_SVTOOLS_RTF_CLTXBTLR "\\cltxbtlr"
-#define OOO_STRING_SVTOOLS_RTF_CLTXLRTBV "\\cltxlrtbv"
-#define OOO_STRING_SVTOOLS_RTF_COMPANY "\\company"
-#define OOO_STRING_SVTOOLS_RTF_CRAUTH "\\crauth"
-#define OOO_STRING_SVTOOLS_RTF_CRDATE "\\crdate"
-#define OOO_STRING_SVTOOLS_RTF_DATE "\\date"
-#define OOO_STRING_SVTOOLS_RTF_DEFLANGFE "\\deflangfe"
-#define OOO_STRING_SVTOOLS_RTF_DFRAUTH "\\dfrauth"
-#define OOO_STRING_SVTOOLS_RTF_DFRDATE "\\dfrdate"
-#define OOO_STRING_SVTOOLS_RTF_DFRSTART "\\dfrstart"
-#define OOO_STRING_SVTOOLS_RTF_DFRSTOP "\\dfrstop"
-#define OOO_STRING_SVTOOLS_RTF_DFRXST "\\dfrxst"
-#define OOO_STRING_SVTOOLS_RTF_DGMARGIN "\\dgmargin"
-#define OOO_STRING_SVTOOLS_RTF_DNTBLNSBDB "\\dntblnsbdb"
-#define OOO_STRING_SVTOOLS_RTF_DOCTYPE "\\doctype"
-#define OOO_STRING_SVTOOLS_RTF_DOCVAR "\\docvar"
-#define OOO_STRING_SVTOOLS_RTF_DPCODESCENT "\\dpcodescent"
-#define OOO_STRING_SVTOOLS_RTF_EMBO "\\embo"
-#define OOO_STRING_SVTOOLS_RTF_EMFBLIP "\\emfblip"
-#define OOO_STRING_SVTOOLS_RTF_EXPSHRTN "\\expshrtn"
-#define OOO_STRING_SVTOOLS_RTF_FAAUTO "\\faauto"
-#define OOO_STRING_SVTOOLS_RTF_FBIAS "\\fbias"
-#define OOO_STRING_SVTOOLS_RTF_FFDEFRES "\\ffdefres"
-#define OOO_STRING_SVTOOLS_RTF_FFDEFTEXT "\\ffdeftext"
-#define OOO_STRING_SVTOOLS_RTF_FFENTRYMCR "\\ffentrymcr"
-#define OOO_STRING_SVTOOLS_RTF_FFEXITMCR "\\ffexitmcr"
-#define OOO_STRING_SVTOOLS_RTF_FFFORMAT "\\ffformat"
-#define OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX "\\ffhaslistbox"
-#define OOO_STRING_SVTOOLS_RTF_FFHELPTEXT "\\ffhelptext"
-#define OOO_STRING_SVTOOLS_RTF_FFHPS "\\ffhps"
-#define OOO_STRING_SVTOOLS_RTF_FFL "\\ffl"
-#define OOO_STRING_SVTOOLS_RTF_FFMAXLEN "\\ffmaxlen"
-#define OOO_STRING_SVTOOLS_RTF_FFNAME "\\ffname"
-#define OOO_STRING_SVTOOLS_RTF_FFOWNHELP "\\ffownhelp"
-#define OOO_STRING_SVTOOLS_RTF_FFOWNSTAT "\\ffownstat"
-#define OOO_STRING_SVTOOLS_RTF_FFPROT "\\ffprot"
-#define OOO_STRING_SVTOOLS_RTF_FFRECALC "\\ffrecalc"
-#define OOO_STRING_SVTOOLS_RTF_FFRES "\\ffres"
-#define OOO_STRING_SVTOOLS_RTF_FFSIZE "\\ffsize"
-#define OOO_STRING_SVTOOLS_RTF_FFSTATTEXT "\\ffstattext"
-#define OOO_STRING_SVTOOLS_RTF_FFTYPE "\\fftype"
-#define OOO_STRING_SVTOOLS_RTF_FFTYPETXT "\\fftypetxt"
-#define OOO_STRING_SVTOOLS_RTF_FLDTYPE "\\fldtype"
-#define OOO_STRING_SVTOOLS_RTF_FNAME "\\fname"
-#define OOO_STRING_SVTOOLS_RTF_FORMFIELD "\\formfield"
-#define OOO_STRING_SVTOOLS_RTF_FROMTEXT "\\fromtext"
-#define OOO_STRING_SVTOOLS_RTF_FTNNCHOSUNG "\\ftnnchosung"
-#define OOO_STRING_SVTOOLS_RTF_FTNNCNUM "\\ftnncnum"
-#define OOO_STRING_SVTOOLS_RTF_FTNNDBAR "\\ftnndbar"
-#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUM "\\ftnndbnum"
-#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMD "\\ftnndbnumd"
-#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMK "\\ftnndbnumk"
-#define OOO_STRING_SVTOOLS_RTF_FTNNDBNUMT "\\ftnndbnumt"
-#define OOO_STRING_SVTOOLS_RTF_FTNNGANADA "\\ftnnganada"
-#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUM "\\ftnngbnum"
-#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMD "\\ftnngbnumd"
-#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUMK "\\ftnngbnumk"
-#define OOO_STRING_SVTOOLS_RTF_FTNNGBNUML "\\ftnngbnuml"
-#define OOO_STRING_SVTOOLS_RTF_FTNNZODIAC "\\ftnnzodiac"
-#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACD "\\ftnnzodiacd"
-#define OOO_STRING_SVTOOLS_RTF_FTNNZODIACL "\\ftnnzodiacl"
-#define OOO_STRING_SVTOOLS_RTF_G "\\g"
-#define OOO_STRING_SVTOOLS_RTF_GCW "\\gcw"
-#define OOO_STRING_SVTOOLS_RTF_GRIDTBL "\\gridtbl"
-#define OOO_STRING_SVTOOLS_RTF_HIGHLIGHT "\\highlight"
-#define OOO_STRING_SVTOOLS_RTF_HLFR "\\hlfr"
-#define OOO_STRING_SVTOOLS_RTF_HLINKBASE "\\hlinkbase"
-#define OOO_STRING_SVTOOLS_RTF_HLLOC "\\hlloc"
-#define OOO_STRING_SVTOOLS_RTF_HLSRC "\\hlsrc"
-#define OOO_STRING_SVTOOLS_RTF_ILVL "\\ilvl"
-#define OOO_STRING_SVTOOLS_RTF_IMPR "\\impr"
-#define OOO_STRING_SVTOOLS_RTF_JPEGBLIP "\\jpegblip"
-#define OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW "\\levelfollow"
-#define OOO_STRING_SVTOOLS_RTF_LEVELINDENT "\\levelindent"
-#define OOO_STRING_SVTOOLS_RTF_LEVELJC "\\leveljc"
-#define OOO_STRING_SVTOOLS_RTF_LEVELLEGAL "\\levellegal"
-#define OOO_STRING_SVTOOLS_RTF_LEVELNFC "\\levelnfc"
-#define OOO_STRING_SVTOOLS_RTF_LEVELNORESTART "\\levelnorestart"
-#define OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS "\\levelnumbers"
-#define OOO_STRING_SVTOOLS_RTF_LEVELOLD "\\levelold"
-#define OOO_STRING_SVTOOLS_RTF_LEVELPREV "\\levelprev"
-#define OOO_STRING_SVTOOLS_RTF_LEVELPREVSPACE "\\levelprevspace"
-#define OOO_STRING_SVTOOLS_RTF_LEVELSPACE "\\levelspace"
-#define OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT "\\levelstartat"
-#define OOO_STRING_SVTOOLS_RTF_LEVELTEXT "\\leveltext"
-#define OOO_STRING_SVTOOLS_RTF_LINKVAL "\\linkval"
-#define OOO_STRING_SVTOOLS_RTF_LIST "\\list"
-#define OOO_STRING_SVTOOLS_RTF_LISTID "\\listid"
-#define OOO_STRING_SVTOOLS_RTF_LISTLEVEL "\\listlevel"
-#define OOO_STRING_SVTOOLS_RTF_LISTNAME "\\listname"
-#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE "\\listoverride"
-#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT "\\listoverridecount"
-#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDEFORMAT "\\listoverrideformat"
-#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDESTART "\\listoverridestart"
-#define OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE "\\listoverridetable"
-#define OOO_STRING_SVTOOLS_RTF_LISTRESTARTHDN "\\listrestarthdn"
-#define OOO_STRING_SVTOOLS_RTF_LISTSIMPLE "\\listsimple"
-#define OOO_STRING_SVTOOLS_RTF_LISTTABLE "\\listtable"
-#define OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID "\\listtemplateid"
-#define OOO_STRING_SVTOOLS_RTF_LISTTEXT "\\listtext"
-#define OOO_STRING_SVTOOLS_RTF_LS "\\ls"
-#define OOO_STRING_SVTOOLS_RTF_LYTEXCTTP "\\lytexcttp"
-#define OOO_STRING_SVTOOLS_RTF_LYTPRTMET "\\lytprtmet"
-#define OOO_STRING_SVTOOLS_RTF_MANAGER "\\manager"
-#define OOO_STRING_SVTOOLS_RTF_MSMCAP "\\msmcap"
-#define OOO_STRING_SVTOOLS_RTF_NOFCHARSWS "\\nofcharsws"
-#define OOO_STRING_SVTOOLS_RTF_NOLEAD "\\nolead"
-#define OOO_STRING_SVTOOLS_RTF_NONSHPPICT "\\nonshppict"
-#define OOO_STRING_SVTOOLS_RTF_NOSECTEXPAND "\\nosectexpand"
-#define OOO_STRING_SVTOOLS_RTF_NOSNAPLINEGRID "\\nosnaplinegrid"
-#define OOO_STRING_SVTOOLS_RTF_NOSPACEFORUL "\\nospaceforul"
-#define OOO_STRING_SVTOOLS_RTF_NOULTRLSPC "\\noultrlspc"
-#define OOO_STRING_SVTOOLS_RTF_NOXLATTOYEN "\\noxlattoyen"
-#define OOO_STRING_SVTOOLS_RTF_OBJATTPH "\\objattph"
-#define OOO_STRING_SVTOOLS_RTF_OBJHTML "\\objhtml"
-#define OOO_STRING_SVTOOLS_RTF_OBJOCX "\\objocx"
-#define OOO_STRING_SVTOOLS_RTF_OLDLINEWRAP "\\oldlinewrap"
-#define OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL "\\outlinelevel"
-#define OOO_STRING_SVTOOLS_RTF_OVERLAY "\\overlay"
-#define OOO_STRING_SVTOOLS_RTF_PANOSE "\\panose"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRB "\\pgbrdrb"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRFOOT "\\pgbrdrfoot"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRHEAD "\\pgbrdrhead"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRL "\\pgbrdrl"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDROPT "\\pgbrdropt"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRR "\\pgbrdrr"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRSNAP "\\pgbrdrsnap"
-#define OOO_STRING_SVTOOLS_RTF_PGBRDRT "\\pgbrdrt"
-#define OOO_STRING_SVTOOLS_RTF_PGNCHOSUNG "\\pgnchosung"
-#define OOO_STRING_SVTOOLS_RTF_PGNCNUM "\\pgncnum"
-#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMK "\\pgndbnumk"
-#define OOO_STRING_SVTOOLS_RTF_PGNDBNUMT "\\pgndbnumt"
-#define OOO_STRING_SVTOOLS_RTF_PGNGANADA "\\pgnganada"
-#define OOO_STRING_SVTOOLS_RTF_PGNGBNUM "\\pgngbnum"
-#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMD "\\pgngbnumd"
-#define OOO_STRING_SVTOOLS_RTF_PGNGBNUMK "\\pgngbnumk"
-#define OOO_STRING_SVTOOLS_RTF_PGNGBNUML "\\pgngbnuml"
-#define OOO_STRING_SVTOOLS_RTF_PGNZODIAC "\\pgnzodiac"
-#define OOO_STRING_SVTOOLS_RTF_PGNZODIACD "\\pgnzodiacd"
-#define OOO_STRING_SVTOOLS_RTF_PGNZODIACL "\\pgnzodiacl"
-#define OOO_STRING_SVTOOLS_RTF_PICPROP "\\picprop"
-#define OOO_STRING_SVTOOLS_RTF_PNAIUEO "\\pnaiueo"
-#define OOO_STRING_SVTOOLS_RTF_PNAIUEOD "\\pnaiueod"
-#define OOO_STRING_SVTOOLS_RTF_PNCHOSUNG "\\pnchosung"
-#define OOO_STRING_SVTOOLS_RTF_PNDBNUMD "\\pndbnumd"
-#define OOO_STRING_SVTOOLS_RTF_PNDBNUMK "\\pndbnumk"
-#define OOO_STRING_SVTOOLS_RTF_PNDBNUML "\\pndbnuml"
-#define OOO_STRING_SVTOOLS_RTF_PNDBNUMT "\\pndbnumt"
-#define OOO_STRING_SVTOOLS_RTF_PNGANADA "\\pnganada"
-#define OOO_STRING_SVTOOLS_RTF_PNGBLIP "\\pngblip"
-#define OOO_STRING_SVTOOLS_RTF_PNGBNUM "\\pngbnum"
-#define OOO_STRING_SVTOOLS_RTF_PNGBNUMD "\\pngbnumd"
-#define OOO_STRING_SVTOOLS_RTF_PNGBNUMK "\\pngbnumk"
-#define OOO_STRING_SVTOOLS_RTF_PNGBNUML "\\pngbnuml"
-#define OOO_STRING_SVTOOLS_RTF_PNRAUTH "\\pnrauth"
-#define OOO_STRING_SVTOOLS_RTF_PNRDATE "\\pnrdate"
-#define OOO_STRING_SVTOOLS_RTF_PNRNFC "\\pnrnfc"
-#define OOO_STRING_SVTOOLS_RTF_PNRNOT "\\pnrnot"
-#define OOO_STRING_SVTOOLS_RTF_PNRPNBR "\\pnrpnbr"
-#define OOO_STRING_SVTOOLS_RTF_PNRRGB "\\pnrrgb"
-#define OOO_STRING_SVTOOLS_RTF_PNRSTART "\\pnrstart"
-#define OOO_STRING_SVTOOLS_RTF_PNRSTOP "\\pnrstop"
-#define OOO_STRING_SVTOOLS_RTF_PNRXST "\\pnrxst"
-#define OOO_STRING_SVTOOLS_RTF_PNZODIAC "\\pnzodiac"
-#define OOO_STRING_SVTOOLS_RTF_PNZODIACD "\\pnzodiacd"
-#define OOO_STRING_SVTOOLS_RTF_PNZODIACL "\\pnzodiacl"
-#define OOO_STRING_SVTOOLS_RTF_LFOLEVEL "\\lfolevel"
-#define OOO_STRING_SVTOOLS_RTF_POSYIN "\\posyin"
-#define OOO_STRING_SVTOOLS_RTF_POSYOUT "\\posyout"
-#define OOO_STRING_SVTOOLS_RTF_PRIVATE "\\private"
-#define OOO_STRING_SVTOOLS_RTF_PROPNAME "\\propname"
-#define OOO_STRING_SVTOOLS_RTF_PROPTYPE "\\proptype"
-#define OOO_STRING_SVTOOLS_RTF_REVAUTHDEL "\\revauthdel"
-#define OOO_STRING_SVTOOLS_RTF_REVDTTMDEL "\\revdttmdel"
-#define OOO_STRING_SVTOOLS_RTF_SAUTOUPD "\\sautoupd"
-#define OOO_STRING_SVTOOLS_RTF_SECTDEFAULTCL "\\sectdefaultcl"
-#define OOO_STRING_SVTOOLS_RTF_SECTEXPAND "\\sectexpand"
-#define OOO_STRING_SVTOOLS_RTF_SECTLINEGRID "\\sectlinegrid"
-#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYCL "\\sectspecifycl"
-#define OOO_STRING_SVTOOLS_RTF_SECTSPECIFYL "\\sectspecifyl"
-#define OOO_STRING_SVTOOLS_RTF_SHIDDEN "\\shidden"
-#define OOO_STRING_SVTOOLS_RTF_SHPBOTTOM "\\shpbottom"
-#define OOO_STRING_SVTOOLS_RTF_SHPBXCOLUMN "\\shpbxcolumn"
-#define OOO_STRING_SVTOOLS_RTF_SHPBXMARGIN "\\shpbxmargin"
-#define OOO_STRING_SVTOOLS_RTF_SHPBXPAGE "\\shpbxpage"
-#define OOO_STRING_SVTOOLS_RTF_SHPBYMARGIN "\\shpbymargin"
-#define OOO_STRING_SVTOOLS_RTF_SHPBYPAGE "\\shpbypage"
-#define OOO_STRING_SVTOOLS_RTF_SHPBYPARA "\\shpbypara"
-#define OOO_STRING_SVTOOLS_RTF_SHPFBLWTXT "\\shpfblwtxt"
-#define OOO_STRING_SVTOOLS_RTF_SHPFHDR "\\shpfhdr"
-#define OOO_STRING_SVTOOLS_RTF_SHPGRP "\\shpgrp"
-#define OOO_STRING_SVTOOLS_RTF_SHPLEFT "\\shpleft"
-#define OOO_STRING_SVTOOLS_RTF_SHPLID "\\shplid"
-#define OOO_STRING_SVTOOLS_RTF_SHPLOCKANCHOR "\\shplockanchor"
-#define OOO_STRING_SVTOOLS_RTF_SHPPICT "\\shppict"
-#define OOO_STRING_SVTOOLS_RTF_SHPRIGHT "\\shpright"
-#define OOO_STRING_SVTOOLS_RTF_SHPRSLT "\\shprslt"
-#define OOO_STRING_SVTOOLS_RTF_SHPTOP "\\shptop"
-#define OOO_STRING_SVTOOLS_RTF_SHPTXT "\\shptxt"
-#define OOO_STRING_SVTOOLS_RTF_SHPWRK "\\shpwrk"
-#define OOO_STRING_SVTOOLS_RTF_SHPWR "\\shpwr"
-#define OOO_STRING_SVTOOLS_RTF_SHPZ "\\shpz"
-#define OOO_STRING_SVTOOLS_RTF_SPRSBSP "\\sprsbsp"
-#define OOO_STRING_SVTOOLS_RTF_SPRSLNSP "\\sprslnsp"
-#define OOO_STRING_SVTOOLS_RTF_SPRSTSM "\\sprstsm"
-#define OOO_STRING_SVTOOLS_RTF_STATICVAL "\\staticval"
-#define OOO_STRING_SVTOOLS_RTF_STEXTFLOW "\\stextflow"
-#define OOO_STRING_SVTOOLS_RTF_STRIKED "\\striked"
-#define OOO_STRING_SVTOOLS_RTF_SUBFONTBYSIZE "\\subfontbysize"
-#define OOO_STRING_SVTOOLS_RTF_TCELLD "\\tcelld"
-#define OOO_STRING_SVTOOLS_RTF_TIME "\\time"
-#define OOO_STRING_SVTOOLS_RTF_TRUNCATEFONTHEIGHT "\\truncatefontheight"
-#define OOO_STRING_SVTOOLS_RTF_UC "\\uc"
-#define OOO_STRING_SVTOOLS_RTF_UD "\\ud"
-#define OOO_STRING_SVTOOLS_RTF_ULDASH "\\uldash"
-#define OOO_STRING_SVTOOLS_RTF_ULDASHD "\\uldashd"
-#define OOO_STRING_SVTOOLS_RTF_ULDASHDD "\\uldashdd"
-#define OOO_STRING_SVTOOLS_RTF_ULTH "\\ulth"
-#define OOO_STRING_SVTOOLS_RTF_ULWAVE "\\ulwave"
-#define OOO_STRING_SVTOOLS_RTF_ULC "\\ulc"
-#define OOO_STRING_SVTOOLS_RTF_U "\\u"
-#define OOO_STRING_SVTOOLS_RTF_UPR "\\upr"
-#define OOO_STRING_SVTOOLS_RTF_USERPROPS "\\userprops"
-#define OOO_STRING_SVTOOLS_RTF_VIEWKIND "\\viewkind"
-#define OOO_STRING_SVTOOLS_RTF_VIEWSCALE "\\viewscale"
-#define OOO_STRING_SVTOOLS_RTF_VIEWZK "\\viewzk"
-#define OOO_STRING_SVTOOLS_RTF_WIDCTLPAR "\\widctlpar"
-#define OOO_STRING_SVTOOLS_RTF_WINDOWCAPTION "\\windowcaption"
-#define OOO_STRING_SVTOOLS_RTF_WPEQN "\\wpeqn"
-#define OOO_STRING_SVTOOLS_RTF_WPJST "\\wpjst"
-#define OOO_STRING_SVTOOLS_RTF_WPSP "\\wpsp"
-#define OOO_STRING_SVTOOLS_RTF_YXE "\\yxe"
-#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTB "\\frmtxlrtb"
-#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRL "\\frmtxtbrl"
-#define OOO_STRING_SVTOOLS_RTF_FRMTXBTLR "\\frmtxbtlr"
-#define OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV "\\frmtxlrtbv"
-#define OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV "\\frmtxtbrlv"
-
-// MS-2000 Tokens
-#define OOO_STRING_SVTOOLS_RTF_ULTHD "\\ulthd"
-#define OOO_STRING_SVTOOLS_RTF_ULTHDASH "\\ulthdash"
-#define OOO_STRING_SVTOOLS_RTF_ULLDASH "\\ulldash"
-#define OOO_STRING_SVTOOLS_RTF_ULTHLDASH "\\ulthldash"
-#define OOO_STRING_SVTOOLS_RTF_ULTHDASHD "\\ulthdashd"
-#define OOO_STRING_SVTOOLS_RTF_ULTHDASHDD "\\ulthdashdd"
-#define OOO_STRING_SVTOOLS_RTF_ULHWAVE "\\ulhwave"
-#define OOO_STRING_SVTOOLS_RTF_ULULDBWAVE "\\ululdbwave"
-#define OOO_STRING_SVTOOLS_RTF_LOCH "\\loch"
-#define OOO_STRING_SVTOOLS_RTF_HICH "\\hich"
-#define OOO_STRING_SVTOOLS_RTF_DBCH "\\dbch"
-#define OOO_STRING_SVTOOLS_RTF_LANGFE "\\langfe"
-#define OOO_STRING_SVTOOLS_RTF_ADEFLANG "\\adeflang"
-#define OOO_STRING_SVTOOLS_RTF_ADEFF "\\adeff"
-#define OOO_STRING_SVTOOLS_RTF_ACCNONE "\\accnone"
-#define OOO_STRING_SVTOOLS_RTF_ACCDOT "\\accdot"
-#define OOO_STRING_SVTOOLS_RTF_ACCCOMMA "\\acccomma"
-#define OOO_STRING_SVTOOLS_RTF_TWOINONE "\\twoinone"
-#define OOO_STRING_SVTOOLS_RTF_HORZVERT "\\horzvert"
-#define OOO_STRING_SVTOOLS_RTF_FAHANG "\\fahang"
-#define OOO_STRING_SVTOOLS_RTF_FAVAR "\\favar"
-#define OOO_STRING_SVTOOLS_RTF_FACENTER "\\facenter"
-#define OOO_STRING_SVTOOLS_RTF_FAROMAN "\\faroman"
-#define OOO_STRING_SVTOOLS_RTF_FAFIXED "\\fafixed"
-#define OOO_STRING_SVTOOLS_RTF_NOCWRAP "\\nocwrap"
-#define OOO_STRING_SVTOOLS_RTF_NOOVERFLOW "\\nooverflow"
-#define OOO_STRING_SVTOOLS_RTF_ASPALPHA "\\aspalpha"
-
-// SWG spezifische Attribute
-#define OOO_STRING_SVTOOLS_RTF_GRFALIGNV "\\grfalignv"
-#define OOO_STRING_SVTOOLS_RTF_GRFALIGNH "\\grfalignh"
-#define OOO_STRING_SVTOOLS_RTF_GRFMIRROR "\\grfmirror"
-#define OOO_STRING_SVTOOLS_RTF_HEADERYB "\\headeryb"
-#define OOO_STRING_SVTOOLS_RTF_HEADERXL "\\headerxl"
-#define OOO_STRING_SVTOOLS_RTF_HEADERXR "\\headerxr"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERYT "\\footeryt"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERXL "\\footerxl"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERXR "\\footerxr"
-#define OOO_STRING_SVTOOLS_RTF_HEADERYH "\\headeryh"
-#define OOO_STRING_SVTOOLS_RTF_FOOTERYH "\\footeryh"
-#define OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN "\\swcolmnblnc"
-#define OOO_STRING_SVTOOLS_RTF_UPDNPROP "\\updnprop"
-#define OOO_STRING_SVTOOLS_RTF_PRTDATA "\\prtdata"
-#define OOO_STRING_SVTOOLS_RTF_BKMKKEY "\\bkmkkey"
-
-// Attribute fuer die freifliegenden Rahmen
-#define OOO_STRING_SVTOOLS_RTF_FLYPRINT "\\flyprint"
-#define OOO_STRING_SVTOOLS_RTF_FLYOPAQUE "\\flyopaque"
-#define OOO_STRING_SVTOOLS_RTF_FLYPRTCTD "\\flyprtctd"
-#define OOO_STRING_SVTOOLS_RTF_FLYMAINCNT "\\flymaincnt"
-#define OOO_STRING_SVTOOLS_RTF_FLYVERT "\\flyvert"
-#define OOO_STRING_SVTOOLS_RTF_FLYHORZ "\\flyhorz"
-#define OOO_STRING_SVTOOLS_RTF_DFRMTXTL "\\dfrmtxtl"
-#define OOO_STRING_SVTOOLS_RTF_DFRMTXTR "\\dfrmtxtr"
-#define OOO_STRING_SVTOOLS_RTF_DFRMTXTU "\\dfrmtxtu"
-#define OOO_STRING_SVTOOLS_RTF_DFRMTXTW "\\dfrmtxtw"
-#define OOO_STRING_SVTOOLS_RTF_FLYANCHOR "\\flyanchor"
-#define OOO_STRING_SVTOOLS_RTF_FLYCNTNT "\\flycntnt"
-#define OOO_STRING_SVTOOLS_RTF_FLYCOLUMN "\\flycolumn"
-#define OOO_STRING_SVTOOLS_RTF_FLYPAGE "\\flypage"
-#define OOO_STRING_SVTOOLS_RTF_FLYINPARA "\\flyinpara"
-#define OOO_STRING_SVTOOLS_RTF_BRDBOX "\\brdbox"
-#define OOO_STRING_SVTOOLS_RTF_BRDLNCOL "\\brdlncol"
-#define OOO_STRING_SVTOOLS_RTF_BRDLNIN "\\brdlnin"
-#define OOO_STRING_SVTOOLS_RTF_BRDLNOUT "\\brdlnout"
-#define OOO_STRING_SVTOOLS_RTF_BRDLNDIST "\\brdlndist"
-#define OOO_STRING_SVTOOLS_RTF_SHADOW "\\shadow"
-#define OOO_STRING_SVTOOLS_RTF_SHDWDIST "\\shdwdist"
-#define OOO_STRING_SVTOOLS_RTF_SHDWSTYLE "\\shdwstyle"
-#define OOO_STRING_SVTOOLS_RTF_SHDWCOL "\\shdwcol"
-#define OOO_STRING_SVTOOLS_RTF_SHDWFCOL "\\shdwfcol"
-#define OOO_STRING_SVTOOLS_RTF_PGDSCTBL "\\pgdsctbl"
-#define OOO_STRING_SVTOOLS_RTF_PGDSC "\\pgdsc"
-#define OOO_STRING_SVTOOLS_RTF_PGDSCUSE "\\pgdscuse"
-#define OOO_STRING_SVTOOLS_RTF_PGDSCNXT "\\pgdscnxt"
-#define OOO_STRING_SVTOOLS_RTF_HYPHEN "\\hyphen"
-#define OOO_STRING_SVTOOLS_RTF_HYPHLEAD "\\hyphlead"
-#define OOO_STRING_SVTOOLS_RTF_HYPHTRAIL "\\hyphtrail"
-#define OOO_STRING_SVTOOLS_RTF_HYPHMAX "\\hyphmax"
-#define OOO_STRING_SVTOOLS_RTF_TLSWG "\\tlswg"
-#define OOO_STRING_SVTOOLS_RTF_PGBRK "\\pgbrk"
-#define OOO_STRING_SVTOOLS_RTF_PGDSCNO "\\pgdscno"
-#define OOO_STRING_SVTOOLS_RTF_SOUTLVL "\\soutlvl"
-#define OOO_STRING_SVTOOLS_RTF_SHP "\\shp"
-#define OOO_STRING_SVTOOLS_RTF_SN "\\sn"
-#define OOO_STRING_SVTOOLS_RTF_SV "\\sv"
-
-// Support for overline attributes
-#define OOO_STRING_SVTOOLS_RTF_OL "\\ol"
-#define OOO_STRING_SVTOOLS_RTF_OLD "\\old"
-#define OOO_STRING_SVTOOLS_RTF_OLDB "\\oldb"
-#define OOO_STRING_SVTOOLS_RTF_OLNONE "\\olnone"
-#define OOO_STRING_SVTOOLS_RTF_OLW "\\olw"
-#define OOO_STRING_SVTOOLS_RTF_OLDASH "\\oldash"
-#define OOO_STRING_SVTOOLS_RTF_OLDASHD "\\oldashd"
-#define OOO_STRING_SVTOOLS_RTF_OLDASHDD "\\oldashdd"
-#define OOO_STRING_SVTOOLS_RTF_OLTH "\\olth"
-#define OOO_STRING_SVTOOLS_RTF_OLWAVE "\\olwave"
-#define OOO_STRING_SVTOOLS_RTF_OLC "\\olc"
-#define OOO_STRING_SVTOOLS_RTF_OLTHD "\\olthd"
-#define OOO_STRING_SVTOOLS_RTF_OLTHDASH "\\olthdash"
-#define OOO_STRING_SVTOOLS_RTF_OLLDASH "\\olldash"
-#define OOO_STRING_SVTOOLS_RTF_OLTHLDASH "\\olthldash"
-#define OOO_STRING_SVTOOLS_RTF_OLTHDASHD "\\olthdashd"
-#define OOO_STRING_SVTOOLS_RTF_OLTHDASHDD "\\olthdashdd"
-#define OOO_STRING_SVTOOLS_RTF_OLHWAVE "\\olhwave"
-#define OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE "\\ololdbwave"
-
-#endif // _RTFKEYWD_HXX
diff --git a/svtools/source/svrtf/rtfout.hxx b/svtools/source/svrtf/rtfout.hxx
deleted file mode 100644
index ba20add1d968..000000000000
--- a/svtools/source/svrtf/rtfout.hxx
+++ /dev/null
@@ -1,70 +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: rtfout.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 _RTFOUT_HXX
-#define _RTFOUT_HXX
-
-#include "svtools/svtdllapi.h"
-#include <tools/solar.h>
-
-#ifndef _RTL_TEXTENC_H_
-#include <rtl/textenc.h>
-#endif
-
-class String;
-class SvStream;
-
-class SVT_DLLPUBLIC RTFOutFuncs
-{
-public:
-#if defined(MAC) || defined(UNX)
- static const sal_Char sNewLine; // nur \012 oder \015
-#else
- static const sal_Char __FAR_DATA sNewLine[]; // \015\012
-#endif
-
- static SvStream& Out_Char( SvStream&, sal_Unicode cChar,
- int *pUCMode,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- BOOL bWriteHelpFile = FALSE );
- static SvStream& Out_String( SvStream&, const String&,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- BOOL bWriteHelpFile = FALSE );
- static SvStream& Out_Fontname( SvStream&, const String&,
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252,
- BOOL bWriteHelpFile = FALSE );
-
- static SvStream& Out_Hex( SvStream&, ULONG nHex, BYTE nLen );
-};
-
-
-#endif
-
-
diff --git a/svtools/source/svrtf/rtftoken.h b/svtools/source/svrtf/rtftoken.h
deleted file mode 100644
index c7981361ffc9..000000000000
--- a/svtools/source/svrtf/rtftoken.h
+++ /dev/null
@@ -1,1276 +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: rtftoken.h,v $
- * $Revision: 1.13.134.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
-
-#ifndef _RTFTOKEN_H
-#define _RTFTOKEN_H
-
-class String;
-
-// suche die TokenID zu dem Token
-int GetRTFToken( const String& rSearch );
-
-enum RTF_TOKEN_RANGES {
- RTF_NOGROUP = 0x0100,
- RTF_DOCFMT = 0x0200,
- RTF_SECTFMT = 0x0300,
- RTF_PARFMT = 0x0400,
- RTF_TABSTOPDEF = 0x0500,
- RTF_BRDRDEF = 0x0600,
- RTF_CHRFMT = 0x0700,
- RTF_SPECCHAR = 0x0800,
- RTF_APOCTL = 0x0900,
- RTF_SHADINGDEF = 0x0A00,
- // free = 0x0B00,
- RTF_DRAWOBJECTS = 0x0C00,
- RTF_OBJECTS = 0x0D00,
- RTF_NUMBULLETS = 0x0E00,
-
- // !!! kann hinein verodert werden (Border/Background) !!!!
- RTF_TABLEDEF = 0x1000,
-
- // !!! kann hinein verodert werden (Border/Tab) !!!!
- RTF_SWGDEFS = 0x4000
-};
-
-enum RTF_TOKEN_IDS {
-
- RTF_TEXTTOKEN = RTF_NOGROUP,
- RTF_SINGLECHAR,
- RTF_UNKNOWNCONTROL,
- RTF_UNKNOWNDATA,
-
- RTF_RTF,
- RTF_ANSITYPE,
- RTF_MACTYPE,
- RTF_PCTYPE,
- RTF_PCATYPE,
- RTF_NEXTTYPE,
-
- RTF_STYLESHEET,
- RTF_SBASEDON,
- RTF_SNEXT,
- RTF_SHIDDEN,
- RTF_SAUTOUPD,
-
- RTF_KEYCODE,
- RTF_FNKEY,
- RTF_ALTKEY,
- RTF_SHIFTKEY,
- RTF_CTRLKEY,
-
- RTF_FONTTBL,
- RTF_DEFF,
- RTF_FNIL,
- RTF_FROMAN,
- RTF_FSWISS,
- RTF_FMODERN,
- RTF_FSCRIPT,
- RTF_FDECOR,
- RTF_FTECH,
-
- RTF_COLORTBL,
- RTF_RED,
- RTF_GREEN,
- RTF_BLUE,
-
- RTF_INFO,
- RTF_TITLE,
- RTF_SUBJECT,
- RTF_AUTHOR,
- RTF_OPERATOR,
- RTF_KEYWORDS,
- RTF_COMMENT,
- RTF_VERSION,
- RTF_DOCCOMM,
- RTF_VERN,
- RTF_CREATIM,
- RTF_REVTIM,
- RTF_PRINTIM,
- RTF_BUPTIM,
- RTF_EDMINS,
- RTF_NOFPAGES,
- RTF_NOFWORDS,
- RTF_NOFCHARS,
- RTF_ID,
- RTF_YR,
- RTF_MO,
- RTF_DY,
- RTF_HR,
- RTF_MIN,
- RTF_USERPROPS,
- RTF_CATEGORY,
- RTF_COMPANY,
- RTF_MANAGER,
- RTF_PROPNAME,
- RTF_LINKVAL,
- RTF_NOFCHARSWS,
- RTF_HLINKBASE,
- RTF_STATICVAL,
- RTF_PROPTYPE,
-
- RTF_ANNOTATION,
- RTF_ATNID,
-
- RTF_FOOTNOTE,
-
- RTF_XE,
- RTF_BXE,
- RTF_IXE,
- RTF_RXE,
- RTF_TXE,
- RTF_YXE,
-
- RTF_TC,
- RTF_TCF,
- RTF_TCL,
-
- RTF_BKMKSTART,
- RTF_BKMKEND,
-
- RTF_PICT, // Bitmaps
- RTF_PICW,
- RTF_PICH,
- RTF_WBMBITSPIXEL,
- RTF_WBMPLANES,
- RTF_WBMWIDTHBYTES,
- RTF_PICWGOAL,
- RTF_PICHGOAL,
- RTF_BIN,
- RTF_PICSCALEX,
- RTF_PICSCALEY,
- RTF_PICSCALED,
- RTF_WBITMAP,
- RTF_WMETAFILE,
- RTF_MACPICT,
- RTF_OSMETAFILE,
- RTF_DIBITMAP,
- RTF_PICCROPT,
- RTF_PICCROPB,
- RTF_PICCROPL,
- RTF_PICCROPR,
- RTF_PICDATA,
- RTF_PICBMP,
- RTF_PICBPP,
- RTF_PICPROP,
- RTF_SHPPICT,
- RTF_EMFBLIP,
- RTF_PNGBLIP,
- RTF_JPEGBLIP,
- RTF_NONSHPPICT,
- RTF_BLIPTAG,
- RTF_BLIPUID,
- RTF_BLIPUPI,
-
- RTF_FIELD, // Felder
- RTF_FLDDIRTY,
- RTF_FLDEDIT,
- RTF_FLDLOCK,
- RTF_FLDPRIV,
- RTF_FLDINST,
- RTF_FLDRSLT,
- RTF_FLDTYPE,
- RTF_TIME,
- RTF_DATE,
- RTF_WPEQN,
-
- RTF_NOLINE,
- RTF_REVISED,
-
- RTF_BKMKCOLF,
- RTF_BKMKCOLL,
- RTF_PSOVER,
- RTF_DOCTEMP,
- RTF_DELETED,
-
- RTF_FCHARSET,
- RTF_FALT,
- RTF_FPRQ,
- RTF_PANOSE,
- RTF_FNAME,
- RTF_FBIAS,
-
- RTF_ADDITIVE,
- RTF_BKMKPUB,
- RTF_CPG,
- RTF_DATAFIELD,
-
- RTF_FBIDI,
- RTF_FID,
- RTF_FILE,
- RTF_FILETBL,
- RTF_FNETWORK,
- RTF_FONTEMB,
- RTF_FONTFILE,
- RTF_FOSNUM,
- RTF_FRELATIVE,
- RTF_FTNIL,
- RTF_FTTRUETYPE,
- RTF_FVALIDDOS,
- RTF_FVALIDHPFS,
- RTF_FVALIDMAC,
- RTF_FVALIDNTFS,
- RTF_LINKSELF,
- RTF_PUBAUTO,
- RTF_REVTBL,
- RTF_RTLMARK,
- RTF_SEC,
- RTF_TCN,
- RTF_XEF,
-
- RTF_UD, // Unicode
- RTF_UPR,
- RTF_U,
- RTF_UC,
- RTF_ANSICPG,
-
- RTF_FFEXITMCR, // Form Fields
- RTF_FFENTRYMCR,
- RTF_FFDEFTEXT,
- RTF_FFFORMAT,
- RTF_FFSTATTEXT,
- RTF_FORMFIELD,
- RTF_FFNAME,
- RTF_FFHELPTEXT,
- RTF_FFL,
- RTF_FFOWNHELP,
- RTF_FFOWNSTAT,
- RTF_FFMAXLEN,
- RTF_FFHASLISTBOX,
- RTF_FFHPS,
- RTF_FFPROT,
- RTF_FFTYPE,
- RTF_FFTYPETXT,
- RTF_FFSIZE,
- RTF_FFRECALC,
- RTF_FFRES,
- RTF_FFDEFRES,
-
- RTF_HIGHLIGHT,
-
-/* */
-
- RTF_DEFTAB = RTF_DOCFMT,
- RTF_HYPHHOTZ,
- RTF_LINESTART,
- RTF_FRACWIDTH,
- RTF_NEXTFILE,
- RTF_TEMPLATE,
- RTF_MAKEBACKUP,
- RTF_DEFFORMAT,
- RTF_DEFLANG,
- RTF_FTNSEP,
- RTF_FTNSEPC,
- RTF_FTNCN,
- RTF_ENDNOTES,
- RTF_ENDDOC,
- RTF_FTNTJ,
- RTF_FTNBJ,
- RTF_FTNSTART,
- RTF_FTNRESTART,
- RTF_PAPERW,
- RTF_PAPERH,
- RTF_MARGL,
- RTF_MARGR,
- RTF_MARGT,
- RTF_MARGB,
- RTF_FACINGP,
- RTF_GUTTER,
- RTF_MARGMIRROR,
- RTF_LANDSCAPE,
- RTF_PGNSTART,
- RTF_WIDOWCTRL,
- RTF_REVISIONS,
- RTF_REVPROP,
- RTF_REVBAR,
-
- RTF_AENDDOC,
- RTF_AENDNOTES,
- RTF_AFTNBJ,
- RTF_AFTNCN,
- RTF_AFTNNALC,
- RTF_AFTNNAR,
- RTF_AFTNNAUC,
- RTF_AFTNNCHI,
- RTF_AFTNNRLC,
- RTF_AFTNNRUC,
- RTF_AFTNRESTART,
- RTF_AFTNRSTCONT,
- RTF_AFTNSEP,
- RTF_AFTNSEPC,
- RTF_AFTNSTART,
- RTF_AFTNTJ,
- RTF_ALLPROT,
- RTF_ANNOTPROT,
- RTF_ATNAUTHOR,
- RTF_ATNICN,
- RTF_ATNREF,
- RTF_ATNTIME,
- RTF_ATRFEND,
- RTF_ATRFSTART,
- RTF_BRKFRM,
- RTF_CVMME,
- RTF_FET,
- RTF_FLDALT,
- RTF_FORMDISP,
- RTF_FORMPROT,
- RTF_FORMSHADE,
- RTF_FTNALT,
- RTF_FTNNALC,
- RTF_FTNNAR,
- RTF_FTNNAUC,
- RTF_FTNNCHI,
- RTF_FTNNRLC,
- RTF_FTNNRUC,
- RTF_FTNRSTCONT,
- RTF_FTNRSTPG,
- RTF_HYPHAUTO,
- RTF_HYPHCAPS,
- RTF_HYPHCONSEC,
- RTF_LINKSTYLES,
- RTF_LTRDOC,
- RTF_NOCOLBAL,
- RTF_NOEXTRASPRL,
- RTF_NOTABIND,
- RTF_OTBLRUL,
- RTF_PRCOLBL,
- RTF_PRINTDATA,
- RTF_PSZ,
- RTF_REVPROT,
- RTF_RTLDOC,
- RTF_SPRSSPBF,
- RTF_SPRSTSP,
- RTF_SWPBDR,
- RTF_TRANSMF,
- RTF_WRAPTRSP,
-
- RTF_PRIVATE,
- RTF_NOULTRLSPC,
- RTF_MSMCAP,
- RTF_NOLEAD,
- RTF_NOSPACEFORUL,
- RTF_LYTEXCTTP,
- RTF_LYTPRTMET,
- RTF_DNTBLNSBDB,
- RTF_FROMTEXT,
- RTF_EXPSHRTN,
- RTF_PGBRDRT,
- RTF_SPRSBSP,
- RTF_PGBRDRR,
- RTF_PGBRDRSNAP,
- RTF_BDBFHDR,
- RTF_SUBFONTBYSIZE,
- RTF_TRUNCATEFONTHEIGHT,
- RTF_SPRSLNSP,
- RTF_SPRSTSM,
- RTF_PGBRDRL,
- RTF_WPJST,
- RTF_PGBRDRB,
- RTF_WPSP,
- RTF_NOXLATTOYEN,
- RTF_OLDLINEWRAP,
- RTF_PGBRDRFOOT,
- RTF_PGBRDRHEAD,
- RTF_DEFLANGFE,
- RTF_DOCTYPE,
- RTF_PGBRDROPT,
- RTF_VIEWKIND,
- RTF_VIEWSCALE,
- RTF_WINDOWCAPTION,
- RTF_BRDRART,
- RTF_VIEWZK,
- RTF_DOCVAR,
-
- RTF_DGMARGIN,
- RTF_AFTNNCHOSUNG,
- RTF_AFTNNCNUM,
- RTF_AFTNNDBAR,
- RTF_AFTNNDBNUM,
- RTF_AFTNNDBNUMD,
- RTF_AFTNNDBNUMK,
- RTF_AFTNNDBNUMT,
- RTF_AFTNNGANADA,
- RTF_AFTNNGBNUM,
- RTF_AFTNNGBNUMD,
- RTF_AFTNNGBNUMK,
- RTF_AFTNNGBNUML,
- RTF_AFTNNZODIAC,
- RTF_AFTNNZODIACD,
- RTF_AFTNNZODIACL,
- RTF_FTNNCHOSUNG,
- RTF_FTNNCNUM,
- RTF_FTNNDBAR,
- RTF_FTNNDBNUM,
- RTF_FTNNDBNUMD,
- RTF_FTNNDBNUMK,
- RTF_FTNNDBNUMT,
- RTF_FTNNGANADA,
- RTF_FTNNGBNUM,
- RTF_FTNNGBNUMD,
- RTF_FTNNGBNUMK,
- RTF_FTNNGBNUML,
- RTF_FTNNZODIAC,
- RTF_FTNNZODIACD,
- RTF_FTNNZODIACL,
-
- RTF_ADEFLANG,
- RTF_ADEFF,
-
-/* */
-
- RTF_SECTD = RTF_SECTFMT,
- RTF_ENDNHERE,
- RTF_BINFSXN,
- RTF_BINSXN,
- RTF_SBKNONE,
- RTF_SBKCOL,
- RTF_SBKPAGE,
- RTF_SBKEVEN,
- RTF_SBKODD,
- RTF_COLS,
- RTF_COLSX,
- RTF_COLNO,
- RTF_COLSR,
- RTF_COLW,
- RTF_LINEBETCOL,
- RTF_LINEMOD,
- RTF_LINEX,
- RTF_LINESTARTS,
- RTF_LINERESTART,
- RTF_LINEPAGE,
- RTF_LINECONT,
- RTF_PGWSXN,
- RTF_PGHSXN,
- RTF_MARGLSXN,
- RTF_MARGRSXN,
- RTF_MARGTSXN,
- RTF_MARGBSXN,
- RTF_GUTTERSXN,
- RTF_LNDSCPSXN,
- RTF_FACPGSXN,
- RTF_TITLEPG,
- RTF_HEADERY,
- RTF_FOOTERY,
- RTF_PGNSTARTS,
- RTF_PGNCONT,
- RTF_PGNRESTART,
- RTF_PGNX,
- RTF_PGNY,
- RTF_PGNDEC,
- RTF_PGNUCRM,
- RTF_PGNLCRM,
- RTF_PGNUCLTR,
- RTF_PGNLCLTR,
- RTF_VERTALT,
- RTF_VERTALB,
- RTF_VERTALC,
- RTF_VERTALJ,
-
- RTF_FOOTER,
- RTF_FOOTERL,
- RTF_FOOTERR,
- RTF_FOOTERF,
- RTF_HEADER,
- RTF_HEADERL,
- RTF_HEADERR,
- RTF_HEADERF,
- RTF_DS,
- RTF_LTRSECT,
- RTF_PGNHN,
- RTF_PGNHNSC,
- RTF_PGNHNSH,
- RTF_PGNHNSM,
- RTF_PGNHNSN,
- RTF_PGNHNSP,
- RTF_RTLSECT,
- RTF_SECTUNLOCKED,
- RTF_STEXTFLOW,
- RTF_PGNCHOSUNG,
- RTF_PGNCNUM,
- RTF_PGNDBNUMK,
- RTF_PGNDBNUMT,
- RTF_PGNGANADA,
- RTF_PGNGBNUM,
- RTF_PGNGBNUMD,
- RTF_PGNGBNUMK,
- RTF_PGNGBNUML,
- RTF_PGNZODIAC,
- RTF_PGNZODIACD,
- RTF_PGNZODIACL,
- RTF_SECTDEFAULTCL,
- RTF_SECTEXPAND,
- RTF_SECTLINEGRID,
- RTF_SECTSPECIFYCL,
- RTF_SECTSPECIFYL,
-
- // Swg-Header/Footer-Tokens
- RTF_HEADER_YB = (RTF_SECTFMT|RTF_SWGDEFS),
- RTF_HEADER_XL,
- RTF_HEADER_XR,
- RTF_FOOTER_YT,
- RTF_FOOTER_XL,
- RTF_FOOTER_XR,
- RTF_HEADER_YH,
- RTF_FOOTER_YH,
- RTF_BALANCED_COLUMN,
-
-
-/* */
-
- RTF_PARD = RTF_PARFMT,
- RTF_S,
- RTF_INTBL,
- RTF_KEEP,
- RTF_KEEPN,
- RTF_LEVEL,
- RTF_PAGEBB,
- RTF_SBYS,
- RTF_QL,
- RTF_QR,
- RTF_QJ,
- RTF_QC,
- RTF_FI,
- RTF_LI,
- RTF_LIN,
- RTF_RI,
- RTF_RIN,
- RTF_SB,
- RTF_SA,
- RTF_SL,
- RTF_HYPHPAR,
- RTF_LTRPAR,
- RTF_NOWIDCTLPAR,
- RTF_RTLPAR,
- RTF_SLMULT,
- RTF_SUBDOCUMENT,
-
- RTF_WIDCTLPAR,
-
- RTF_LISTTEXT,
- RTF_POSYIN,
- RTF_PNRNOT,
- RTF_BRDRDASHDOTSTR,
- RTF_POSYOUT,
- RTF_BRDRDASHD,
- RTF_BRDRDASHDD,
- RTF_BRDRENGRAVE,
- RTF_BRDRTHTNLG,
- RTF_BRDREMBOSS,
- RTF_BRDRTNTHTNLG,
- RTF_BRDRDASHSM,
- RTF_BRDRTHTNMG,
- RTF_OVERLAY,
- RTF_BRDRTNTHSG,
- RTF_BRDRTNTHMG,
- RTF_BRDRTHTNSG,
- RTF_BRDRTNTHLG,
- RTF_BRDRTRIPLE,
- RTF_BRDRTNTHTNSG,
- RTF_BRDRTNTHTNMG,
- RTF_BRDRWAVYDB,
- RTF_BRDRWAVY,
- RTF_ILVL,
- RTF_DFRSTOP,
- RTF_DFRXST,
- RTF_PNRAUTH,
- RTF_DFRSTART,
- RTF_OUTLINELEVEL,
- RTF_DFRAUTH,
- RTF_DFRDATE,
- RTF_PNRRGB,
- RTF_PNRPNBR,
- RTF_PNRSTART,
- RTF_PNRXST,
- RTF_PNRSTOP,
- RTF_PNRDATE,
- RTF_PNRNFC,
- RTF_NOSNAPLINEGRID,
- RTF_FAAUTO,
- RTF_FAHANG,
- RTF_FAVAR,
- RTF_FACENTER,
- RTF_FAROMAN,
- RTF_FAFIXED,
- RTF_ADJUSTRIGHT,
- RTF_LS,
- RTF_NOCWRAP,
- RTF_NOOVERFLOW,
- RTF_ASPALPHA,
-
-
-/* */
-
- RTF_TX = RTF_TABSTOPDEF,
- RTF_TB,
- RTF_TQL,
- RTF_TQR,
- RTF_TQC,
- RTF_TQDEC,
- RTF_TLDOT,
- RTF_TLHYPH,
- RTF_TLUL,
- RTF_TLTH,
- RTF_TLEQ,
-
- // Swg-TabStop-Tokens
- RTF_TLSWG = (RTF_TABSTOPDEF|RTF_SWGDEFS),
-
-/* */
-
- RTF_BRDRT = RTF_BRDRDEF,
- RTF_BRDRB,
- RTF_BRDRL,
- RTF_BRDRR,
- RTF_BRDRBTW,
- RTF_BRDRBAR,
- RTF_BOX,
- RTF_BRSP,
- RTF_BRDRW,
- RTF_BRDRCF,
- RTF_BRDRS,
- RTF_BRDRTH,
- RTF_BRDRSH,
- RTF_BRDRDB,
- RTF_BRDRDOT,
- RTF_BRDRHAIR,
- RTF_BRDRDASH,
- RTF_BRDRFRAME,
-
- // Swg-Border-Tokens
- RTF_BRDBOX = (RTF_BRDRDEF|RTF_SWGDEFS),
- RTF_BRDLINE_COL,
- RTF_BRDLINE_IN,
- RTF_BRDLINE_OUT,
- RTF_BRDLINE_DIST,
-
-/* */
-
- RTF_PLAIN = RTF_CHRFMT,
- RTF_B,
- RTF_CAPS,
- RTF_DN,
- RTF_SUB,
- RTF_NOSUPERSUB,
- RTF_EXPND,
- RTF_EXPNDTW,
- RTF_KERNING,
- RTF_F,
- RTF_FS,
- RTF_I,
- RTF_OUTL,
- RTF_SCAPS,
- RTF_SHAD,
- RTF_STRIKE,
- RTF_UL,
- RTF_ULD,
- RTF_ULDB,
- RTF_ULNONE,
- RTF_ULW,
- RTF_OL,
- RTF_OLD,
- RTF_OLDB,
- RTF_OLNONE,
- RTF_OLW,
- RTF_UP,
- RTF_SUPER,
- RTF_V,
- RTF_CF,
- RTF_CB,
- RTF_LANG,
- RTF_CCHS,
- RTF_CS,
- RTF_LTRCH,
- RTF_REVAUTH,
- RTF_REVDTTM,
- RTF_RTLCH,
-
- RTF_CHBGFDIAG,
- RTF_CHBGDKVERT,
- RTF_CHBGDKHORIZ,
- RTF_CHBRDR,
- RTF_CHBGVERT,
- RTF_CHBGHORIZ,
- RTF_CHBGDKFDIAG,
- RTF_CHBGDCROSS,
- RTF_CHBGCROSS,
- RTF_CHBGBDIAG,
- RTF_CHBGDKDCROSS,
- RTF_CHBGDKCROSS,
- RTF_CHBGDKBDIAG,
- RTF_ULDASHD,
- RTF_ULDASH,
- RTF_ULDASHDD,
- RTF_ULWAVE,
- RTF_ULC,
- RTF_ULTH,
- RTF_OLDASHD,
- RTF_OLDASH,
- RTF_OLDASHDD,
- RTF_OLWAVE,
- RTF_OLC,
- RTF_OLTH,
- RTF_EMBO,
- RTF_IMPR,
- RTF_STRIKED,
- RTF_CRDATE,
- RTF_CRAUTH,
- RTF_CHARSCALEX,
- RTF_CHCBPAT,
- RTF_CHCFPAT,
- RTF_CHSHDNG,
- RTF_REVAUTHDEL,
- RTF_REVDTTMDEL,
- RTF_CGRID,
- RTF_GCW,
- RTF_NOSECTEXPAND,
- RTF_GRIDTBL,
- RTF_G,
- RTF_ANIMTEXT,
- RTF_ULTHD,
- RTF_ULTHDASH,
- RTF_ULLDASH,
- RTF_ULTHLDASH,
- RTF_ULTHDASHD,
- RTF_ULTHDASHDD,
- RTF_ULHWAVE,
- RTF_ULULDBWAVE,
- RTF_OLTHD,
- RTF_OLTHDASH,
- RTF_OLLDASH,
- RTF_OLTHLDASH,
- RTF_OLTHDASHD,
- RTF_OLTHDASHDD,
- RTF_OLHWAVE,
- RTF_OLOLDBWAVE,
-
- // association control words
- RTF_AB,
- RTF_ACAPS,
- RTF_ACF,
- RTF_ADN,
- RTF_AEXPND,
- RTF_AF,
- RTF_AFS,
- RTF_AI,
- RTF_ALANG,
- RTF_AOUTL,
- RTF_ASCAPS,
- RTF_ASHAD,
- RTF_ASTRIKE,
- RTF_AUL,
- RTF_AULD,
- RTF_AULDB,
- RTF_AULNONE,
- RTF_AULW,
- RTF_AUP,
-
- RTF_LOCH,
- RTF_HICH,
- RTF_DBCH,
- RTF_LANGFE,
- RTF_ACCNONE,
- RTF_ACCDOT,
- RTF_ACCCOMMA,
- RTF_TWOINONE,
- RTF_HORZVERT,
-
- // Swg-Border-Tokens
- RTF_SWG_ESCPROP = (RTF_CHRFMT|RTF_SWGDEFS),
- RTF_HYPHEN,
- RTF_HYPHLEAD,
- RTF_HYPHTRAIL,
- RTF_HYPHMAX,
-
-
-/* */
-
- RTF_CHDATE = RTF_SPECCHAR,
- RTF_CHDATEL,
- RTF_CHDATEA,
- RTF_CHTIME,
- RTF_CHPGN,
- RTF_CHFTN,
- RTF_CHATN,
- RTF_CHFTNSEP,
- RTF_CHFTNSEPC,
- RTF_CELL,
- RTF_ROW,
- RTF_PAR,
- RTF_SECT,
- RTF_PAGE,
- RTF_COLUM,
- RTF_LINE,
- RTF_TAB,
- RTF_EMDASH,
- RTF_ENDASH,
- RTF_BULLET,
- RTF_LQUOTE,
- RTF_RQUOTE,
- RTF_LDBLQUOTE,
- RTF_RDBLQUOTE,
- RTF_FORMULA,
- RTF_NONBREAKINGSPACE,
- RTF_OPTIONALHYPHEN,
- RTF_NONBREAKINGHYPHEN,
- RTF_SUBENTRYINDEX,
- RTF_IGNOREFLAG,
- RTF_HEX,
- RTF_EMSPACE,
- RTF_ENSPACE,
- RTF_LTRMARK,
- RTF_SECTNUM,
- RTF_SOFTCOL,
- RTF_SOFTLHEIGHT,
- RTF_SOFTLINE,
- RTF_SOFTPAGE,
- RTF_ZWJ,
- RTF_ZWNJ,
-
-/* */
-
- RTF_ABSW = RTF_APOCTL,
- RTF_ABSH,
- RTF_NOWRAP,
- RTF_DXFRTEXT,
- RTF_DFRMTXTX,
- RTF_DFRMTXTY,
- RTF_DROPCAPLI,
- RTF_DROPCAPT,
- RTF_ABSNOOVRLP,
- RTF_PHMRG,
- RTF_PHPG,
- RTF_PHCOL,
- RTF_POSX,
- RTF_POSNEGX,
- RTF_POSXC,
- RTF_POSXI,
- RTF_POSXO,
- RTF_POSXL,
- RTF_POSXR,
- RTF_PVMRG,
- RTF_PVPG,
- RTF_PVPARA,
- RTF_POSY,
- RTF_POSNEGY,
- RTF_POSYT,
- RTF_POSYIL,
- RTF_POSYB,
- RTF_POSYC,
- RTF_ABSLOCK,
- RTF_FRMTXLRTB,
- RTF_FRMTXTBRL,
- RTF_FRMTXBTLR,
- RTF_FRMTXLRTBV,
- RTF_FRMTXTBRLV,
-
- // Swg-Frame-Tokens
- RTF_FLYPRINT = (RTF_APOCTL|RTF_SWGDEFS),
- RTF_FLYOPAQUE,
- RTF_FLYPRTCTD,
- RTF_FLYMAINCNT,
- RTF_FLYVERT,
- RTF_FLYHORZ,
- RTF_FLYOUTLEFT,
- RTF_FLYOUTRIGHT,
- RTF_FLYOUTUPPER,
- RTF_FLYOUTLOWER,
- RTF_FLYANCHOR,
- RTF_FLY_CNTNT,
- RTF_FLY_COLUMN,
- RTF_FLY_PAGE,
- RTF_FLY_INPARA,
-
-
-/* */
-
- RTF_SHADING = RTF_SHADINGDEF,
- RTF_CFPAT,
- RTF_CBPAT,
- RTF_BGHORIZ,
- RTF_BGVERT,
- RTF_BGFDIAG,
- RTF_BGBDIAG,
- RTF_BGCROSS,
- RTF_BGDCROSS,
- RTF_BGDKHORIZ,
- RTF_BGDKVERT,
- RTF_BGDKFDIAG,
- RTF_BGDKBDIAG,
- RTF_BGDKCROSS,
- RTF_BGDKDCROSS,
-
-/* */
-
- RTF_TROWD = RTF_TABLEDEF,
- RTF_TRGAPH,
- RTF_TRLEFT,
- RTF_TRRH,
-
- RTF_TRQL,
- RTF_TRQR,
- RTF_TRQC,
-
- RTF_CLMGF,
- RTF_CLMRG,
- RTF_CELLX,
- RTF_LTRROW,
- RTF_RTLROW,
- RTF_TRBRDRB,
- RTF_TRBRDRH,
- RTF_TRBRDRL,
- RTF_TRBRDRR,
- RTF_TRBRDRT,
- RTF_TRBRDRV,
- RTF_TRHDR,
- RTF_TRKEEP,
- RTF_TRPADDB,
- RTF_TRPADDL,
- RTF_TRPADDR,
- RTF_TRPADDT,
- RTF_TRPADDFB,
- RTF_TRPADDFL,
- RTF_TRPADDFR,
- RTF_TRPADDFT,
- RTF_TCELLD,
- RTF_CLTXTBRL,
- RTF_CLTXLRTB,
- RTF_CLVERTALB,
- RTF_CLVERTALT,
- RTF_CLVERTALC,
- RTF_CLVMGF,
- RTF_CLVMRG,
- RTF_CLTXTBRLV,
- RTF_CLTXBTLR,
- RTF_CLTXLRTBV,
- RTF_CLPADL,
- RTF_CLPADT,
- RTF_CLPADB,
- RTF_CLPADR,
- RTF_CLPADFL,
- RTF_CLPADFT,
- RTF_CLPADFB,
- RTF_CLPADFR,
-
-
- RTF_CLBRDRT = (RTF_BRDRDEF|RTF_TABLEDEF),
- RTF_CLBRDRL,
- RTF_CLBRDRB,
- RTF_CLBRDRR,
-
- RTF_CLCFPAT = (RTF_SHADINGDEF|RTF_TABLEDEF),
- RTF_CLCBPAT,
- RTF_CLSHDNG,
- RTF_CLBGHORIZ,
- RTF_CLBGVERT,
- RTF_CLBGFDIAG,
- RTF_CLBGBDIAG,
- RTF_CLBGCROSS,
- RTF_CLBGDCROSS,
- RTF_CLBGDKHOR,
- RTF_CLBGDKVERT,
- RTF_CLBGDKFDIAG,
- RTF_CLBGDKBDIAG,
- RTF_CLBGDKCROSS,
- RTF_CLBGDKDCROSS,
-
-/* */
-
-
-/* */
-
- RTF_DO = RTF_DRAWOBJECTS,
- RTF_DOBXCOLUMN,
- RTF_DOBXMARGIN,
- RTF_DOBXPAGE,
- RTF_DOBYMARGIN,
- RTF_DOBYPAGE,
- RTF_DOBYPARA,
- RTF_DODHGT,
- RTF_DOLOCK,
- RTF_DPAENDHOL,
- RTF_DPAENDL,
- RTF_DPAENDSOL,
- RTF_DPAENDW,
- RTF_DPARC,
- RTF_DPARCFLIPX,
- RTF_DPARCFLIPY,
- RTF_DPASTARTHOL,
- RTF_DPASTARTL,
- RTF_DPASTARTSOL,
- RTF_DPASTARTW,
- RTF_DPCALLOUT,
- RTF_DPCOA,
- RTF_DPCOACCENT,
- RTF_DPCOBESTFIT,
- RTF_DPCOBORDER,
- RTF_DPCODABS,
- RTF_DPCODBOTTOM,
- RTF_DPCODCENTER,
- RTF_DPCODTOP,
- RTF_DPCOLENGTH,
- RTF_DPCOMINUSX,
- RTF_DPCOMINUSY,
- RTF_DPCOOFFSET,
- RTF_DPCOSMARTA,
- RTF_DPCOTDOUBLE,
- RTF_DPCOTRIGHT,
- RTF_DPCOTSINGLE,
- RTF_DPCOTTRIPLE,
- RTF_DPCOUNT,
- RTF_DPELLIPSE,
- RTF_DPENDGROUP,
- RTF_DPFILLBGCB,
- RTF_DPFILLBGCG,
- RTF_DPFILLBGCR,
- RTF_DPFILLBGGRAY,
- RTF_DPFILLBGPAL,
- RTF_DPFILLFGCB,
- RTF_DPFILLFGCG,
- RTF_DPFILLFGCR,
- RTF_DPFILLFGGRAY,
- RTF_DPFILLFGPAL,
- RTF_DPFILLPAT,
- RTF_DPGROUP,
- RTF_DPLINE,
- RTF_DPLINECOB,
- RTF_DPLINECOG,
- RTF_DPLINECOR,
- RTF_DPLINEDADO,
- RTF_DPLINEDADODO,
- RTF_DPLINEDASH,
- RTF_DPLINEDOT,
- RTF_DPLINEGRAY,
- RTF_DPLINEHOLLOW,
- RTF_DPLINEPAL,
- RTF_DPLINESOLID,
- RTF_DPLINEW,
- RTF_DPPOLYCOUNT,
- RTF_DPPOLYGON,
- RTF_DPPOLYLINE,
- RTF_DPPTX,
- RTF_DPPTY,
- RTF_DPRECT,
- RTF_DPROUNDR,
- RTF_DPSHADOW,
- RTF_DPSHADX,
- RTF_DPSHADY,
- RTF_DPTXBX,
- RTF_DPTXBXMAR,
- RTF_DPTXBXTEXT,
- RTF_DPX,
- RTF_DPXSIZE,
- RTF_DPY,
- RTF_DPYSIZE,
-
- RTF_DPCODESCENT,
- RTF_BACKGROUND,
- RTF_SHPBYPAGE,
- RTF_SHPBYPARA,
- RTF_SHPBYMARGIN,
- RTF_SHPBXCOLUMN,
- RTF_SHPBXMARGIN,
- RTF_SHPBXPAGE,
- RTF_SHPLOCKANCHOR,
- RTF_SHPWR,
- RTF_HLLOC,
- RTF_HLSRC,
- RTF_SHPWRK,
- RTF_SHPTOP,
- RTF_SHPRSLT,
- RTF_HLFR,
- RTF_SHPTXT,
- RTF_SHPFHDR,
- RTF_SHPGRP,
- RTF_SHPRIGHT,
- RTF_SHPFBLWTXT,
- RTF_SHPZ,
- RTF_SHPBOTTOM,
- RTF_SHPLEFT,
- RTF_SHPLID,
-
-/* */
-
- RTF_OBJALIAS = RTF_OBJECTS,
- RTF_OBJALIGN,
- RTF_OBJAUTLINK,
- RTF_OBJCLASS,
- RTF_OBJCROPB,
- RTF_OBJCROPL,
- RTF_OBJCROPR,
- RTF_OBJCROPT,
- RTF_OBJDATA,
- RTF_OBJECT,
- RTF_OBJEMB,
- RTF_OBJH,
- RTF_OBJICEMB,
- RTF_OBJLINK,
- RTF_OBJLOCK,
- RTF_OBJNAME,
- RTF_OBJPUB,
- RTF_OBJSCALEX,
- RTF_OBJSCALEY,
- RTF_OBJSECT,
- RTF_OBJSETSIZE,
- RTF_OBJSUB,
- RTF_OBJTIME,
- RTF_OBJTRANSY,
- RTF_OBJUPDATE,
- RTF_OBJW,
- RTF_RESULT,
- RTF_RSLTBMP,
- RTF_RSLTMERGE,
- RTF_RSLTPICT,
- RTF_RSLTRTF,
- RTF_RSLTTXT,
- RTF_OBJOCX,
- RTF_OBJHTML,
- RTF_OBJATTPH,
-
-/* */
-
- RTF_PN = RTF_NUMBULLETS,
- RTF_PNACROSS,
- RTF_PNB,
- RTF_PNCAPS,
- RTF_PNCARD,
- RTF_PNCF,
- RTF_PNDEC,
- RTF_PNF,
- RTF_PNFS,
- RTF_PNHANG,
- RTF_PNI,
- RTF_PNINDENT,
- RTF_PNLCLTR,
- RTF_PNLCRM,
- RTF_PNLVL,
- RTF_PNLVLBLT,
- RTF_PNLVLBODY,
- RTF_PNLVLCONT,
- RTF_PNNUMONCE,
- RTF_PNORD,
- RTF_PNORDT,
- RTF_PNPREV,
- RTF_PNQC,
- RTF_PNQL,
- RTF_PNQR,
- RTF_PNRESTART,
- RTF_PNSCAPS,
- RTF_PNSECLVL,
- RTF_PNSP,
- RTF_PNSTART,
- RTF_PNSTRIKE,
- RTF_PNTEXT,
- RTF_PNTXTA,
- RTF_PNTXTB,
- RTF_PNUCLTR,
- RTF_PNUCRM,
- RTF_PNUL,
- RTF_PNULD,
- RTF_PNULDB,
- RTF_PNULNONE,
- RTF_PNULW,
- RTF_LIST,
- RTF_LISTLEVEL,
- RTF_LISTOVERRIDE,
- RTF_LISTOVERRIDETABLE,
- RTF_LISTTABLE,
- RTF_LISTNAME,
- RTF_LEVELNUMBERS,
- RTF_LEVELNORESTART,
- RTF_LEVELNFC,
- RTF_LEVELOLD,
- RTF_LISTOVERRIDECOUNT,
- RTF_LISTTEMPLATEID,
- RTF_LEVELINDENT,
- RTF_LEVELFOLLOW,
- RTF_LEVELLEGAL,
- RTF_LEVELJC,
- RTF_LISTOVERRIDESTART,
- RTF_LISTID,
- RTF_LISTRESTARTHDN,
- RTF_LEVELTEXT,
- RTF_LISTOVERRIDEFORMAT,
- RTF_LEVELPREVSPACE,
- RTF_LEVELPREV,
- RTF_LEVELSPACE,
- RTF_LISTSIMPLE,
- RTF_LEVELSTARTAT,
- RTF_PNAIUEO,
- RTF_PNAIUEOD,
- RTF_PNCHOSUNG,
- RTF_PNDBNUMD,
- RTF_PNDBNUMK,
- RTF_PNDBNUML,
- RTF_PNDBNUMT,
- RTF_PNGANADA,
- RTF_PNGBNUM,
- RTF_PNGBNUMD,
- RTF_PNGBNUMK,
- RTF_PNGBNUML,
- RTF_PNZODIAC,
- RTF_PNZODIACD,
- RTF_PNZODIACL,
- RTF_LFOLEVEL,
-
-/* */
-
- RTF_GRF_ALIGNV= RTF_SWGDEFS,
- RTF_GRF_ALIGNH,
- RTF_GRF_MIRROR,
- RTF_SWG_PRTDATA,
- RTF_BKMK_KEY,
- RTF_SHADOW,
- RTF_SHDW_DIST,
- RTF_SHDW_STYLE,
- RTF_SHDW_COL,
- RTF_SHDW_FCOL,
- RTF_PGDSCTBL,
- RTF_PGDSC,
- RTF_PGDSCUSE,
- RTF_PGDSCNXT,
- RTF_PGDSCNO,
- RTF_PGBRK,
- RTF_SOUTLVL,
-
-// shapes
- RTF_SHP, RTF_SN, RTF_SV
-/*
- RTF_SHPLEFT,
- RTF_SHPTOP,
- RTF_SHPBOTTOM,
- RTF_SHPRIGHT
-*/
-
-};
-
-#endif // _RTFTOKEN_H
-
-/* vi:set tabstop=4 shiftwidth=4 expandtab: */
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index c7444dd5cbcb..2af7af71adac 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -37,7 +37,7 @@
#include <tools/stream.hxx>
#include <tools/debug.hxx>
#define _SVSTDARR_USHORTS
-#include <svtools/svstdarr.hxx>
+#include <svl/svstdarr.hxx>
#include <rtl/textcvt.h>
#include <rtl/tencinfo.h>
@@ -66,7 +66,7 @@ struct SvParser_Impl
rtl_TextToUnicodeConverter hConv;
rtl_TextToUnicodeContext hContext;
-#ifndef PRODUCT
+#ifdef DBG_UTIL
SvFileStream aOut;
#endif
@@ -100,7 +100,7 @@ SvParser::SvParser( SvStream& rIn, BYTE nStackSize )
pTokenStack = new TokenStackType[ nTokenStackSize ];
pTokenStackPos = pTokenStack;
-#ifndef PRODUCT
+#ifdef DBG_UTIL
// wenn die Datei schon existiert, dann Anhaengen:
if( !pImplData )
@@ -119,7 +119,7 @@ SvParser::SvParser( SvStream& rIn, BYTE nStackSize )
SvParser::~SvParser()
{
-#ifndef PRODUCT
+#ifdef DBG_UTIL
if( pImplData->aOut.IsOpen() )
pImplData->aOut << "\n\n >>>>>>>>>>>>>>> Dump Ende <<<<<<<<<<<<<<<\n";
pImplData->aOut.Close();
@@ -417,7 +417,7 @@ sal_Unicode SvParser::GetNextChar()
return sal_Unicode(EOF);
}
-#ifndef PRODUCT
+#ifdef DBG_UTIL
if( pImplData->aOut.IsOpen() )
pImplData->aOut << ByteString::ConvertFromUnicode( c,
RTL_TEXTENCODING_MS_1251 );
diff --git a/svtools/source/svsql/converter.cxx b/svtools/source/svsql/converter.cxx
deleted file mode 100644
index c87290265e90..000000000000
--- a/svtools/source/svsql/converter.cxx
+++ /dev/null
@@ -1,45 +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: converter.cxx,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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_svtools.hxx"
-#include "converter.hxx"
-
-INT32 SvDbaseConverter::ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale)
-{
- return _nScale ? _nLen +2 : _nLen +1;
-}
-//------------------------------------------------------------------------
-INT32 SvDbaseConverter::ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale)
-{
- return _nScale ? _nLen -2 : _nLen -1;
-}
-
-
diff --git a/svtools/source/svsql/converter.hxx b/svtools/source/svsql/converter.hxx
deleted file mode 100644
index f6a5d67ca966..000000000000
--- a/svtools/source/svsql/converter.hxx
+++ /dev/null
@@ -1,46 +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: converter.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.
- *
- ************************************************************************/
-#ifndef _SV_CONVERTER_HXX_
-#define _SV_CONVERTER_HXX_
-
-#include "svtools/svldllapi.h"
-#include <tools/solar.h>
-
-class SvDbaseConverter
-{
-public:
- SVL_DLLPUBLIC static INT32 ConvertPrecisionToDbase(INT32 _nLen, INT32 _nScale);
- SVL_DLLPUBLIC static INT32 ConvertPrecisionToOdbc(INT32 _nLen, INT32 _nScale);
-};
-
-#endif //_CONVERTER_HXX_
-
-
-
diff --git a/svtools/source/svsql/makefile.mk b/svtools/source/svsql/makefile.mk
deleted file mode 100644
index 55c400b83ef3..000000000000
--- a/svtools/source/svsql/makefile.mk
+++ /dev/null
@@ -1,50 +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: makefile.mk,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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=svsql
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svl.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/converter.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/syslocale/makefile.mk b/svtools/source/syslocale/makefile.mk
deleted file mode 100644
index a393c174856f..000000000000
--- a/svtools/source/syslocale/makefile.mk
+++ /dev/null
@@ -1,48 +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: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=syslocale
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svt.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/syslocale.obj
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
diff --git a/svtools/source/syslocale/syslocale.cxx b/svtools/source/syslocale/syslocale.cxx
deleted file mode 100644
index 9811d97fd964..000000000000
--- a/svtools/source/syslocale/syslocale.cxx
+++ /dev/null
@@ -1,176 +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: syslocale.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-#ifndef GCC
-#endif
-
-#include <svtools/syslocale.hxx>
-#include <broadcast.hxx>
-#include <listener.hxx>
-#include <svtools/smplhint.hxx>
-#include <vcl/svapp.hxx>
-#include <tools/string.hxx>
-#include <svtools/syslocaleoptions.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <comphelper/processfactory.hxx>
-
-
-using namespace osl;
-using namespace com::sun::star;
-
-
-SvtSysLocale_Impl* SvtSysLocale::pImpl = NULL;
-sal_Int32 SvtSysLocale::nRefCount = 0;
-
-
-class SvtSysLocale_Impl : public SvtListener
-{
- friend class SvtSysLocale;
-
- SvtSysLocaleOptions aSysLocaleOptions;
- LocaleDataWrapper* pLocaleData;
- CharClass* pCharClass;
-
-public:
- SvtSysLocale_Impl();
- virtual ~SvtSysLocale_Impl();
-
- virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint );
-
- CharClass* GetCharClass();
-
-};
-
-
-// -----------------------------------------------------------------------
-
-SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL)
-{
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pLocaleData = new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(), rLocale );
- aSysLocaleOptions.AddListener( *this );
-}
-
-
-SvtSysLocale_Impl::~SvtSysLocale_Impl()
-{
- aSysLocaleOptions.RemoveListener( *this );
- delete pCharClass;
- delete pLocaleData;
-}
-
-CharClass* SvtSysLocale_Impl::GetCharClass()
-{
- if ( !pCharClass )
- {
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), rLocale );
- }
- return pCharClass;
-}
-void SvtSysLocale_Impl::Notify( SvtBroadcaster&, const SfxHint& rHint )
-{
- const SfxSimpleHint* p = PTR_CAST( SfxSimpleHint, &rHint );
- if( p && (p->GetId() & SYSLOCALEOPTIONS_HINT_LOCALE) )
- {
- MutexGuard aGuard( SvtSysLocale::GetMutex() );
- const lang::Locale& rLocale = Application::GetSettings().GetLocale();
- pLocaleData->setLocale( rLocale );
- GetCharClass()->setLocale( rLocale );
- }
-}
-
-
-// ====================================================================
-
-SvtSysLocale::SvtSysLocale()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !pImpl )
- pImpl = new SvtSysLocale_Impl;
- ++nRefCount;
-}
-
-
-SvtSysLocale::~SvtSysLocale()
-{
- MutexGuard aGuard( GetMutex() );
- if ( !--nRefCount )
- {
- delete pImpl;
- pImpl = NULL;
- }
-}
-
-
-// static
-Mutex& SvtSysLocale::GetMutex()
-{
- static Mutex* pMutex = NULL;
- if( !pMutex )
- {
- MutexGuard aGuard( Mutex::getGlobalMutex() );
- if( !pMutex )
- {
- // #i77768# Due to a static reference in the toolkit lib
- // we need a mutex that lives longer than the svtools library.
- // Otherwise the dtor would use a destructed mutex!!
- pMutex = new Mutex;
- }
- }
- return *pMutex;
-}
-
-
-const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const
-{
- return *(pImpl->pLocaleData);
-}
-
-
-const LocaleDataWrapper* SvtSysLocale::GetLocaleDataPtr() const
-{
- return pImpl->pLocaleData;
-}
-
-
-const CharClass& SvtSysLocale::GetCharClass() const
-{
- return *(pImpl->GetCharClass());
-}
-
-
-const CharClass* SvtSysLocale::GetCharClassPtr() const
-{
- return pImpl->GetCharClass();
-}
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index c8895a19408d..1d7b046ae94b 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -30,10 +30,35 @@
#include "tablegeometry.hxx"
#include "tablecontrol_impl.hxx"
#include "svtools/table/tabledatawindow.hxx"
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star::uno;
+using ::com::sun::star::accessibility::XAccessible;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::lang;
+using namespace utl;
+//using namespace rtl;
//........................................................................
namespace svt { namespace table
{
-//........................................................................
+ //====================================================================
+ //= AccessibleTableControl_Impl
+ //====================================================================
+ // ----------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTableHeader( AccessibleTableControlObjType _eObjType )
+ {
+ if ( m_pAccessible && m_pAccessible->isAlive() )
+ return m_pAccessible->getTableHeader( _eObjType );
+ return NULL;
+ }
+ // ----------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleTableControl_Impl::getAccessibleTable( )
+ {
+ if ( m_pAccessible && m_pAccessible->isAlive() )
+ return m_pAccessible->getTable( );
+ return NULL;
+ }
//====================================================================
//= TableControl
@@ -45,12 +70,17 @@ namespace svt { namespace table
{
m_pImpl->getDataWindow()->SetMouseButtonDownHdl( LINK( this, TableControl, ImplMouseButtonDownHdl ) );
m_pImpl->getDataWindow()->SetMouseButtonUpHdl( LINK( this, TableControl, ImplMouseButtonUpHdl ) );
+ m_pAccessTable.reset(new ::svt::table::AccessibleTableControl_Impl());
}
//--------------------------------------------------------------------
TableControl::~TableControl()
{
DELETEZ( m_pImpl );
+ if ( m_pAccessTable->m_pAccessible )
+ {
+ m_pAccessTable->m_pAccessible->dispose();
+ }
}
//--------------------------------------------------------------------
@@ -59,7 +89,7 @@ namespace svt { namespace table
if ( !m_pImpl->getInputHandler()->GetFocus( *m_pImpl ) )
{
Control::GetFocus();
- GrabFocus();
+ Control::GrabFocus();
}
}
@@ -109,13 +139,13 @@ namespace svt { namespace table
}
//--------------------------------------------------------------------
- RowPos TableControl::GetCurrentRow() const
+ sal_Int32 TableControl::GetCurrentRow() const
{
return m_pImpl->getCurRow();
}
//--------------------------------------------------------------------
- ColPos TableControl::GetCurrentColumn() const
+ sal_Int32 TableControl::GetCurrentColumn() const
{
return m_pImpl->getCurColumn();
}
@@ -126,6 +156,11 @@ namespace svt { namespace table
return m_pImpl->goTo( _nColumn, _nRow );
}
//--------------------------------------------------------------------
+ sal_Bool TableControl::GoToCell(sal_Int32 _nColPos, sal_Int32 _nRowPos)
+ {
+ return m_pImpl->goTo( _nColPos, _nRowPos );
+ }
+ //--------------------------------------------------------------------
void TableControl::InvalidateDataWindow(RowPos _nRowStart, bool _bRemoved)
{
Rectangle _rRect;
@@ -135,7 +170,7 @@ namespace svt { namespace table
return m_pImpl->invalidateRow(_nRowStart, _rRect);
}
//--------------------------------------------------------------------
- std::vector<RowPos> TableControl::getSelectedRows()
+ std::vector<sal_Int32>& TableControl::GetSelectedRows()
{
return m_pImpl->getSelectedRows();
}
@@ -174,6 +209,331 @@ namespace svt { namespace table
{
return m_pImpl->getDataWindow();
}
+
+ Reference< XAccessible > TableControl::CreateAccessible()
+ {
+ Window* pParent = GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "TableControl::CreateAccessible - parent not found" );
+
+ if( pParent && !m_pAccessTable->m_pAccessible)
+ {
+ Reference< XAccessible > xAccParent = pParent->GetAccessible();
+ if( xAccParent.is() )
+ {
+ m_pAccessTable->m_pAccessible = getAccessibleFactory().createAccessibleTableControl(
+ xAccParent, *this
+ );
+ }
+ }
+ Reference< XAccessible > xAccessible;
+ if ( m_pAccessTable->m_pAccessible )
+ xAccessible = m_pAccessTable->m_pAccessible->getMyself();
+ return xAccessible;
+ }
+ Reference<XAccessible> TableControl::CreateAccessibleControl( sal_Int32 _nIndex )
+ {
+ (void)_nIndex;
+ DBG_ASSERT( FALSE, "TableControl::CreateAccessibleControl: to be overwritten!" );
+ return NULL;
+ }
+ ::rtl::OUString TableControl::GetAccessibleObjectName( AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const
+ {
+ ::rtl::OUString aRetText;
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl" ) );
+ break;
+ case TCTYPE_TABLE:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Table" ) );
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderBar" ) );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
+ break;
+ case TCTYPE_TABLECELL:
+ aRetText = GetCellContent(_nRow, _nCol);
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ aRetText = GetRowName(_nRow);
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ aRetText = GetColumnName(_nCol);
+ break;
+ default:
+ OSL_ENSURE(0,"GridControl::GetAccessibleName: invalid enum!");
+ }
+ return aRetText;
+ }
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetAccessibleObjectDescription( AccessibleTableControlObjType eObjType, sal_Int32 ) const
+{
+ ::rtl::OUString aRetText;
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridControl description" ) );
+ break;
+ case TCTYPE_TABLE:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLE description" ) );
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERBAR description" ) );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERBAR description" ) );
+ break;
+ case TCTYPE_TABLECELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TABLECELL description" ) );
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ROWHEADERCELL description" ) );
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ aRetText = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "COLUMNHEADERCELL description" ) );
+ break;
+ }
+ return aRetText;
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetRowDescription( sal_Int32 _nRow) const
+{
+ (void)_nRow;
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "row description" ) );
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetRowName( sal_Int32 _nIndex) const
+{
+ return GetModel()->getRowHeaderName()[_nIndex];
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetColumnDescription( sal_uInt16 _nColumn) const
+{
+ (void)_nColumn;
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "col description" ) );
+}
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetColumnName( sal_Int32 _nIndex) const
+{
+ return GetModel()->getColumnModel(_nIndex)->getName();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TableControl::GetCellContent( sal_Int32 _nRowPos, sal_Int32 _nColPos) const
+{
+ ::rtl::OUString cellContent = ::rtl::OUString::createFromAscii("");
+ std::vector<std::vector<rtl::OUString> >& aTableContent = GetModel()->getCellContent();
+ if(&aTableContent)
+ {
+ std::vector<rtl::OUString>& aRowContent = aTableContent[_nRowPos];
+ if(&aRowContent)
+ cellContent = aRowContent[_nColPos];
+ }
+ return cellContent;
+}
+// -----------------------------------------------------------------------------
+
+void TableControl::FillAccessibleStateSet(
+ ::utl::AccessibleStateSetHelper& rStateSet,
+ AccessibleTableControlObjType eObjType ) const
+{
+ switch( eObjType )
+ {
+ case TCTYPE_GRIDCONTROL:
+ case TCTYPE_TABLE:
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
+ if ( HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+ if ( IsActive() )
+ rStateSet.AddState( AccessibleStateType::ACTIVE );
+ if ( IsEnabled() )
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ if ( IsReallyVisible() )
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+
+ break;
+ case TCTYPE_ROWHEADERBAR:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ break;
+ case TCTYPE_TABLECELL:
+ {
+ //sal_Int32 nRow = GetCurRow();
+ //sal_uInt16 nColumn = GetCurColumnId();
+ //if ( IsFieldVisible(nRow,nColumn) )
+ // rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ rStateSet.AddState( AccessibleStateType::SELECTABLE);
+ if( GetSelectedRowCount()>0)
+ rStateSet.AddState( AccessibleStateType::SELECTED);
+ }
+ break;
+ case TCTYPE_ROWHEADERCELL:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ break;
+ }
+}
+
+Rectangle TableControl::GetWindowExtentsRelative( Window *pRelativeWindow )
+{
+ return Control::GetWindowExtentsRelative( pRelativeWindow );
+}
+//-----------------------------------------------------------------------------
+void TableControl::GrabFocus()
+{
+ Control::GrabFocus();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > TableControl::GetAccessible( BOOL bCreate )
+{
+ return Control::GetAccessible( bCreate );
+}
+// -----------------------------------------------------------------------------
+Window* TableControl::GetAccessibleParentWindow() const
+{
+ return Control::GetAccessibleParentWindow();
+}
+// -----------------------------------------------------------------------------
+Window* TableControl::GetWindowInstance()
+{
+ return this;
+}
+
+sal_Bool TableControl::HasRowHeader()
+{
+ return GetModel()->hasRowHeaders();
+}
+//--------------------------------------------------------------------------------
+sal_Bool TableControl::HasColHeader()
+{
+ return GetModel()->hasColumnHeaders();
+}
+//--------------------------------------------------------------------------------
+sal_Int32 TableControl::GetAccessibleControlCount() const
+{
+ sal_Int32 count = 0;
+ if(GetRowCount()>0)
+ count+=1;
+ if(GetModel()->hasRowHeaders())
+ count+=1;
+ if(GetModel()->hasColumnHeaders())
+ count+=1;
+ return count;
+}
+sal_Bool TableControl::ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint )
+{
+ sal_Int32 nRow = m_pImpl->getCurrentRow(_rPoint);
+ sal_Int32 nCol = GetCurrentColumn();
+ _rnIndex = nRow * GetColumnCount() + nCol;
+ return nRow>=0 ? sal_True : sal_False;
+}
+
+long TableControl::GetRowCount() const
+{
+ return m_pImpl->getRowCount();
+}
+long TableControl::GetColumnCount() const
+{
+ return m_pImpl->getColumnCount();
+}
+sal_Bool TableControl::HasRowHeader() const
+{
+ PTableModel pModel = GetModel();
+ return pModel->hasRowHeaders();
+}
+sal_Int32 TableControl::GetSelectedRowCount() const
+{
+ return m_pImpl->getSelectedRows().size();
+}
+bool TableControl::IsRowSelected( long _nRow ) const
+{
+ return m_pImpl->isRowSelected(m_pImpl->getSelectedRows(), _nRow);
+}
+sal_Bool TableControl::ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint )
+{
+ _rnRow = m_pImpl->getCurrentRow(_rPoint);
+ _rnColPos = GetCurrentColumn();
+ return _rnRow>=0 ? sal_True : sal_False;
+}
+void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
+{
+ if ( GetCurrentRow() == _nRow && GetCurrentColumn() == _nColumnPos )
+ _rStateSet.AddState( AccessibleStateType::FOCUSED );
+ else // only transient when column is not focused
+ _rStateSet.AddState( AccessibleStateType::TRANSIENT );
+}
+Rectangle TableControl::GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex)
+{
+ (void)_nRow;
+ (void)_nColumnPos;
+ return GetCharacterBounds(nIndex);
+}
+sal_Int32 TableControl::GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint)
+{
+ (void)_nRow;
+ (void)_nColumnPos;
+ return GetIndexForPoint(_rPoint);
+;
+}
+ // -----------------------------------------------------------------------------
+sal_Bool TableControl::isAccessibleAlive( ) const
+{
+ return ( NULL != m_pAccessTable->m_pAccessible ) && m_pAccessTable->m_pAccessible->isAlive();
+}
+
+// -----------------------------------------------------------------------------
+::svt::IAccessibleFactory& TableControl::getAccessibleFactory()
+{
+ return m_pAccessTable->m_aFactoryAccess.getFactory();
+}
+// -----------------------------------------------------------------------------
+void TableControl::commitGridControlEvent( sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
+{
+ if ( isAccessibleAlive() )
+ m_pAccessTable->m_pAccessible->commitEvent( _nEventId, _rNewValue, _rOldValue);
+}
+// -----------------------------------------------------------------------------
+Rectangle TableControl::calcHeaderRect(sal_Bool _bIsColumnBar,BOOL _bOnScreen)
+{
+ (void)_bOnScreen;
+ Rectangle aRectTable, aRectTableWithHeaders;
+ m_pImpl->impl_getAllVisibleDataCellArea(aRectTable);
+ m_pImpl->impl_getAllVisibleCellsArea(aRectTableWithHeaders);
+ Size aSizeTable(aRectTable.GetSize());
+ Size aSizeTableWithHeaders(aRectTableWithHeaders.GetSize());
+ if(_bIsColumnBar)
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width()-aSizeTable.Width(), aSizeTableWithHeaders.Height()));
+ else
+ return Rectangle(aRectTableWithHeaders.TopLeft(),Size(aSizeTableWithHeaders.Width(), aSizeTableWithHeaders.Height()-aSizeTable.Height()));
+}
+// -----------------------------------------------------------------------------
+Rectangle TableControl::calcTableRect(BOOL _bOnScreen)
+{
+ (void)_bOnScreen;
+ Rectangle aRect;
+ m_pImpl->impl_getAllVisibleDataCellArea(aRect);
+ return aRect;
+}
+
//........................................................................
-} } // namespace svt::table
+}} // namespace svt::table
//........................................................................
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index e1ff3aeb7f2a..89c0eed4229a 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -181,24 +181,23 @@ namespace svt { namespace table
{
(void)pCellEntryType;
}
- virtual std::vector<std::vector<rtl::OUString> > getCellContent()
+ virtual std::vector<std::vector<rtl::OUString> >& getCellContent()
{
- std::vector<rtl::OUString> cCC;
- cCC.push_back(rtl::OUString::createFromAscii(""));
- std::vector<std::vector<rtl::OUString> > cC;
- cC.push_back(cCC);
- return cC;
+ return *( new std::vector<std::vector<rtl::OUString> >);
}
virtual void setRowHeaderName(std::vector<rtl::OUString> pCellEntryType)
{
(void)pCellEntryType;
}
- virtual std::vector<rtl::OUString> getRowHeaderName()
+ virtual std::vector<rtl::OUString>& getRowHeaderName()
{
- std::vector<rtl::OUString> cCC;
- cCC.push_back(rtl::OUString::createFromAscii(""));
- return cCC;
+ aRowHeaderNames.clear();
+ aRowHeaderNames.push_back(rtl::OUString::createFromAscii(""));
+ return aRowHeaderNames;
}
+
+ private:
+ std::vector<rtl::OUString> aRowHeaderNames;
};
@@ -882,7 +881,7 @@ namespace svt { namespace table
impl_getAllVisibleDataCellArea( aAllDataCellsArea );
//get the vector, which contains row vectors, each containing the data for the cells in this row
- std::vector<std::vector<rtl::OUString> > aCellContent = m_pModel->getCellContent();
+ std::vector<std::vector<rtl::OUString> >& aCellContent = m_pModel->getCellContent();
//if the vector is empty, fill it with empty data, so the table can be painted
if(aCellContent.empty())
{
@@ -895,7 +894,7 @@ namespace svt { namespace table
}
std::vector<std::vector<rtl::OUString> >::iterator it = aCellContent.begin()+m_nTopRow;
//get the vector, which contains the row header titles
- std::vector<rtl::OUString> aRowHeaderContent;
+ std::vector<rtl::OUString>& aRowHeaderContent = m_pModel->getRowHeaderName();
::std::vector<rtl::OUString>::iterator itRowName = aRowHeaderContent.begin();
if(m_pModel->hasRowHeaders())
@@ -1525,7 +1524,7 @@ namespace svt { namespace table
}
//-------------------------------------------------------------------------------
- std::vector<RowPos> TableControl_Impl::getSelectedRows()
+ std::vector<RowPos>& TableControl_Impl::getSelectedRows()
{
return m_nRowSelected;
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 410bc8b4c3a1..0a25e82e4502 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -138,6 +138,8 @@ namespace svt { namespace table
inline RowPos getCurRow() const { return m_nCurRow; }
inline void setCurRow(RowPos curRow){ m_nCurRow = curRow; }
inline RowPos getTopRow() const { return m_nTopRow; }
+ inline long getRowCount() const { return m_nRowCount; }
+ inline long getColumnCount() const { return m_nColumnCount; }
inline long getColHeaderHightPixel() const { return m_nColHeaderHeightPixel; }
@@ -194,7 +196,7 @@ namespace svt { namespace table
/** to be called when a new row is added to the control*/
void invalidateRow(RowPos _nRowPos, Rectangle& _rCellRect );
/** returns the vector, which contains the selected rows*/
- std::vector<RowPos> getSelectedRows();
+ std::vector<RowPos>& getSelectedRows();
/** updates the vector, which contains the selected rows after removing the row nRowPos*/
void removeSelectedRow(RowPos _nRowPos);
void invalidateRows(RowPos _nRowStart, Rectangle& _rCellRect );
@@ -208,15 +210,6 @@ namespace svt { namespace table
virtual SelectionEngine* getSelEngine();
TableDataWindow* getDataWindow();
-
- private:
- /** toggles the cursor visibility
-
- The method is not bound to the classes public invariants, as it's used in
- situations where the they must not necessarily be fullfilled.
- */
- void impl_ni_doSwitchCursor( bool _bOn );
-
/** retrieves the area occupied by the totality of (at least partially) visible cells
The returned area includes row and column headers. Also, it takes into
@@ -234,6 +227,13 @@ namespace svt { namespace table
minus the row and column header areas.
*/
void impl_getAllVisibleDataCellArea( Rectangle& _rCellArea ) const;
+ private:
+ /** toggles the cursor visibility
+
+ The method is not bound to the classes public invariants, as it's used in
+ situations where the they must not necessarily be fullfilled.
+ */
+ void impl_ni_doSwitchCursor( bool _bOn );
/** returns the number of visible rows.
diff --git a/svtools/source/undo/makefile.mk b/svtools/source/undo/makefile.mk
deleted file mode 100644
index b277fa3c906f..000000000000
--- a/svtools/source/undo/makefile.mk
+++ /dev/null
@@ -1,51 +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: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=svtools
-TARGET=undo
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/svt.pmk
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/undo.obj
-
-# --- Tagets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/svtools/source/undo/undo.cxx b/svtools/source/undo/undo.cxx
deleted file mode 100644
index 2f733d4f03b3..000000000000
--- a/svtools/source/undo/undo.cxx
+++ /dev/null
@@ -1,819 +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: undo.cxx,v $
- * $Revision: 1.11 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
-
-#include <com/sun/star/uno/Exception.hpp>
-
-#include <tools/debug.hxx>
-
-#include <svtools/undo.hxx>
-
-using ::com::sun::star::uno::Exception;
-
-// STATIC DATA -----------------------------------------------------------
-
-DBG_NAME(SfxUndoAction)
-
-//========================================================================
-
-TYPEINIT0(SfxUndoAction);
-TYPEINIT0(SfxListUndoAction);
-TYPEINIT0(SfxLinkUndoAction);
-TYPEINIT0(SfxRepeatTarget);
-
-//------------------------------------------------------------------------
-
-SfxRepeatTarget::~SfxRepeatTarget()
-{
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoAction::IsLinked()
-{
- return bLinked;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoAction::SetLinked( BOOL bIsLinked )
-{
- bLinked = bIsLinked;
-}
-
-//------------------------------------------------------------------------
-
-SfxUndoAction::~SfxUndoAction()
-{
- DBG_DTOR(SfxUndoAction, 0);
- DBG_ASSERT( !IsLinked(), "Gelinkte Action geloescht" );
-}
-
-
-SfxUndoAction::SfxUndoAction()
-{
- DBG_CTOR(SfxUndoAction, 0);
- SetLinked( FALSE );
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoAction::Merge( SfxUndoAction * )
-{
- DBG_CHKTHIS(SfxUndoAction, 0);
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxUndoAction::GetComment() const
-{
- DBG_CHKTHIS(SfxUndoAction, 0);
- return XubString();
-}
-
-//------------------------------------------------------------------------
-
-
-USHORT SfxUndoAction::GetId() const
-{
- DBG_CHKTHIS(SfxUndoAction, 0);
- return 0;
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxUndoAction::GetRepeatComment(SfxRepeatTarget&) const
-{
- DBG_CHKTHIS(SfxUndoAction, 0);
- return GetComment();
-}
-
-//------------------------------------------------------------------------
-
-
-void SfxUndoAction::Undo()
-{
- // die sind nur konzeptuell pure virtual
- DBG_ERROR( "pure virtual function called: SfxUndoAction::Undo()" );
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoAction::Redo()
-{
- // die sind nur konzeptuell pure virtual
- DBG_ERROR( "pure virtual function called: SfxUndoAction::Redo()" );
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoAction::Repeat(SfxRepeatTarget&)
-{
- // die sind nur konzeptuell pure virtual
- DBG_ERROR( "pure virtual function called: SfxUndoAction::Repeat()" );
-}
-
-//------------------------------------------------------------------------
-
-
-BOOL SfxUndoAction::CanRepeat(SfxRepeatTarget&) const
-{
- return TRUE;
-}
-
-//========================================================================
-
-
-SfxUndoManager::SfxUndoManager( USHORT nMaxUndoActionCount )
- : pFatherUndoArray(0)
- , mbUndoEnabled( true )
-{
- pUndoArray=new SfxUndoArray(nMaxUndoActionCount);
- pActUndoArray=pUndoArray;
-
-}
-
-//------------------------------------------------------------------------
-
-
-SfxUndoManager::~SfxUndoManager()
-{
- delete pUndoArray;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::EnableUndo( bool bEnable )
-{
- mbUndoEnabled = bEnable;
-}
-
-//------------------------------------------------------------------------
-
-
-void SfxUndoManager::SetMaxUndoActionCount( USHORT nMaxUndoActionCount )
-{
- // Remove entries from the pActUndoArray when we have to reduce
- // the number of entries due to a lower nMaxUndoActionCount.
- // Both redo and undo action entries will be removed until we reached the
- // new nMaxUndoActionCount.
-
- long nNumToDelete = pActUndoArray->aUndoActions.Count() - nMaxUndoActionCount;
- if ( nNumToDelete > 0 )
- {
- while ( nNumToDelete > 0 )
- {
- USHORT nPos = pActUndoArray->aUndoActions.Count();
- if ( nPos > pActUndoArray->nCurUndoAction )
- {
- if ( !pActUndoArray->aUndoActions[nPos-1]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[nPos-1];
- pActUndoArray->aUndoActions.Remove( nPos-1 );
- --nNumToDelete;
- }
- }
-
- if ( nNumToDelete > 0 && pActUndoArray->nCurUndoAction > 0 )
- {
- if ( !pActUndoArray->aUndoActions[0]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[0];
- pActUndoArray->aUndoActions.Remove(0);
- --pActUndoArray->nCurUndoAction;
- --nNumToDelete;
- }
- }
-
- if ( nPos == pActUndoArray->aUndoActions.Count() )
- break; // Cannot delete more entries
- }
- }
-
- pActUndoArray->nMaxUndoActions = nMaxUndoActionCount;
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxUndoManager::GetMaxUndoActionCount() const
-{
- return pActUndoArray->nMaxUndoActions;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::Clear()
-{
- while ( pActUndoArray->aUndoActions.Count() )
- {
- SfxUndoAction *pAction=
- pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1];
- pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 );
- delete pAction;
- }
-
- pActUndoArray->nCurUndoAction = 0;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::ClearRedo()
-{
- while ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
- {
- SfxUndoAction *pAction=
- pActUndoArray->aUndoActions[pActUndoArray->aUndoActions.Count() - 1];
- pActUndoArray->aUndoActions.Remove( pActUndoArray->aUndoActions.Count() - 1 );
- delete pAction;
- }
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, BOOL bTryMerge )
-{
- if( mbUndoEnabled )
- {
- // Redo-Actions loeschen
- for ( USHORT nPos = pActUndoArray->aUndoActions.Count();
- nPos > pActUndoArray->nCurUndoAction; --nPos )
- delete pActUndoArray->aUndoActions[nPos-1];
-
- pActUndoArray->aUndoActions.Remove(
- pActUndoArray->nCurUndoAction,
- pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction );
-
- if ( pActUndoArray->nMaxUndoActions )
- {
- SfxUndoAction *pTmpAction = pActUndoArray->nCurUndoAction ?
- pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1] : 0;
-
- if ( !bTryMerge || !(pTmpAction && pTmpAction->Merge(pAction)) )
- {
- // auf Max-Anzahl anpassen
- if( pActUndoArray == pUndoArray )
- while( pActUndoArray->aUndoActions.Count() >=
- pActUndoArray->nMaxUndoActions &&
- !pActUndoArray->aUndoActions[0]->IsLinked() )
- {
- delete pActUndoArray->aUndoActions[0];
- pActUndoArray->aUndoActions.Remove(0);
- --pActUndoArray->nCurUndoAction;
- }
-
- // neue Action anh"angen
- const SfxUndoAction* pTemp = pAction;
- pActUndoArray->aUndoActions.Insert(
- pTemp, pActUndoArray->nCurUndoAction++ );
- return;
- }
- }
- }
- delete pAction;
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxUndoManager::GetUndoActionCount() const
-{
- return pActUndoArray->nCurUndoAction;
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxUndoManager::GetUndoActionComment( USHORT nNo ) const
-{
- DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionComment(), illegal id!" );
- if( nNo < pActUndoArray->nCurUndoAction )
- {
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetComment(); //!
- }
- else
- {
- XubString aEmpty;
- return aEmpty;
- }
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxUndoManager::GetUndoActionId( USHORT nNo ) const
-{
- DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoActionId(), illegal id!" );
- if( nNo < pActUndoArray->nCurUndoAction )
- {
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]->GetId(); //!
- }
- else
- {
- return 0;
- }
-}
-
-//------------------------------------------------------------------------
-
-SfxUndoAction* SfxUndoManager::GetUndoAction( USHORT nNo ) const
-{
- DBG_ASSERT( nNo < pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::GetUndoAction(), illegal id!" );
- if( nNo < pActUndoArray->nCurUndoAction )
- {
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1-nNo]; //!
- }
- else
- {
- return 0;
- }
-}
-
-//------------------------------------------------------------------------
-
-/** clears the redo stack and removes the top undo action */
-void SfxUndoManager::RemoveLastUndoAction()
-{
- DBG_ASSERT( pActUndoArray->nCurUndoAction, "svtools::SfxUndoManager::RemoveLastUndoAction(), no action to remove?!" );
- if( pActUndoArray->nCurUndoAction )
- {
- pActUndoArray->nCurUndoAction--;
-
- // delete redo-actions and top action
- USHORT nPos;
- for ( nPos = pActUndoArray->aUndoActions.Count(); nPos > pActUndoArray->nCurUndoAction; --nPos )
- delete pActUndoArray->aUndoActions[nPos-1];
-
- pActUndoArray->aUndoActions.Remove(
- pActUndoArray->nCurUndoAction,
- pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction );
- }
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoManager::Undo( USHORT )
-{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
-
- BOOL bRet = FALSE;
-
- try
- {
- DBG_ASSERT( pActUndoArray == pUndoArray, "svtools::SfxUndoManager::Undo(), LeaveListAction() not yet called!" );
- if ( pActUndoArray->nCurUndoAction )
- {
- Undo( *pActUndoArray->aUndoActions[ --pActUndoArray->nCurUndoAction ] );
- bRet = TRUE;
- }
- }
- catch( Exception& e )
- {
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
- }
- mbUndoEnabled = bUndoWasEnabled;
- return bRet;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::Undo( SfxUndoAction &rAction )
-{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
- try
- {
- rAction.Undo();
- }
- catch( Exception& e )
- {
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
- }
-
- mbUndoEnabled = bUndoWasEnabled;
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxUndoManager::GetRedoActionCount() const
-{
- return pActUndoArray->aUndoActions.Count() - pActUndoArray->nCurUndoAction; //!
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxUndoManager::GetRedoActionComment( USHORT nNo ) const
-{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetComment(); //!
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxUndoManager::GetRedoActionId( USHORT nNo ) const
-{
- return pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction+nNo]->GetId(); //!
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoManager::Redo( USHORT )
-{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
-
- BOOL bRet = FALSE;
-
- try
- {
- if ( pActUndoArray->aUndoActions.Count() > pActUndoArray->nCurUndoAction )
- {
- Redo( *pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction++] );
- bRet = TRUE;
- }
- }
- catch( Exception& e )
- {
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
- }
-
- mbUndoEnabled = bUndoWasEnabled;
- return bRet;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::Redo( SfxUndoAction &rAction )
-{
- bool bUndoWasEnabled = mbUndoEnabled;
- mbUndoEnabled = false;
-
- try
- {
- rAction.Redo();
- }
- catch( Exception& e )
- {
- mbUndoEnabled = bUndoWasEnabled;
- throw e;
- }
-
- mbUndoEnabled = bUndoWasEnabled;
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxUndoManager::GetRepeatActionCount() const
-{
- return pActUndoArray->aUndoActions.Count();
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxUndoManager::GetRepeatActionComment( SfxRepeatTarget &rTarget, USHORT nNo ) const
-{
- return pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 - nNo ]
- ->GetRepeatComment(rTarget);
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, USHORT /*nFrom*/, USHORT /*nCount*/ )
-{
- if ( pActUndoArray->aUndoActions.Count() )
- {
- Repeat( rTarget, *pActUndoArray->aUndoActions[ pActUndoArray->aUndoActions.Count() - 1 ] );
- return TRUE;
- }
-
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::Repeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction )
-{
- if ( rAction.CanRepeat(rTarget) )
- rAction.Repeat(rTarget);
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, SfxUndoAction &rAction ) const
-{
- return rAction.CanRepeat(rTarget);
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxUndoManager::CanRepeat( SfxRepeatTarget &rTarget, USHORT nNo ) const
-{
- if ( pActUndoArray->aUndoActions.Count() > nNo )
- {
- USHORT nActionNo = pActUndoArray->aUndoActions.Count() - 1 - nNo;
- return pActUndoArray->aUndoActions[nActionNo]->CanRepeat(rTarget);
- }
-
- return FALSE;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::EnterListAction(
- const XubString& rComment, const XubString &rRepeatComment, USHORT nId )
-
-/* [Beschreibung]
-
- Fuegt eine ListUndoAction ein und setzt dessen UndoArray als aktuelles.
-*/
-
-{
- if( !mbUndoEnabled )
- return;
-
- if ( !pUndoArray->nMaxUndoActions )
- return;
-
- pFatherUndoArray=pActUndoArray;
- SfxListUndoAction *pAction=new SfxListUndoAction(
- rComment, rRepeatComment, nId, pActUndoArray);
- AddUndoAction( pAction );
- pActUndoArray=pAction;
-}
-
-//------------------------------------------------------------------------
-
-void SfxUndoManager::LeaveListAction()
-
-/* [Beschreibung]
-
- Verlaesst die aktuelle ListAction und geht eine Ebene nach oben.
-*/
-{
- if ( !mbUndoEnabled )
- return;
-
- if ( !pUndoArray->nMaxUndoActions )
- return;
-
- if( pActUndoArray == pUndoArray )
- {
- DBG_ERROR( "svtools::SfxUndoManager::LeaveListAction(), called without calling EnterListAction()!" );
- return;
- }
-
- DBG_ASSERT(pActUndoArray->pFatherUndoArray,"svtools::SfxUndoManager::LeaveListAction(), no father undo array!?");
-
- SfxUndoArray* pTmp=pActUndoArray;
- pActUndoArray=pActUndoArray->pFatherUndoArray;
-
- // If no undo action where added, delete the undo list action
- SfxUndoAction *pTmpAction= pActUndoArray->aUndoActions[pActUndoArray->nCurUndoAction-1];
- if(!pTmp->nCurUndoAction)
- {
- pActUndoArray->aUndoActions.Remove( --pActUndoArray->nCurUndoAction);
- delete pTmpAction;
- }
- else
- {
- // if the undo array has no comment, try to get it from its children
- SfxListUndoAction* pList = dynamic_cast< SfxListUndoAction * >( pTmpAction );
- if( pList && pList->GetComment().Len() == 0 )
- {
- USHORT n;
- for( n = 0; n < pList->aUndoActions.Count(); n++ )
- {
- if( pList->aUndoActions[n]->GetComment().Len() )
- {
- pList->SetComment( pList->aUndoActions[n]->GetComment() );
- break;
- }
- }
- }
- }
-}
-
-//------------------------------------------------------------------------
-
-USHORT SfxListUndoAction::GetId() const
-{
- return nId;
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxListUndoAction::GetComment() const
-{
- return aComment;
-}
-
-//------------------------------------------------------------------------
-
-void SfxListUndoAction::SetComment( const UniString& rComment )
-{
- aComment = rComment;
-}
-
-//------------------------------------------------------------------------
-
-XubString SfxListUndoAction::GetRepeatComment(SfxRepeatTarget &) const
-{
- return aRepeatComment;
-}
-
-
-//------------------------------------------------------------------------
-
-SfxListUndoAction::SfxListUndoAction
-(
- const XubString &rComment,
- const XubString rRepeatComment,
- USHORT Id,
- SfxUndoArray *pFather
-)
-: nId(Id), aComment(rComment), aRepeatComment(rRepeatComment)
-{
- pFatherUndoArray = pFather;
- nMaxUndoActions = USHRT_MAX;
-}
-
-//------------------------------------------------------------------------
-
-void SfxListUndoAction::Undo()
-{
- for(INT16 i=nCurUndoAction-1;i>=0;i--)
- aUndoActions[i]->Undo();
- nCurUndoAction=0;
-}
-
-//------------------------------------------------------------------------
-
-void SfxListUndoAction::Redo()
-{
- for(USHORT i=nCurUndoAction;i<aUndoActions.Count();i++)
- aUndoActions[i]->Redo();
- nCurUndoAction = aUndoActions.Count();
-}
-
-//------------------------------------------------------------------------
-
-void SfxListUndoAction::Repeat(SfxRepeatTarget&rTarget)
-{
- for(USHORT i=0;i<nCurUndoAction;i++)
- aUndoActions[i]->Repeat(rTarget);
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxListUndoAction::CanRepeat(SfxRepeatTarget&r) const
-{
- for(USHORT i=0;i<nCurUndoAction;i++)
- if(!aUndoActions[i]->CanRepeat(r))
- return FALSE;
- return TRUE;
-}
-
-//------------------------------------------------------------------------
-
-BOOL SfxListUndoAction::Merge( SfxUndoAction *pNextAction )
-{
- return aUndoActions.Count() && aUndoActions[aUndoActions.Count()-1]->Merge( pNextAction );
-}
-
-//------------------------------------------------------------------------
-
-SfxLinkUndoAction::SfxLinkUndoAction(SfxUndoManager *pManager)
-/* [Beschreibung]
-
- Richtet eine LinkAction ein, die auf einen weiteren UndoManager zeigt.
- Holt sich als zugehoerige Action des weiteren UndoManagers dessen
- aktuelle Action.
-*/
-
-{
- pUndoManager = pManager;
- if ( pManager->GetMaxUndoActionCount() )
- {
- USHORT nPos = pManager->GetUndoActionCount()-1;
- pAction = pManager->pActUndoArray->aUndoActions[nPos];
- pAction->SetLinked();
- }
- else
- pAction = 0;
-}
-
-//------------------------------------------------------------------------
-
-void SfxLinkUndoAction::Undo()
-{
- if ( pAction )
- pUndoManager->Undo(1);
-}
-
-//------------------------------------------------------------------------
-
-void SfxLinkUndoAction::Redo()
-{
- if ( pAction )
- pUndoManager->Redo(1);
-}
-
-//------------------------------------------------------------------------
-
-
-BOOL SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const
-{
- return pAction && pUndoManager->CanRepeat(r,*pAction);
-}
-
-
-//------------------------------------------------------------------------
-
-
-void SfxLinkUndoAction::Repeat(SfxRepeatTarget&r)
-{
- if ( pAction )
- pUndoManager->Repeat(r,*pAction);
-}
-
-
-//------------------------------------------------------------------------
-
-XubString SfxLinkUndoAction::GetComment() const
-{
- if ( pAction )
- return pAction->GetComment();
- else
- return XubString();
-}
-
-
-//------------------------------------------------------------------------
-
-XubString SfxLinkUndoAction::GetRepeatComment(SfxRepeatTarget&r) const
-{
- if ( pAction )
- return pAction->GetRepeatComment(r);
- else
- return XubString();
-}
-
-//------------------------------------------------------------------------
-
-SfxLinkUndoAction::~SfxLinkUndoAction()
-{
- if( pAction )
- pAction->SetLinked( FALSE );
-}
-
-
-//------------------------------------------------------------------------
-
-SfxUndoArray::~SfxUndoArray()
-{
- while ( aUndoActions.Count() )
- {
- SfxUndoAction *pAction =
- aUndoActions[ aUndoActions.Count() - 1 ];
- aUndoActions.Remove( aUndoActions.Count() - 1 );
- delete pAction;
- }
-}
-
-
-USHORT SfxLinkUndoAction::GetId() const
-{
- return pAction ? pAction->GetId() : 0;
-}
-
-
-
diff --git a/svtools/source/uno/addrtempuno.cxx b/svtools/source/uno/addrtempuno.cxx
new file mode 100644
index 000000000000..b2aff7ae711d
--- /dev/null
+++ b/svtools/source/uno/addrtempuno.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * 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: addrtempuno.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_svtools.hxx"
+#include "svtools/genericunodialog.hxx"
+#ifndef _SVT_DOC_ADDRESSTEMPLATE_HXX_
+#include "addresstemplate.hxx"
+#endif
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/property.hxx>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+
+class SfxItemSet;
+class SfxItemPool;
+class SfxPoolItem;
+
+// .......................................................................
+namespace svt
+{
+// .......................................................................
+
+#define UNODIALOG_PROPERTY_ID_ALIASES 100
+#define UNODIALOG_PROPERTY_ALIASES "FieldMapping"
+
+ 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::sdbc;
+
+ //=========================================================================
+ //= OAddressBookSourceDialogUno
+ //=========================================================================
+ typedef OGenericUnoDialog OAddressBookSourceDialogUnoBase;
+ class OAddressBookSourceDialogUno
+ :public OAddressBookSourceDialogUnoBase
+ ,public ::comphelper::OPropertyArrayUsageHelper< OAddressBookSourceDialogUno >
+ {
+ protected:
+ Sequence< AliasProgrammaticPair > m_aAliases;
+ Reference< XDataSource > m_xDataSource;
+ ::rtl::OUString m_sDataSourceName;
+ ::rtl::OUString m_sTable;
+
+ protected:
+ OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB);
+
+ public:
+ // XTypeProvider
+ virtual Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(RuntimeException);
+ virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(RuntimeException);
+
+ // XServiceInfo - static methods
+ static Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( RuntimeException );
+ static ::rtl::OUString getImplementationName_Static(void) throw( RuntimeException );
+ static Reference< XInterface >
+ SAL_CALL Create(const Reference< com::sun::star::lang::XMultiServiceFactory >&);
+
+ // XPropertySet
+ virtual Reference< XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ protected:
+ // OGenericUnoDialog overridables
+ virtual Dialog* createDialog(Window* _pParent);
+
+ virtual void implInitialize(const com::sun::star::uno::Any& _rValue);
+
+ virtual void executedDialog(sal_Int16 _nExecutionResult);
+ };
+
+
+ //=========================================================================
+ //= OAddressBookSourceDialogUno
+ //=========================================================================
+ Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno_CreateInstance( const Reference< XMultiServiceFactory >& _rxFactory)
+ {
+ return OAddressBookSourceDialogUno::Create(_rxFactory);
+ }
+
+ //-------------------------------------------------------------------------
+ OAddressBookSourceDialogUno::OAddressBookSourceDialogUno(const Reference< XMultiServiceFactory >& _rxORB)
+ :OGenericUnoDialog(_rxORB)
+ {
+ registerProperty(::rtl::OUString::createFromAscii(UNODIALOG_PROPERTY_ALIASES), UNODIALOG_PROPERTY_ID_ALIASES, PropertyAttribute::READONLY,
+ &m_aAliases, getCppuType(&m_aAliases));
+ }
+
+ //-------------------------------------------------------------------------
+ Sequence<sal_Int8> SAL_CALL OAddressBookSourceDialogUno::getImplementationId( ) throw(RuntimeException)
+ {
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+ }
+
+ //-------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL OAddressBookSourceDialogUno::Create(const Reference< XMultiServiceFactory >& _rxFactory)
+ {
+ return *(new OAddressBookSourceDialogUno(_rxFactory));
+ }
+
+ //-------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAddressBookSourceDialogUno::getImplementationName() throw(RuntimeException)
+ {
+ return getImplementationName_Static();
+ }
+
+ //-------------------------------------------------------------------------
+ ::rtl::OUString OAddressBookSourceDialogUno::getImplementationName_Static() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.OAddressBookSourceDialogUno");
+ }
+
+ //-------------------------------------------------------------------------
+ ::comphelper::StringSequence SAL_CALL OAddressBookSourceDialogUno::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return getSupportedServiceNames_Static();
+ }
+
+ //-------------------------------------------------------------------------
+ ::comphelper::StringSequence OAddressBookSourceDialogUno::getSupportedServiceNames_Static() throw(RuntimeException)
+ {
+ ::comphelper::StringSequence aSupported(1);
+ aSupported.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.ui.AddressBookSourceDialog");
+ return aSupported;
+ }
+
+ //-------------------------------------------------------------------------
+ Reference<XPropertySetInfo> SAL_CALL OAddressBookSourceDialogUno::getPropertySetInfo() throw(RuntimeException)
+ {
+ Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //-------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& OAddressBookSourceDialogUno::getInfoHelper()
+ {
+ return *const_cast<OAddressBookSourceDialogUno*>(this)->getArrayHelper();
+ }
+
+ //------------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* OAddressBookSourceDialogUno::createArrayHelper( ) const
+ {
+ Sequence< Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+ }
+
+ //------------------------------------------------------------------------------
+ void OAddressBookSourceDialogUno::executedDialog(sal_Int16 _nExecutionResult)
+ {
+ OAddressBookSourceDialogUnoBase::executedDialog(_nExecutionResult);
+
+ if ( _nExecutionResult )
+ if ( m_pDialog )
+ static_cast< AddressBookSourceDialog* >( m_pDialog )->getFieldMapping( m_aAliases );
+ }
+
+ //------------------------------------------------------------------------------
+ void OAddressBookSourceDialogUno::implInitialize(const com::sun::star::uno::Any& _rValue)
+ {
+ PropertyValue aVal;
+ if (_rValue >>= aVal)
+ {
+ if (0 == aVal.Name.compareToAscii("DataSource"))
+ {
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ aVal.Value >>= m_xDataSource;
+ OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSource!" );
+ return;
+ }
+
+ if (0 == aVal.Name.compareToAscii("DataSourceName"))
+ {
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ aVal.Value >>= m_sDataSourceName;
+ OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for DataSourceName!" );
+ return;
+ }
+
+ if (0 == aVal.Name.compareToAscii("Command"))
+ {
+#if OSL_DEBUG_LEVEL > 0
+ sal_Bool bSuccess =
+#endif
+ aVal.Value >>= m_sTable;
+ OSL_ENSURE( bSuccess, "OAddressBookSourceDialogUno::implInitialize: invalid type for Command!" );
+ return;
+ }
+ }
+
+ OAddressBookSourceDialogUnoBase::implInitialize( _rValue );
+ }
+
+ //------------------------------------------------------------------------------
+ Dialog* OAddressBookSourceDialogUno::createDialog(Window* _pParent)
+ {
+ if ( m_xDataSource.is() && m_sTable.getLength() )
+ return new AddressBookSourceDialog(_pParent, m_aContext.getLegacyServiceFactory(), m_xDataSource, m_sDataSourceName, m_sTable, m_aAliases );
+ else
+ return new AddressBookSourceDialog( _pParent, m_aContext.getLegacyServiceFactory() );
+ }
+
+// .......................................................................
+} // namespace svt
+// .......................................................................
+
diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx
index be7738adaf14..b3ae322aa3ba 100644
--- a/svtools/source/uno/contextmenuhelper.cxx
+++ b/svtools/source/uno/contextmenuhelper.cxx
@@ -611,7 +611,7 @@ ContextMenuHelper::completeMenuProperties(
// menu correctly.
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
bool bShowMenuImages( rSettings.GetUseImagesInMenus() );
- bool bIsHiContrast( rSettings.GetMenuColor().IsDark() );
+ bool bIsHiContrast( rSettings.GetHighContrastMode() );
if ( pMenu )
{
diff --git a/svtools/source/uno/makefile.mk b/svtools/source/uno/makefile.mk
index 51e55a1f9123..82e509f1ce08 100644
--- a/svtools/source/uno/makefile.mk
+++ b/svtools/source/uno/makefile.mk
@@ -46,18 +46,20 @@ SRS1NAME= uno
SRC1FILES= unoifac2.src
SLOFILES= \
- $(SLO)$/unoiface.obj \
- $(SLO)$/unoevent.obj \
- $(SLO)$/unoimap.obj \
- $(SLO)$/toolboxcontroller.obj \
+ $(SLO)$/addrtempuno.obj \
+ $(SLO)$/contextmenuhelper.obj \
$(SLO)$/framestatuslistener.obj \
- $(SLO)$/statusbarcontroller.obj \
- $(SLO)$/genericunodialog.obj \
$(SLO)$/generictoolboxcontroller.obj \
+ $(SLO)$/genericunodialog.obj \
+ $(SLO)$/miscservices.obj\
+ $(SLO)$/statusbarcontroller.obj \
+ $(SLO)$/toolboxcontroller.obj \
$(SLO)$/treecontrolpeer.obj \
$(SLO)$/unocontroltablemodel.obj \
- $(SLO)$/registerservices.obj\
- $(SLO)$/contextmenuhelper.obj
+ $(SLO)$/unoevent.obj \
+ $(SLO)$/unoiface.obj \
+ $(SLO)$/unoimap.obj \
+ $(SLO)$/svtxgridcontrol.obj
# --- Targets ------------------------------------------------------
diff --git a/svtools/source/uno/registerservices.cxx b/svtools/source/uno/miscservices.cxx
index a3e9f39c2dba..0f7b79720179 100644
--- a/svtools/source/uno/registerservices.cxx
+++ b/svtools/source/uno/miscservices.cxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: registerservices.cxx,v $
- * $Revision: 1.21 $
+ * $RCSfile: miscservices.cxx,v $
+ * $Revision: 1.6 $
*
* This file is part of OpenOffice.org.
*
@@ -33,22 +33,34 @@
#include "sal/types.h"
#include "rtl/ustring.hxx"
#include <cppuhelper/factory.hxx>
+#include <cppuhelper/weak.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
-namespace css = com::sun::star;
-using css::uno::Reference;
-using css::uno::Sequence;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::lang;
+
using rtl::OUString;
// -------------------------------------------------------------------------------------
+// for CreateInstance functions implemented elsewhere
#define DECLARE_CREATEINSTANCE( ImplName ) \
- Reference< css::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< css::lang::XMultiServiceFactory >& );
+ Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& );
+
+// for CreateInstance functions implemented elsewhere, while the function is within a namespace
+#define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \
+ namespace nmspe { \
+ Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
+ }
-DECLARE_CREATEINSTANCE( SvNumberFormatterServiceObj )
-DECLARE_CREATEINSTANCE( SvNumberFormatsSupplierServiceObject )
+// -------------------------------------------------------------------------------------
+
+DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno )
+DECLARE_CREATEINSTANCE( SvFilterOptionsDialog )
+DECLARE_CREATEINSTANCE( PathService )
// -------------------------------------------------------------------------------------
@@ -62,64 +74,60 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
}
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo (
- void * /* _pServiceManager */, void * _pRegistryKey)
+ void * /* _pServiceManager */, void * _pRegistryKey )
{
if (_pRegistryKey)
{
- Reference< css::registry::XRegistryKey > xRegistryKey (
- reinterpret_cast< css::registry::XRegistryKey* >(_pRegistryKey));
- Reference< css::registry::XRegistryKey > xNewKey;
+ Reference< XRegistryKey > xRegistryKey (
+ reinterpret_cast< XRegistryKey* >( _pRegistryKey ));
+ Reference< XRegistryKey > xNewKey;
xNewKey = xRegistryKey->createKey (
- OUString::createFromAscii(
- "/com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject/UNO/SERVICES" ) );
- xNewKey->createKey (
- OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" ) );
+ OUString::createFromAscii( "/com.sun.star.comp.svtools.OAddressBookSourceDialogUno/UNO/SERVICES" ) );
+ xNewKey->createKey(
+ OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ) );
xNewKey = xRegistryKey->createKey (
- OUString::createFromAscii(
- "/com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject/UNO/SERVICES" ) );
+ OUString::createFromAscii( "/com.sun.star.svtools.SvFilterOptionsDialog/UNO/SERVICES" ) );
xNewKey->createKey (
- OUString::createFromAscii( "com.sun.star.util.NumberFormatter" ) );
+ OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ) );
return sal_True;
}
return sal_False;
}
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory (
- const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey*/)
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
+ const sal_Char * pImplementationName, void * _pServiceManager, void * /* _pRegistryKey */)
{
void * pResult = 0;
if ( _pServiceManager )
{
- Reference< css::lang::XSingleServiceFactory > xFactory;
- if (rtl_str_compare(
- pImplementationName,
- "com.sun.star.uno.util.numbers.SvNumberFormatsSupplierServiceObject") == 0)
+ Reference< XSingleServiceFactory > xFactory;
+ if (rtl_str_compare (
+ pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0)
{
Sequence< OUString > aServiceNames(1);
aServiceNames.getArray()[0] =
- OUString::createFromAscii( "com.sun.star.util.NumberFormatsSupplier" );
+ OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" );
- xFactory = ::cppu::createSingleFactory(
- reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
+ xFactory = ::cppu::createSingleFactory (
+ reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ),
OUString::createFromAscii( pImplementationName ),
- SvNumberFormatsSupplierServiceObject_CreateInstance,
+ svt::OAddressBookSourceDialogUno_CreateInstance,
aServiceNames);
}
- else if (rtl_str_compare(
- pImplementationName,
- "com.sun.star.uno.util.numbers.SvNumberFormatterServiceObject") == 0)
+ else if (rtl_str_compare (
+ pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0)
{
Sequence< OUString > aServiceNames(1);
aServiceNames.getArray()[0] =
- OUString::createFromAscii( "com.sun.star.util.NumberFormatter" );
+ OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" );
- xFactory = ::cppu::createSingleFactory(
- reinterpret_cast< css::lang::XMultiServiceFactory* >(_pServiceManager),
+ xFactory = ::cppu::createSingleFactory (
+ reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ),
OUString::createFromAscii( pImplementationName ),
- SvNumberFormatterServiceObj_CreateInstance,
+ SvFilterOptionsDialog_CreateInstance,
aServiceNames);
}
if ( xFactory.is() )
diff --git a/svtools/source/uno/svtxgridcontrol.cxx b/svtools/source/uno/svtxgridcontrol.cxx
new file mode 100755
index 000000000000..2f2c896ee6a8
--- /dev/null
+++ b/svtools/source/uno/svtxgridcontrol.cxx
@@ -0,0 +1,458 @@
+/*************************************************************************
+ *
+ * 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: SVTXGridControl.cxx,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_svtools.hxx"
+
+#include "svtxgridcontrol.hxx"
+#include <com/sun/star/view/SelectionType.hpp>
+#include "svtools/table/gridtablerenderer.hxx"
+#include "svtools/table/defaultinputhandler.hxx"
+#include "svtools/table/tablecontrol.hxx"
+#include "unocontroltablemodel.hxx"
+#include <comphelper/sequence.hxx>
+#include <rtl/ref.hxx>
+#include <tools/debug.hxx>
+#include <toolkit/helper/property.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+
+using ::rtl::OUString;
+using namespace ::svt::table;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::view;
+using namespace ::toolkit;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::accessibility::AccessibleEventId;
+using namespace ::com::sun::star::accessibility::AccessibleTableModelChangeType;
+using ::com::sun::star::accessibility::AccessibleTableModelChange;
+
+
+SVTXGridControl::SVTXGridControl()
+ :m_pTableModel (new UnoControlTableModel()),
+ m_xDataModel(0),
+ m_xColumnModel(0),
+ m_bHasColumnHeaders(false),
+ m_bHasRowHeaders(false),
+ m_bVScroll(false),
+ m_bHScroll(false)
+{
+}
+
+//--------------------------------------------------------------------
+SVTXGridControl::~SVTXGridControl()
+{
+ DELETEZ(m_pTableModel);
+}
+
+::com::sun::star::uno::Any SVTXGridControl::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( SVTXGridControl )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL SVTXGridControl::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return NULL;
+}
+void SAL_CALL SVTXGridControl::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)model;
+}
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL SVTXGridControl::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return NULL;
+}
+void SAL_CALL SVTXGridControl::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)model;
+}
+sal_Int32 SAL_CALL SVTXGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ return pTable->GetCurrentRow( Point(x,y) );
+}
+
+void SAL_CALL SVTXGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)listener;
+}
+
+void SAL_CALL SVTXGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void) listener;
+}
+
+void SVTXGridControl::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TableControl* pTable = (TableControl*)GetWindow();
+
+ switch( GetPropertyId( PropertyName ) )
+ {
+ case BASEPROPERTY_GRID_SELECTIONMODE:
+ {
+ SelectionType eSelectionType;
+ if( aValue >>= eSelectionType )
+ {
+ SelectionMode eSelMode;
+ switch( eSelectionType )
+ {
+ case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break;
+ case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break;
+ case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break;
+ // case SelectionType_NONE:
+ default: eSelMode = NO_SELECTION; break;
+ }
+ if( pTable->getSelEngine()->GetSelectionMode() != eSelMode )
+ pTable->getSelEngine()->SetSelectionMode( eSelMode );
+ }
+ break;
+ }
+ case BASEPROPERTY_HSCROLL:
+ {
+ sal_Bool bHScroll = true;
+ if( aValue >>= bHScroll )
+ {
+ m_bHScroll = bHScroll;
+ }
+ break;
+ }
+ case BASEPROPERTY_VSCROLL:
+ {
+ sal_Bool bVScroll = true;
+ if( aValue >>= bVScroll )
+ {
+ m_bVScroll = bVScroll;
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ {
+ sal_Bool rowHeader = true;
+ if( aValue >>= rowHeader )
+ {
+ m_pTableModel->setRowHeaders(rowHeader);
+ }
+ break;
+ }
+
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ {
+ sal_Bool colHeader = true;
+ if( aValue >>= colHeader )
+ {
+ m_pTableModel->setColumnHeaders(colHeader);
+ }
+ break;
+ }
+ case BASEPROPERTY_GRID_DATAMODEL:
+ {
+ m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
+ Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
+ Sequence<rtl::OUString> rowData(0);
+ std::vector< std::vector< rtl::OUString > > aCellContent(0);
+ for(int i = 0; i< m_xDataModel->getRowCount();++i)
+ {
+ rowData = cellData[i];
+ std::vector<rtl::OUString> newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
+ if(newRow.size() < (unsigned)m_pTableModel->getColumnCount())
+ newRow.resize( m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
+ aCellContent.push_back(newRow);
+ }
+ m_pTableModel->setCellContent(aCellContent);
+ Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
+ std::vector< rtl::OUString > newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
+ m_pTableModel->setRowCount(m_xDataModel->getRowCount());
+ m_pTableModel->setRowHeaderName(newRow);
+ break;
+ }
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ {
+ m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
+ Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
+ std::vector<Reference< XGridColumn > > aNewColumns(
+ comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
+ /* if(m_pTable->GetColumnCount().size()>0)
+ m_pTable->GetColumnName.clear();*/
+ for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
+ {
+ UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
+ m_pTableModel->getColumnModel().push_back((PColumnModel)tableColumn);
+ }
+ break;
+ }
+ default:
+ VCLXWindow::setProperty( PropertyName, aValue );
+ break;
+ }
+}
+
+Any SVTXGridControl::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ const sal_uInt16 nPropId = GetPropertyId( PropertyName );
+ TableControl* pTable = (TableControl*)GetWindow();
+ if(pTable)
+ {
+ switch(nPropId)
+ {
+ case BASEPROPERTY_GRID_SELECTIONMODE:
+ {
+ SelectionType eSelectionType;
+
+ SelectionMode eSelMode = pTable->getSelEngine()->GetSelectionMode();
+ switch( eSelMode )
+ {
+ case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break;
+ case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break;
+ case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
+// case NO_SELECTION:
+ default: eSelectionType = SelectionType_NONE; break;
+ }
+ return Any( eSelectionType );
+ }
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ {
+ return Any ((sal_Bool) m_pTableModel->hasRowHeaders());
+ }
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ return Any ((sal_Bool) m_pTableModel->hasColumnHeaders());
+ case BASEPROPERTY_GRID_DATAMODEL:
+ return Any ( m_xDataModel );
+ case BASEPROPERTY_GRID_COLUMNMODEL:
+ return Any ( m_xColumnModel);
+ case BASEPROPERTY_HSCROLL:
+ return Any ( m_bHScroll);
+ case BASEPROPERTY_VSCROLL:
+ return Any ( m_bVScroll);
+ }
+ }
+ return VCLXWindow::getProperty( PropertyName );
+}
+
+void SVTXGridControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_GRID_SHOWROWHEADER,
+ BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
+ BASEPROPERTY_GRID_DATAMODEL,
+ BASEPROPERTY_GRID_COLUMNMODEL,
+ BASEPROPERTY_GRID_SELECTIONMODE,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds, true );
+}
+void SAL_CALL SVTXGridControl::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ if ( pTable )
+ {
+ pTable->SetModel(PTableModel(m_pTableModel));
+ //m_pTable->SetPosSizePixel( Point( nPosX, nPosY ), Size(nWidth, nHeight) );
+ pTable->Show( bVisible );
+ }
+}
+void SAL_CALL SVTXGridControl::setFocus() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if ( GetWindow())
+ GetWindow()->GrabFocus();
+}
+void SAL_CALL SVTXGridControl::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ std::vector<OUString> aNewRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
+ if(aNewRow.size()< (unsigned)m_pTableModel->getColumnCount())
+ aNewRow.resize(m_pTableModel->getColumnCount(),rtl::OUString::createFromAscii(""));
+ m_pTableModel->getCellContent().push_back(aNewRow);
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().push_back(Event.headerName);
+ m_pTableModel->setRowCount(m_pTableModel->getRowHeaderName().size());
+ TableControl* pTable = (TableControl*)GetWindow();
+ pTable->InvalidateDataWindow(m_pTableModel->getRowHeaderName().size()-1, false);
+ //pTable->GrabFocus();
+ if(pTable->isAccessibleAlive())
+ {
+ pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(INSERT, m_pTableModel->getRowCount()-1, m_pTableModel->getRowCount(), 0, m_pTableModel->getColumnCount())),
+ Any());
+ pTable->commitGridControlEvent(CHILD,
+ makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
+ Any());
+ for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
+ {
+ pTable->commitGridControlEvent(
+ CHILD,
+ makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
+ Any());
+ }
+ }
+}
+
+void SAL_CALL SVTXGridControl::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ //unsigned int rows =m_pImpl->aCellContent.size()-1;
+ if(Event.index == -1)
+ {
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().clear();
+ m_pTableModel->getCellContent().clear();
+ if(pTable->isAccessibleAlive())
+ {
+ pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(DELETE, 0, m_pTableModel->getColumnCount(), 0, m_pTableModel->getColumnCount())),
+ Any());
+ }
+ }
+ else
+ {
+ pTable->removeSelectedRow(Event.index);
+ if(m_pTableModel->getCellContent().size()>1)
+ {
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().erase(m_pTableModel->getRowHeaderName().begin()+Event.index);
+ m_pTableModel->getCellContent().erase(m_pTableModel->getCellContent().begin()+Event.index);
+
+ }
+ else
+ {
+ if(m_pTableModel->hasRowHeaders())
+ m_pTableModel->getRowHeaderName().clear();
+ m_pTableModel->getCellContent().clear();
+ //m_pImpl->nRowCount=0;
+ }
+ }
+ //pTable->InvalidateDataWindow(Event.index, true);
+ m_pTableModel->setRowCount(m_pTableModel->getCellContent().size());
+ pTable->InvalidateDataWindow(Event.index, true);
+ if(pTable->isAccessibleAlive())
+ {
+ pTable->commitGridControlEvent(TABLE_MODEL_CHANGED,
+ makeAny( AccessibleTableModelChange(DELETE, Event.index, Event.index+1, 0, m_pTableModel->getColumnCount())),
+ Any());
+ //pTable->commitGridControlEvent(CHILD,
+ // makeAny( pTable->m_pAccessTable->m_pAccessible->getTableHeader(TCTYPE_ROWHEADERBAR)),
+ // Any());
+ //for (sal_Int32 i = 0 ; i <= m_pTableModel->getColumnCount() ; ++i)
+ //{
+ // pTable->commitGridControlEvent(
+ // CHILD,
+ // makeAny( pTable->m_pAccessTable->m_pAccessible->getTable() ),
+ // Any());
+ //}
+ }
+ //pTable->Invalidate();
+}
+
+void SAL_CALL SVTXGridControl::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void) Event;
+}
+
+ void SAL_CALL SVTXGridControl::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ VCLXWindow::disposing( Source );
+ }
+
+::sal_Int32 SAL_CALL SVTXGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+::sal_Int32 SAL_CALL SVTXGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL SVTXGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)length;
+ (void)start;
+}
+
+void SAL_CALL SVTXGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)end;
+ (void)start;
+}
+
+::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL SVTXGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
+{
+ TableControl* pTable = (TableControl*)GetWindow();
+ std::vector<RowPos>& selectedRows = pTable->GetSelectedRows();
+ Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows));
+ return selectedRowsToSequence;
+}
+
+::sal_Bool SAL_CALL SVTXGridControl::isCellEditable() throw (::com::sun::star::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+::sal_Bool SAL_CALL SVTXGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
+{
+ return sal_False;
+}
+
+::sal_Bool SAL_CALL SVTXGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)index;
+ return sal_False;
+}
+
+void SAL_CALL SVTXGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)y;
+}
+
+void SAL_CALL SVTXGridControl::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)x;
+}
diff --git a/svtools/source/uno/svtxgridcontrol.hxx b/svtools/source/uno/svtxgridcontrol.hxx
new file mode 100755
index 000000000000..9ca6901681c9
--- /dev/null
+++ b/svtools/source/uno/svtxgridcontrol.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * 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: SVTXGridControl.hxx,v $
+ * $Revision: 1.32 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _SVT_GRIDCONTROL_HXX_
+#define _SVT_GRIDCONTROL_HXX_
+
+#include <unocontroltablemodel.hxx>
+#include <svtools/table/tablecontrol.hxx>
+#include <com/sun/star/awt/grid/XGridControl.hpp>
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/grid/GridDataEvent.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/implbase2.hxx>
+//#include <toolkit/helper/listenermultiplexer.hxx>
+
+
+using namespace ::svt::table;
+
+class SVTXGridControl : public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
+ ::com::sun::star::awt::grid::XGridDataListener>
+{
+private:
+ UnoControlTableModel* m_pTableModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel;
+ bool m_bHasColumnHeaders;
+ bool m_bHasRowHeaders;
+ bool m_bVScroll;
+ bool m_bHScroll;
+
+public:
+ SVTXGridControl();
+ ~SVTXGridControl();
+ //XGridDataListener overridables
+ virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
+ void SAL_CALL release() throw() { VCLXWindow::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ //::com::sun::star::awt::grid::XGridControl
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
+ };
+ #endif // _SVT_GRIDCONTROL_HXX_
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index eb8a543d31f9..a8d05c49a7ae 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -646,7 +646,7 @@ sal_Bool ToolboxController::isHighContrast() const
vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() );
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow )
- bHighContrast = ( ((ToolBox *)pWindow)->GetBackground().GetColor().IsDark() );
+ bHighContrast = ( ((ToolBox *)pWindow)->GetSettings().GetStyleSettings().GetHighContrastMode() );
}
return bHighContrast;
diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx
index e322dbb8f96e..b4ddc2cc472d 100644
--- a/svtools/source/uno/unocontroltablemodel.cxx
+++ b/svtools/source/uno/unocontroltablemodel.cxx
@@ -47,38 +47,6 @@ using namespace ::svt::table;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt::grid;
-using namespace ::svt::table;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::view;
-using namespace ::toolkit;
-
-class UnoControlTableColumn : public IColumnModel
- {
- private:
- ColumnID m_nID;
- String m_sName;
- bool m_bIsResizable;
- TableMetrics m_nWidth;
- TableMetrics m_nMinWidth;
- TableMetrics m_nMaxWidth;
-
- public:
- UnoControlTableColumn(Reference<XGridColumn>);
-
- // IColumnModel overridables
- virtual ColumnID getID() const;
- virtual bool setID( const ColumnID _nID );
- virtual String getName() const;
- virtual void setName( const String& _rName );
- virtual bool isResizable() const;
- virtual void setResizable( bool _bResizable );
- virtual TableMetrics getWidth() const;
- virtual void setWidth( TableMetrics _nWidth );
- virtual TableMetrics getMinWidth() const;
- virtual void setMinWidth( TableMetrics _nMinWidth );
- virtual TableMetrics getMaxWidth() const;
- virtual void setMaxWidth( TableMetrics _nMaxWidth );
- };
//--------------------------------------------------------------------
UnoControlTableColumn::UnoControlTableColumn(Reference<XGridColumn> m_xGridColumn)
@@ -181,7 +149,7 @@ class UnoControlTableColumn : public IColumnModel
//====================================================================
struct UnoControlTableModel_Impl
{
- ::std::vector< PColumnModel > aColumns;
+ ::std::vector< PColumnModel >& aColumns;
TableSize nRowCount;
bool bHasColumnHeaders;
bool bHasRowHeaders;
@@ -190,11 +158,12 @@ class UnoControlTableColumn : public IColumnModel
TableMetrics nRowHeight;
TableMetrics nColumnHeaderHeight;
TableMetrics nRowHeaderWidth;
- std::vector<rtl::OUString> aRowHeadersTitle;
- std::vector<std::vector<rtl::OUString> > aCellContent;
+ std::vector<rtl::OUString>& aRowHeadersTitle;
+ std::vector<std::vector<rtl::OUString> >& aCellContent;
UnoControlTableModel_Impl()
- :nRowCount ( 0 )
+ :aColumns ( *(new std::vector< PColumnModel> (0)))
+ ,nRowCount ( 0 )
,bHasColumnHeaders ( false )
,bHasRowHeaders ( false )
,pRenderer ( )
@@ -202,8 +171,8 @@ class UnoControlTableColumn : public IColumnModel
,nRowHeight ( 4 * 100 ) // 40 mm
,nColumnHeaderHeight( 5 * 100 ) // 50 mm
,nRowHeaderWidth ( 10 * 100 ) // 50 mm
- ,aRowHeadersTitle ( 0 )
- ,aCellContent ( 0 )
+ ,aRowHeadersTitle ( *(new std::vector<rtl::OUString>(0)))
+ ,aCellContent ( *(new std::vector<std::vector<OUString> >(0)))
{
}
};
@@ -213,16 +182,10 @@ class UnoControlTableColumn : public IColumnModel
//====================================================================
//--------------------------------------------------------------------
UnoControlTableModel::UnoControlTableModel()
- :m_pImpl( new UnoControlTableModel_Impl ),
- m_xDataModel(0),
- m_xColumnModel(0),
- m_bHasColumnHeaders(false),
- m_bHasRowHeaders(false),
- m_bVScroll(false),
- m_bHScroll(false)
- {
- m_pImpl->bHasColumnHeaders = m_bHasColumnHeaders;
- m_pImpl->bHasRowHeaders = m_bHasRowHeaders;
+ :m_pImpl( new UnoControlTableModel_Impl )
+ {
+ m_pImpl->bHasColumnHeaders = false;
+ m_pImpl->bHasRowHeaders = false;
m_pImpl->pRenderer.reset( new GridTableRenderer( *this ) );
m_pImpl->pInputHandler.reset( new DefaultInputHandler );
}
@@ -236,7 +199,7 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
TableSize UnoControlTableModel::getColumnCount() const
{
- m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
+ //m_pImpl->aColumns.resize( m_xColumnModel->getColumnCount());
return (TableSize)m_pImpl->aColumns.size();
}
@@ -312,6 +275,11 @@ class UnoControlTableColumn : public IColumnModel
}
//--------------------------------------------------------------------
+ std::vector<PColumnModel>& UnoControlTableModel::getColumnModel()
+ {
+ return m_pImpl->aColumns;
+ }
+ //--------------------------------------------------------------------
PColumnModel UnoControlTableModel::getColumnModelByID( ColumnID id )
{
(void)id;
@@ -376,7 +344,7 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const
{
- if(overAllHeight>=actHeight && !m_bVScroll)
+ if(overAllHeight>=actHeight)// && !m_bVScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -385,7 +353,7 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
ScrollbarVisibility UnoControlTableModel::getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const
{
- if(overAllWidth>=actWidth && !m_bHScroll)
+ if(overAllWidth>=actWidth)// && !m_bHScroll)
return ScrollbarShowNever;
else
return ScrollbarShowAlways;
@@ -393,25 +361,26 @@ class UnoControlTableColumn : public IColumnModel
//--------------------------------------------------------------------
void UnoControlTableModel::setCellContent(std::vector<std::vector<rtl::OUString> > cellContent)
{
- if(cellContent.empty())
- {
- unsigned int i = m_pImpl->aColumns.size();
- std::vector<rtl::OUString> emptyCells;
- while(i!=0)
- {
- cellContent.push_back(emptyCells);
- --i;
- }
- }
- std::vector<rtl::OUString> cCC;
- for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
- {
- cCC = *iter;
- m_pImpl->aCellContent.push_back(cCC);
- }
- }
-
- std::vector<std::vector<rtl::OUString> > UnoControlTableModel::getCellContent()
+ //if(cellContent.empty())
+ //{
+ // unsigned int i = m_pImpl->aColumns.size();
+ // std::vector<rtl::OUString>& emptyCells;
+ // while(i!=0)
+ // {
+ // cellContent.push_back(emptyCells);
+ // --i;
+ // }
+ //}
+ //std::vector<rtl::OUString> cCC;
+ //for(::std::vector<std::vector<rtl::OUString> >::iterator iter = cellContent.begin(); iter!= cellContent.end();++iter)
+ //{
+ // cCC = *iter;
+ // m_pImpl->aCellContent.push_back(cCC);
+ //}
+ m_pImpl->aCellContent.swap( cellContent );
+ }
+
+ std::vector<std::vector<rtl::OUString> >& UnoControlTableModel::getCellContent()
{
return m_pImpl->aCellContent;
}
@@ -435,378 +404,8 @@ class UnoControlTableColumn : public IColumnModel
}
}
- std::vector<rtl::OUString> UnoControlTableModel::getRowHeaderName()
+ std::vector<rtl::OUString>& UnoControlTableModel::getRowHeaderName()
{
return m_pImpl->aRowHeadersTitle;
}
-::com::sun::star::uno::Any UnoControlTableModel::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridControl*, this ),
- SAL_STATIC_CAST( ::com::sun::star::awt::grid::XGridDataListener*, this ),
- //SAL_STATIC_CAST( com::sun::star::lang::XEventListener*, this ),
- //SAL_STATIC_CAST( com::sun::star::awt::XMouseListener*, this ),
- SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
- return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
-}
-
-// ::com::sun::star::lang::XTypeProvider
-IMPL_XTYPEPROVIDER_START( UnoControlTableModel )
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridControl>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel>* ) NULL ),
- getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener>* ) NULL ),
- VCLXWindow::getTypes()
-IMPL_XTYPEPROVIDER_END
-
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoControlTableModel::getColumnModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL UnoControlTableModel::setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoControlTableModel::getDataModel( ) throw (::com::sun::star::uno::RuntimeException)
-{
- return NULL;
-}
-void SAL_CALL UnoControlTableModel::setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)model;
-}
-sal_Int32 SAL_CALL UnoControlTableModel::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTableControl = (TableControl*)GetWindow();
- return pTableControl->GetCurrentRow( Point(x,y) );
-}
-
-/*
-void SAL_CALL UnoControlTableModel::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException)
-{
- VCLXWindow::addMouseListener( listener );
-}
-
-void SAL_CALL UnoControlTableModel::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException)
-{
- VCLXWindow::removeMouseListener( listener );
-}
-*/
-/*
-void SAL_CALL UnoControlTableModel::mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void)rEvent;
-}
-void SAL_CALL UnoControlTableModel::mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void)rEvent;
-}
-void SAL_CALL UnoControlTableModel::mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void) rEvent;
-}
-void SAL_CALL UnoControlTableModel::mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
-{
- (void) rEvent;
-}
-*/
-void SAL_CALL UnoControlTableModel::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)listener;
-}
-
-void SAL_CALL UnoControlTableModel::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
-{
- (void) listener;
-}
-
-void UnoControlTableModel::setProperty( const ::rtl::OUString& PropertyName, const Any& aValue) throw(RuntimeException)
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- TableControl* pTableControl = (TableControl*)GetWindow();
-
- switch( GetPropertyId( PropertyName ) )
- {
- case BASEPROPERTY_GRID_SELECTIONMODE:
- {
- SelectionType eSelectionType;
- if( aValue >>= eSelectionType )
- {
- SelectionMode eSelMode;
- switch( eSelectionType )
- {
- case SelectionType_SINGLE: eSelMode = SINGLE_SELECTION; break;
- case SelectionType_RANGE: eSelMode = RANGE_SELECTION; break;
- case SelectionType_MULTI: eSelMode = MULTIPLE_SELECTION; break;
- // case SelectionType_NONE:
- default: eSelMode = NO_SELECTION; break;
- }
- if( pTableControl->getSelEngine()->GetSelectionMode() != eSelMode )
- pTableControl->getSelEngine()->SetSelectionMode( eSelMode );
- }
- break;
- }
- case BASEPROPERTY_HSCROLL:
- {
- sal_Bool bHScroll = true;
- if( aValue >>= bHScroll )
- {
- m_bHScroll = bHScroll;
- }
- break;
- }
- case BASEPROPERTY_VSCROLL:
- {
- sal_Bool bVScroll = true;
- if( aValue >>= bVScroll )
- {
- m_bVScroll = bVScroll;
- }
- break;
- }
- case BASEPROPERTY_GRID_SHOWROWHEADER:
- {
- sal_Bool rowHeader = true;
- if( aValue >>= rowHeader )
- {
- setRowHeaders(rowHeader);
- }
- break;
- }
-
- case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- {
- sal_Bool colHeader = true;
- if( aValue >>= colHeader )
- {
- setColumnHeaders(colHeader);
- }
- break;
- }
- case BASEPROPERTY_GRID_DATAMODEL:
- {
- m_xDataModel = Reference< XGridDataModel >( aValue, UNO_QUERY );
- Sequence<Sequence< ::rtl::OUString > > cellData = m_xDataModel->getData();
- Sequence<rtl::OUString> rowData(0);
- for(int i = 0; i< m_xDataModel->getRowCount();++i)
- {
- rowData = cellData[i];
- std::vector<rtl::OUString> newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowData));
- if(newRow.size()<m_pImpl->aColumns.size())
- newRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii(""));
- m_pImpl->aCellContent.push_back(newRow);
- }
- Sequence< ::rtl::OUString > rowHeaders = m_xDataModel->getRowHeaders();
- std::vector< rtl::OUString > newRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rowHeaders));
- m_pImpl->nRowCount = m_xDataModel->getRowCount();
- setRowHeaderName(newRow);
- break;
- }
- case BASEPROPERTY_GRID_COLUMNMODEL:
- {
- m_xColumnModel = Reference< XGridColumnModel >( aValue, UNO_QUERY );
- Sequence<Reference< XGridColumn > > columns = m_xColumnModel->getColumns();
- std::vector<Reference< XGridColumn > > aNewColumns(
- comphelper::sequenceToContainer<std::vector<Reference< XGridColumn > > >(columns));
- if(!m_pImpl->aColumns.empty())
- m_pImpl->aColumns.clear();
- for ( ::svt::table::ColPos col = 0; col < m_xColumnModel->getColumnCount(); ++col )
- {
- UnoControlTableColumn* tableColumn = new UnoControlTableColumn(aNewColumns[col]);
- m_pImpl->aColumns.push_back((PColumnModel)tableColumn);
- }
- break;
- }
- default:
- VCLXWindow::setProperty( PropertyName, aValue );
- break;
- }
-}
-
-Any UnoControlTableModel::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
-{
- ::vos::OGuard aGuard( GetMutex() );
-
- const sal_uInt16 nPropId = GetPropertyId( PropertyName );
- TableControl* pTableControl = (TableControl*)GetWindow();
- if(pTableControl)
- {
- switch(nPropId)
- {
- case BASEPROPERTY_GRID_SELECTIONMODE:
- {
- SelectionType eSelectionType;
-
- SelectionMode eSelMode = pTableControl->getSelEngine()->GetSelectionMode();
- switch( eSelMode )
- {
- case SINGLE_SELECTION: eSelectionType = SelectionType_SINGLE; break;
- case RANGE_SELECTION: eSelectionType = SelectionType_RANGE; break;
- case MULTIPLE_SELECTION:eSelectionType = SelectionType_MULTI; break;
-// case NO_SELECTION:
- default: eSelectionType = SelectionType_NONE; break;
- }
- return Any( eSelectionType );
- }
- case BASEPROPERTY_GRID_SHOWROWHEADER:
- {
- return Any ((sal_Bool) pTableControl->GetModel()->hasRowHeaders());
- }
- case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
- return Any ((sal_Bool) pTableControl->GetModel()->hasColumnHeaders());
- case BASEPROPERTY_GRID_DATAMODEL:
- return Any ( m_xDataModel );
- case BASEPROPERTY_GRID_COLUMNMODEL:
- return Any ( m_xColumnModel);
- case BASEPROPERTY_HSCROLL:
- return Any ( m_bHScroll);
- case BASEPROPERTY_VSCROLL:
- return Any ( m_bVScroll);
- }
- }
- return VCLXWindow::getProperty( PropertyName );
-}
-
-void UnoControlTableModel::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
-{
- PushPropertyIds( rIds,
- BASEPROPERTY_GRID_SHOWROWHEADER,
- BASEPROPERTY_GRID_SHOWCOLUMNHEADER,
- BASEPROPERTY_GRID_DATAMODEL,
- BASEPROPERTY_GRID_COLUMNMODEL,
- BASEPROPERTY_GRID_SELECTIONMODE,
- 0);
- VCLXWindow::ImplGetPropertyIds( rIds, true );
-}
-void SAL_CALL UnoControlTableModel::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- if ( pTable )
- {
- pTable->SetModel(PTableModel(this));
- pTable->Show( bVisible );
- }
-}
-void SAL_CALL UnoControlTableModel::setFocus() throw(::com::sun::star::uno::RuntimeException)
-{
- ::vos::OGuard aGuard( GetMutex() );
- if ( GetWindow())
- GetWindow()->GrabFocus();
-}
-void SAL_CALL UnoControlTableModel::rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- std::vector<OUString> aNewRow(
- comphelper::sequenceToContainer< std::vector<rtl::OUString > >(Event.rowData));
- if(aNewRow.size()<m_pImpl->aColumns.size())
- aNewRow.resize(m_pImpl->aColumns.size(),rtl::OUString::createFromAscii(""));
- m_pImpl->aCellContent.push_back(aNewRow);
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.push_back(Event.headerName);
- m_pImpl->nRowCount=m_pImpl->aCellContent.size();
- TableControl* pTable = (TableControl*)GetWindow();
- pTable->InvalidateDataWindow(m_pImpl->nRowCount-1, false);
- //pTable->GrabFocus();
-}
-
-void SAL_CALL UnoControlTableModel::rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- //unsigned int rows =m_pImpl->aCellContent.size()-1;
- if(Event.index == -1)
- {
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.clear();
- m_pImpl->aCellContent.clear();
- }
- else
- {
- pTable->removeSelectedRow(Event.index);
- if(m_pImpl->aCellContent.size()>1)
- {
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.erase(m_pImpl->aRowHeadersTitle.begin()+Event.index);
- m_pImpl->aCellContent.erase(m_pImpl->aCellContent.begin()+Event.index);
-
- }
- else
- {
- if(hasRowHeaders())
- m_pImpl->aRowHeadersTitle.clear();
- m_pImpl->aCellContent.clear();
- //m_pImpl->nRowCount=0;
- }
- }
- //pTable->InvalidateDataWindow(Event.index, true);
- setRowCount(m_pImpl->aCellContent.size());
- pTable->InvalidateDataWindow(Event.index, true);
- //pTable->Invalidate();
-}
-
-void SAL_CALL UnoControlTableModel::dataChanged(const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
-{
- (void) Event;
-}
-
- void SAL_CALL UnoControlTableModel::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException)
- {
- VCLXWindow::disposing( Source );
- }
-
-::sal_Int32 SAL_CALL UnoControlTableModel::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-
-::sal_Int32 SAL_CALL UnoControlTableModel::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
-{
- return 0;
-}
-
-void SAL_CALL UnoControlTableModel::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)length;
- (void)start;
-}
-
-void SAL_CALL UnoControlTableModel::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)end;
- (void)start;
-}
-
-::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlTableModel::getSelection() throw (::com::sun::star::uno::RuntimeException)
-{
- TableControl* pTable = (TableControl*)GetWindow();
- std::vector<RowPos> selectedRows = pTable->getSelectedRows();
- Sequence<sal_Int32> selectedRowsToSequence(comphelper::containerToSequence(selectedRows));
- return selectedRowsToSequence;
-}
-
-::sal_Bool SAL_CALL UnoControlTableModel::isCellEditable() throw (::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
-}
-
-::sal_Bool SAL_CALL UnoControlTableModel::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
-{
- return sal_False;
-}
-
-::sal_Bool SAL_CALL UnoControlTableModel::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)index;
- return sal_False;
-}
-
-void SAL_CALL UnoControlTableModel::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)y;
-}
-
-void SAL_CALL UnoControlTableModel::selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException)
-{
- (void)x;
-}
diff --git a/svtools/source/uno/unocontroltablemodel.hxx b/svtools/source/uno/unocontroltablemodel.hxx
index 5da9cc871756..fe3d1f28e9ed 100644
--- a/svtools/source/uno/unocontroltablemodel.hxx
+++ b/svtools/source/uno/unocontroltablemodel.hxx
@@ -43,25 +43,48 @@
#include <toolkit/awt/vclxwindows.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
//#include <toolkit/helper/listenermultiplexer.hxx>
using namespace ::svt::table;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::grid;
+
+class UnoControlTableColumn : public IColumnModel
+ {
+ private:
+ ColumnID m_nID;
+ String m_sName;
+ bool m_bIsResizable;
+ TableMetrics m_nWidth;
+ TableMetrics m_nMinWidth;
+ TableMetrics m_nMaxWidth;
+
+ public:
+ UnoControlTableColumn(Reference<XGridColumn>);
+
+ // IColumnModel overridables
+ virtual ColumnID getID() const;
+ virtual bool setID( const ColumnID _nID );
+ virtual String getName() const;
+ virtual void setName( const String& _rName );
+ virtual bool isResizable() const;
+ virtual void setResizable( bool _bResizable );
+ virtual TableMetrics getWidth() const;
+ virtual void setWidth( TableMetrics _nWidth );
+ virtual TableMetrics getMinWidth() const;
+ virtual void setMinWidth( TableMetrics _nMinWidth );
+ virtual TableMetrics getMaxWidth() const;
+ virtual void setMaxWidth( TableMetrics _nMaxWidth );
+ };
struct UnoControlTableModel_Impl;
- class UnoControlTableModel : public ITableModel, public ::cppu::ImplInheritanceHelper2< VCLXWindow, ::com::sun::star::awt::grid::XGridControl,
- ::com::sun::star::awt::grid::XGridDataListener>
+ class UnoControlTableModel : public ITableModel
{
private:
UnoControlTableModel_Impl* m_pImpl;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >m_xDataModel;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >m_xColumnModel;
- bool m_bHasColumnHeaders;
- bool m_bHasRowHeaders;
- bool m_bVScroll;
- bool m_bHScroll;
- //MouseListenerMultiplexer m_aMouseListeners;
public:
UnoControlTableModel();
@@ -103,6 +126,7 @@ using namespace ::svt::table;
virtual void addTableModelListener( const PTableModelListener& listener );
virtual void removeTableModelListener( const PTableModelListener& listener );
virtual PColumnModel getColumnModel( ColPos column );
+ virtual std::vector<PColumnModel>& getColumnModel();
virtual PColumnModel getColumnModelByID( ColumnID id );
virtual PTableRenderer getRenderer() const;
virtual PTableInputHandler getInputHandler() const;
@@ -112,59 +136,9 @@ using namespace ::svt::table;
virtual ScrollbarVisibility getVerticalScrollbarVisibility(int overAllHeight, int actHeight) const;
virtual ScrollbarVisibility getHorizontalScrollbarVisibility(int overAllWidth, int actWidth) const;
virtual void setCellContent(std::vector<std::vector<rtl::OUString> > cellContent);
- virtual std::vector<std::vector<rtl::OUString> > getCellContent();
+ virtual std::vector<std::vector<rtl::OUString> >& getCellContent();
virtual void setRowHeaderName(std::vector<rtl::OUString> cellColumnContent);
- virtual std::vector<rtl::OUString> getRowHeaderName();
-
- //XGridDataListener overridables
- virtual void SAL_CALL rowAdded(const ::com::sun::star::awt::grid::GridDataEvent& Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL rowRemoved(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL dataChanged(const ::com::sun::star::awt::grid::GridDataEvent & Event) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
-
- ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL acquire() throw() { VCLXWindow::acquire(); }
- void SAL_CALL release() throw() { VCLXWindow::release(); }
-
- // ::com::sun::star::lang::XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
-
- //::com::sun::star::awt::grid::XGridControl
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel >& model ) throw (::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel( ) throw (::com::sun::star::uno::RuntimeException);
- void SAL_CALL setDataModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel >& model ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 end) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isCellEditable() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL selectColumn(::sal_Int32 x) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
- virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
-
- //void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException);
- //void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener ) throw(::com::sun::star::uno::RuntimeException);
- //::com::sun::star::awt::XMouseListener
- /*
- virtual void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
- */
-
- void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
- ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
- static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
- void SAL_CALL setVisible(sal_Bool bVisible) throw(::com::sun::star::uno::RuntimeException);
- void SAL_CALL setFocus() throw(::com::sun::star::uno::RuntimeException);
+ virtual std::vector<rtl::OUString>& getRowHeaderName();
};
inline void UnoControlTableModel::SetColumnWidth( ColPos _nColumn, TableMetrics _nWidth100thMM )
diff --git a/svtools/source/uno/unoevent.cxx b/svtools/source/uno/unoevent.cxx
index 19d40c17ce5c..6fc8b0017ad8 100644
--- a/svtools/source/uno/unoevent.cxx
+++ b/svtools/source/uno/unoevent.cxx
@@ -40,7 +40,7 @@
#include <tools/rtti.hxx>
#include <tools/solar.h>
#include "unoevent.hxx"
-#include <svtools/macitem.hxx>
+#include <svl/macitem.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
diff --git a/svtools/source/uno/unoifac2.hrc b/svtools/source/uno/unoifac2.hrc
index 4e8cf0303da5..4f46edffdc51 100644
--- a/svtools/source/uno/unoifac2.hrc
+++ b/svtools/source/uno/unoifac2.hrc
@@ -33,7 +33,7 @@
#ifndef _SOLAR_HRC
-#include <svtools/solar.hrc>
+#include <svl/solar.hrc>
#endif
//! Um den Überblick über alle benutzten HelpID's zu behalten sind diese
diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx
index 54cc448ff89e..a1ff1ad2ac3e 100644
--- a/svtools/source/uno/unoiface.cxx
+++ b/svtools/source/uno/unoiface.cxx
@@ -48,14 +48,13 @@
#include <toolkit/helper/convert.hxx>
#include <toolkit/helper/property.hxx>
#include <svtools/fmtfield.hxx>
-#include <numuno.hxx>
+#include <svl/numuno.hxx>
#include <calendar.hxx>
#include <prgsbar.hxx>
#include <svtools/svtreebx.hxx>
#include "treecontrolpeer.hxx"
-//#include "vclxgridcontrol.hxx"
-#include "unocontroltablemodel.hxx"
+#include "svtxgridcontrol.hxx"
#include <svtools/table/tablecontrol.hxx>
namespace
@@ -172,10 +171,8 @@ SAL_DLLPUBLIC_EXPORT Window* CreateWindow( VCLXWindow** ppNewComp, const ::com::
{
if ( pParent )
{
- ::svt::table::TableControl* m_pTable = new ::svt::table::TableControl(pParent, nWinBits);
- UnoControlTableModel* pModel = new UnoControlTableModel();
- *ppNewComp = pModel;
- pWindow = m_pTable;
+ pWindow = new ::svt::table::TableControl(pParent, nWinBits);
+ *ppNewComp = new SVTXGridControl;
}
else
{